Saturday, December 31, 2022

 7 i/p (1bit wide) ADDER:-

module add7 (cout2,cout1,s,a,b,c,d,e,f,g);
input a,b,c,d,e,f,g;
output cout2,cout1,s;
add6 ad1 (c2,c1,s1,a,b,c,d,e,f);
ha h1 (c3,s,s1,g);
ha h2 (c4,cout1,c3,c1);
ha h3 (c5,cout2,c4,c2);
endmodule


 Testbench :-

module adtb ();
reg a,b,c,d,e,f,g;
wire cout2,cout1,s;

add7 dut (cout2,cout1,s,a,b,c,d,e,f,g);
integer j;
initial
begin
for (j=0;j<=127;j=j+1)
begin
{a,b,c,d,e,f,g}= j;
#1;
$display(a,b,c,d,e,f,g,":",cout2,cout1,s);
end
end
endmodule

No comments:

Post a Comment

VERILOG CODES :-

 VERILOG CODES :- (by NUTAN.K) COMBINATIONAL :-  1.MUX:- (one bit wide)  1a) 2:1 MUX and its Testbench   1b) 4:1 MUX using 2:1 and its testb...