Latest Post

Ads

Verilog: Half Adder Structural/Gate Level Modelling with Testbench

Verilog Code for Half Adder Structural/Gate Level Modelling

module half_adder(
    input i0,
    input i1,
    output s,
    output c
    );
               and(c,i0,i1);
               xor(s,i0,i1);
endmodule

//Testbench code for Half Adder Structural/Gate Level Modelling


initial begin
                             // Initialize Inputs
                             i0 = 0;
                             i1 = 0;
                             // Wait 100 ns for global reset to finish
                             #100;
                             // Add stimulus here
                             #100; i0 = 0; i1 = 1;
                             #100; i0 = 1; i1 = 0;
                             #100; i0 = 1; i1 = 1;
end


Output:


RTL Schematic:
Half Adder Verilog

Other Verilog Programs:

Go to Index of Verilog Programming

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

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