//In here, `WORD_LEN is 32.
`include "Defines.v"
module Adder (in1, in2, out);
input [`WORD_LEN-1:0] in1, in2;
output [`WORD_LEN-1:0] out;
assign out = in1 + in2;
endmodule///
`timescale 1ns/1ns
module AdderTest;
reg in1, in2;
wire out;
Adder TestAdder(.in1(in1), .in2(in2), .out(out));
initial begin
in1 = 4'b0000; in2 = 4'b0000; #100;
in1 = 4'b0011; in2 = 4'b1111; #100;
in1 = 4'b1000; in2 = 4'b1100; #100;
$stop;
end
endmodule当我模拟这个过程时,只有in1和in2获得了这个值。除了他们,他们有一条蓝线。还有,外面有一条红线。我真的不明白这有什么问题。请帮帮忙。
发布于 2019-10-04 18:02:48
尽管您在模块中将in1、in2和out定义为32位端口(如您的注释所示),但测试台中连接的信号只有1位宽。因此,只驱动模块输入信号的第一位(即in1[0]和in2[0])。
尝试使用以下测试平台:
module AdderTest;
reg [31:0] in1, in2; // CHANGE
wire [31:0] out; // CHANGE
Adder TestAdder(.in1(in1), .in2(in2), .out(out));
initial begin
in1 = 4'b0000; in2 = 4'b0000; #100;
in1 = 4'b0011; in2 = 4'b1111; #100;
in1 = 4'b1000; in2 = 4'b1100; #100;
$stop;
end
endmodulehttps://stackoverflow.com/questions/58233513
复制相似问题