Latest Post

Ads

VLSI: 4-1 MUX Structural/Gate Level Modelling with Testbench

Verilog Code for 4-1 MUX Structural/Gate Level Modelling

4-1 MUX
4-1 MUX
module m41(out, a, b, c, d, s0, s1);
output out;
input a, b, c, d, s0, s1;
wire sobar, s1bar, T1, T2, T3, T4;

not (s0bar, s0), (s1bar, s1);
and (T1, a, s0bar, s1bar), (T2, b, s0bar, s1),(T3, c, s0, s1bar), (T4, d, s0, s1);
or(out, T1, T2, T3, T4);
endmodule

//Testbench code for 4-1 MUX Structural/Gate Level Modelling

initial begin

// Initialize Inputs
a = 1;b = 0;c = 0;d = 0;s0 = 0;s1 = 0;
// Wait 100 ns for global reset to finish
#100;
// Add stimulus here

#100; s0=0;s1=1;a=0;b=1;c=0;d=0;
#100; s0=1;s1=0;a=0;b=0;c=1;d=0;
#100; s0=1;s1=1;a=0;b=0;c=0;d=1;

end

Output:
Verilog 4-1 MUX


Other Verilog Programs:

Go to Index of Verilog Programming

Comments

Ads

Popular posts from this blog

VLSI: 1-4 DEMUX (Demultiplexer) Dataflow Modelling with Testbench

VLSI: BCD to Excess 3 and Excess 3 to BCD Dataflow Modelling

VLSI: 2 Bit Magnitude Comparator Dataflow Modelling

1 to 4 DEMUX (Demultiplexer) Verilog CodeStructural/Gate Level Modelling with Testbench

Full Subtractor Verilog Code in Structural/Gate Level Modelling with Testbench