Professional Documents
Culture Documents
TRUTH TABLE
A B C D F
0 0 0 0 1
0 0 0 1 1
0 0 1 0 1
0 0 1 1 0
0 1 0 0 0
0 1 0 1 1
0 1 1 0 1
0 1 1 1 0
1 0 0 0 0
1 0 0 1 1
1 0 1 0 0
1 0 1 1 1
1 1 0 0 0
1 1 0 1 1
1 1 1 0 1
1 1 1 1 1
CIRCUIT DIAGRAM:
B,C,D are select lines and (1,1,~A,A,0,1,1,A)
respectively are input lines.
VERILOG CODE:
In this Verilog code, we have coded a general 8x1 multiplexer in
module named mux8x1_circuit in which we are giving different
inputs and defining the outputs based on the combination of select
lines. This mux8x1_circuit module is then instantiated in the main
mux8x1 module where we define the inputs i0, i1, i2, i3
appropriately and thus we are getting the corresponding outputs.
VERILOG TESTBENCH:
GKT WAVEFORM:
we can observe this wave form using gkt.
TRUTH TABLE
A B C D F
0 0 0 0 1
0 0 0 1 1
0 0 1 0 1
0 0 1 1 0
0 1 0 0 0
0 1 0 1 1
0 1 1 0 1
0 1 1 1 0
1 0 0 0 0
1 0 0 1 1
1 0 1 0 0
1 0 1 1 1
1 1 0 0 0
1 1 0 1 1
1 1 1 0 1
1 1 1 1 1
CIRCUIT DIAGRAM:
VERILOG CODE:
In this code, I coded a general 4x1 multiplexer with
active low enable input in module named MUX in
which we are giving different inputs and defining the
outputs based on the combination of select lines.
This MUX modules are instantiated in the main mux4x1
module to create 2 objects named m1 and m2. (i0=vcc,
i1=~A, i2=A,i3=gnd) The inputs i0, i0,i1,i2 are used for
the m1 multiplexer whose enable input is defined by B
whereas the inputs i3,i0,i0,i2 are used in the other m2
multiplexer whose enable input is defined by ~B.
Subsequently, we get f1 and f2 as outputs from the
two multiplexers and we use the OR gate on these two
to get the final output F.
VERILOG TESTBENCH:
GKT WAVEFORM: