Untitled
unknown
plain_text
a year ago
996 B
6
Indexable
`timescale 1ns / 1ps module tb_carry_lookahead_adder; // Parameter for the width of the adder parameter WIDTH = 4; // Inputs reg [WIDTH-1:0] i_add1; reg [WIDTH-1:0] i_add2; // Outputs wire [WIDTH:0] o_result; // Instantiate the Unit Under Test (UUT) carry_lookahead_adder #(WIDTH) uut ( .i_add1(i_add1), .i_add2(i_add2), .o_result(o_result) ); initial begin // Initialize Inputs i_add1 = 0; i_add2 = 0; // Apply test vectors #10 i_add1 = 4'b0001; i_add2 = 4'b0001; // 1 + 1 = 2 #10 i_add1 = 4'b0010; i_add2 = 4'b0011; // 2 + 3 = 5 #10 i_add1 = 4'b0110; i_add2 = 4'b0011; // 6 + 3 = 9 #10 i_add1 = 4'b1111; i_add2 = 4'b0001; // 15 + 1 = 16 #10 i_add1 = 4'b1010; i_add2 = 4'b0101; // 10 + 5 = 15 // Add more test vectors as needed // Finish simulation #10 $finish; end initial begin $monitor("At time %t, i_add1 = %b, i_add2 = %b, o_result = %b", $time, i_add1, i_add2, o_result); end endmodule
Editor is loading...
Leave a Comment