Latest Post

Verilog: Half Adder Behavioral Modelling with Testbench Code

  Verilog Code Half Adder Behavioral Modelling

module Half_Adder (

input a, b;

output sum, carry );

always @(a or b)

assign {carry,sum} = a + b;

endmodule


// test-bench

initial begin

a=0; b=0;

#100;

//wait 100ns for global reset to finish

//add stimulus here

#100 a=0; b=1;

#100 a=1; b=0;

#100 a=1; b=1;

end

initial begin

#100 $monitor(“a=%b, b=%b, sum=%b, carry=%b”, a, b, sum, carry);

end

endmodule


Xilinx Output:
Half Adder Verilog Code Behavioral Modelling with Testbench
Half Adder Verilog Code Behavioral Modelling


Comments

Popular posts from this blog

Samir Palnitkar Solution Manual Free Download PDF of Verilog HDL

Verilog: 1to 8 DeMultiplexer (1-8 DEMUX) Dataflow Modelling with Testbench Code

VLSI: 4-1 MUX Dataflow Modelling with Testbench

Verilog: 8 to 1 Multiplexer (8-1 MUX) Dataflow Modelling with Testbench Code

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