Exp 5
Exp 5
Exp 5
5
Aim: Design and simulation of 4:1 multiplexer
Tools Used: Xilinx ISE 14.7
Theory:
4:1 Multiplexer:
A 4-to-1 multiplexer consists four data input lines as I0 to I3, two select lines
as S1 and S0 and a single output line Y. The select lines S1 and S0 select one of the four input
lines to connect the output line. The particular input combination on select lines selects one of
input (through I0 to I3) to the output.
Table 5.1: Truth Table of 4:1 multiplexer
S1 S0 Y
0 0 I0
0 1 I1
1 0 I2
1 1 I3
Design Equation:
Y=S1S0I0+S1S0I1+S1S0I2+S1S0I3
Synthesis:
VERILOG CODE:
A.Gate module coding of 4:1 Multiplexer:
module mux4_1(input I0,input I1,input I2,input I3,input S0,input S1,
output Y
);
wire W0,W1,W2,W3;
and a0(W0,I0,(~S1),(~S0));
and a1(W1,I1,(~S1),S0);
and a2(W2,I2,S1,(~S0));
and a3(W3,I3,S1,S0);
or a4(Y,W3,W2,W1,W0);
endmodule
RTL Schematic:
Figure 5.5: RTL schematic of 4:1 multiplexer using behavioural modelling technique
Test Bench:
module mux4_test;
// Inputs
reg S1;
reg S0;
reg I0;
reg I1;
reg I2;
reg I3;
// Outputs
wire Y;
// Instantiate the Unit Under Test (UUT)
mux4_1behav uut (
.S1(S1),
.S0(S0),
.I0(I0),
.I1(I1),
.I2(I2),
.I3(I3),
.Y(Y)
);
initial begin
I0=0;
I1=1;
I2=1;
I3=0;
//diffrent combination of S1S0
S1=0;S0=0; #100;
S1=0;S0=1; #100;
S1=1;S0=0; #100;
S1=1;S0=1; #100;
end
endmodule
Ouput: