Friday, December 30, 2022

 XL-FA :- (5i/p -1bitwide adder):-

module xlfa(cout2,cout1,s,a,b,c,d,e);
input a,b,c,d,e;
output cout2,cout1,s;
xfa xf1 (c2,c1,s1,a,b,c,d); 
ha h1 (c3,s,s1,e);
ha h2 (c4,cout1,c3,c1);
ha h3 (c5,cout2,c4,c2);
endmodule

Test bench:-

module adtb ();
reg a,b,c,d,e;
wire cout2,cout1,s;
xlfa dut (cout2,cout1,s,a,b,c,d,e);
integer j;
initial
begin
for (j=0;j<=31;j=j+1)
begin
{a,b,c,d,e}= j;
#1;
$display(a,b,c,d,e,":",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...