Monday, January 23, 2023

 

2I/P- A-1bit; B-5BIT WIDE ADDER 

module add2_5b (co1,s,a,b);
input [4:0]b;
input a;
output [4:0]s;
output co1;
fa ra1 (c0,s[0],a,b[0],1'b0);
fa ra2 (c1,s[1],1'b0,b[1],c0);
fa ra3 (c2,s[2],1'b0,b[2],c1);
fa ra4 (c3,s[3],1'b0,b[3],c2);
fa ra5 (co1,s[4],1'b0,b[4],c3);
endmodule


TEST BENCH:-

module add2_5b_tb();
reg [4:0]a,b;
wire [4:0]s;
wire c;
add2_5b dut (c,s,a,b);
initial
begin
repeat(20)
begin
a=$random;
b=$random;
#1;
$display({a}," ",{b},":",{c,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...