在尝试编译用 System Verilog 编写的 RTL 设计时,我使用的是 Synopsys Design Compiler,但收到以下错误消息:
错误:/home/rtl/mydesign.sv:66:循环变量未初始化为常量。(ELAB-800)
这是有问题的代码:
// Zero out bits from savedbit_loc all the way down to the least significant bit
// We don't know the value of savedbit_loc until the module is instantiated.
assign savedbit_loc = src1- MYPARAM1 - 1;
// Zero out the
always @(*) begin
for (int i = savedbit_loc; i >= 0; i--) begin
zeroedout[i] = 1'b0;
end
end
MYPARAM1 是在模块实例化时设置的参数。
它抱怨的行是:
for (int i = savedbit_loc; i >= 0; i--) begin
我的代码在 ncverilog 中运行得很好并获得了正确的输出。
有没有另一种方法来编写这个模块,这样我就不会收到这个错误?