我的代码可以编译,但不会为 gtkwave 转储任何 dat 文件。我正在尝试实现组合移位乘数对象。我不认为我的测试人员是正确的。
module combinational_mult(product,multiplier,multiplicand);
input [31:0] multiplier;
input[63:0] multiplicand;
output reg [63:0] product;
reg c;
reg [31:0] m;
integer i;
always @( multiplier or multiplicand )
begin
//initialize
product[63:32] = 16'b0000_0000_0000_0000;
product[32:16] = multiplier;
m = multiplicand;
c = 1'b0;
//add,shift algorithm for unsigned multiplication.
//following the notes.
for(i=0; i<32; i=i+1)
begin
if(product[0]) {c,product[63:32]} = product[63:32] + m ;
product[63:0] = {c,product[63:1]};
c = 0;
end
end
endmodule
module tester(output reg [31:0] multiplier, output reg [63:0] multiplicand, output reg [63:0] product, output reg c, output reg i);
initial begin
i = 0;
$dumpfile("USAMv1.dat");
$dumpvars;
#10 multiplier = 16'b1101_1001_1101_1001;
multiplicand = 16'b0110_1010_1101_1000;
#50 $finish;
end
endmodule
module testbench;
wire[31:0] multiplier;
wire[63:0] multiplicand;
wire[63:0] product;
wire c, i;
tester sim( multiplier, multiplicand, product, c, i);
combinational_mult dut ( product, multiplier, multiplicand);
endmodule