Verilog 测试文件怎么写

2025-03-04 14:58:17
推荐回答(1个)
回答1:

module test_freq;

// Inputs
reg [3:0] a,b;
reg ci;

// Outputs
wire [3:0] y;
wire co;

// Instantiate the Unit Under Test (UUT)
add4bit uut (
.a(a),
.b(b),
.ci(ci),
.co(co),
.y(y)
);

initial begin
// Initialize Inputs
a= 0;
b= 0;
ci= 0;

// Wait 100 ns for global reset to finish
#100;
a = 3;

b=4;
ci =0;
end

endmodule

如上就是测试3+4,进位为0时的输出。测试的步骤网上看看吧,各个软件不一样。