Latest Post

Ads

VLSI: 4-2 Encoder Dataflow Modelling with Testbench

Verilog Code for 4-2 Encoder Dataflow Modelling

module encode_4_to_2(
    input d0,d1,d2,d3,
    output a0,a1
    );
assign x = ~ d2;
assign y = x & d1;
assign a0 = y | d3;
assign a1 = d2 | d3;
endmodule


//Testbench code for 4-2 Encoder Dataflow Modelling

initial begin
                             // Initialize Inputs
                             d0 = 1;d1 = 0;d2 = 0;d3 = 0;
                             // Wait 100 ns for global reset to finish
                             #100;
                             // Add stimulus here
                             #100;d0 = 0;d1 = 1;d2 = 0;d3 = 0;
                             #100;d0 = 0;d1 = 0;d2 = 1;d3 = 0;
                             #100;d0 = 0;d1 = 0;d2 = 0;d3 = 1;
 end

Output:
VLSI: 4-2 Encoder Dataflow Modelling with Testbench




Comments

Ads

Popular posts from this blog

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

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

VLSI: 4-1 MUX Dataflow Modelling with Testbench

VLSI: Half Subtractor and Full Subtractor Gate Level Modelling

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