我有这个代码并且它早期产生了一个GTK波,但我不得不从行为开始实现RTL,但现在它不会编译。如果任何人可以帮我解决这个问题,我会收到错误:
这是我的代码:
module combinational_mult(product,multiplier,multiplicand);
input [31:0] multiplier;
input [63:0] multiplicand;
output product;
reg [63:0] product;
reg c;
reg [63:0] m;
integer i;
always @( multiplier or multiplicand )
begin
//initialize
product[63:32] = 32'b0;
product[31:0] = 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[31:16] + m ;
//product[63:0] = {c,product[63:1]};
// c = 0;
for (i = 0; i < 32; i++)
begin
if (multiplier == 1)
product = product + m;
multiplicand << 1;
multiplier >> 1;
c=0;
end
end
endmodule
module testbench;
reg [31:0] multiplier;
reg [63:0] multiplicand;
initial begin
$dumpfile("USAMv1.dat");
$dumpvars;
#10ns;
multiplier = 32'b0000_0000_0000_0000_1101_1001_1101_1001;
multiplicand = 32'b0000_0000_0000_0000_0110_1010_1101_1000;
#50ns;
multiplier = 32'b0;
multiplicand = 32'b0;
$finish;
end
combinational_mult dut ( product, multiplier, multiplicand);
endmodule
答案 0 :(得分:0)
Verilog不支持++
(SystemVerilog),请使用i=i+1
。
移位运算符(<<
&amp; >>
)需要成为右手表达式赋值的一部分。前a = b << c;
我只是指出了编译错误。不是功能错误