0% found this document useful (0 votes)
2 views4 pages

Verilog Adder Module with Delays

The document contains multiple Verilog modules for a half adder, showcasing different implementations with varying delays for the sum (s) and carry (c) outputs. It includes testbench modules that simulate the half adder's behavior with various input combinations. Additionally, it presents examples of both rise and fall delays in the signal assignments.

Uploaded by

jaisowmiyar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Verilog Adder Module with Delays

The document contains multiple Verilog modules for a half adder, showcasing different implementations with varying delays for the sum (s) and carry (c) outputs. It includes testbench modules that simulate the half adder's behavior with various input combinations. Additionally, it presents examples of both rise and fall delays in the signal assignments.

Uploaded by

jaisowmiyar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

module adderhalf(

input a,b, output s,c);

assign #5 s=a^b;

assign #3 c=a&b;

endmodule

module adderh_tb;

reg a,b;

wire s,c;

adderhalf a1(.a(a),.b(b),.s(s),.c(c));

initial

begin

a=0;b=0; #5;

a=0;b=1; #5;

a=0;b=0; #5;

a=0;b=1; #5;

a=1;b=1; #5;

a=1;b=0; #5;

a=1;b=0; #5;

a=1;b=1; #5;

a=0;b=1; #5;

a=1;b=0; #5;

$finish;

end

endmodule
module adderhalf(

input a,b, output s,c);

assign #2 s=a^b;

assign #3 c=a&b;

endmodule

module adderh_tb;

reg a,b;

wire s,c;

adderhalf a1(.a(a),.b(b),.s(s),.c(c));

initial

begin

a=0;b=0; #1;

a=0;b=1; #1;

a=0;b=0; #1;

a=0;b=1; #1;

a=1;b=1; #1;

a=1;b=0; #1;

a=1;b=0; #1;

a=1;b=1; #1;

a=0;b=1; #1;

a=1;b=0; #1;
$finish;

end

endmodule

Fall delay

module adderhalf(

input a,b, output s,c);

buf #(0,3) b1(s,a);

and a1(c,a,b);

endmodule
Raise and Fall delay

module adderhalf(

input a,b, output s,c);

buf #(1,2) b1(s,a);

and a1(c,a,b);

endmodule

You might also like