【发布时间】:2013-07-11 21:03:10
【问题描述】:
我正在 Icarus Verilog 中模拟 16 位 MIPS 网表。 这是我在测试台中遇到的错误
mips_16_core_top_tb_0.v:144: error: Scope index expression is not constant: i
mips_16_core_top_tb_0.v:144: error: Unable to bind wire/reg/memory `uut.register_file_inst.reg_array[i]' in `mips_16_core_top_tb_0_v.display_all_regs'
Related code :
task display_all_regs;
begin
$display("display_all_regs:");
$display("------------------------------");
$display("R0\tR1\tR2\tR3\tR4\tR5\tR6\tR7");
for(i=0; i<8; i=i+1)
$write("%d\t",uut.register_file_inst.reg_array[i]); <--- error points to this line
$display("\n------------------------------");
end
endtask
我在模拟 RTL 时也遇到了同样的错误,但我仍然将 vcd 文件转储出去。在网表的情况下,我什至没有生成 vcd 文件。 很高兴听到您的想法。
【问题讨论】:
-
reg_array是如何定义的?请在任务中定义integer i;。同一个i可能存在冲突的驱动程序。 -
尝试添加整数 i;它在第 i 行表示语法错误;错误 mips_16_core_top_tb_0.v:140:语法错误 mips_16_core_top_tb_0.v:140:错误:语句格式错误
-
将
integer i;移动到begin之前。您不能直接在此处附加文件。您可以将其上传到具有公共访问权限的文件共享站点(或您自己的个人站点)并提供链接。 -
如果 reg_array 没有定义,你希望如何写出它的内容?您是否已验证网表中寄存器值的分层路径与 RTL 中的相同?
-
很抱歉给您带来了困惑。 reg_array 是 register_file.v 中声明的寄存器。它不是输入/输出端口。这是调用不属于端口声明列表一部分的信号的语法正确方法吗?。