我正在用Icarus Verilog模拟一个16位的MIPS网表。这是我在testbench中得到的错误
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文件转储out.In情况下的网表,我甚至没有得到vcd文件生成。很高兴听到你的想法。
发布于 2013-07-12 22:07:34
您的代码看起来很好,我刚刚在Icarus (来自git的当前版本)中测试了数组的跨模块变量索引,并且可以正常工作。
我怀疑你的问题是你自己在编译mips_16_core_top_tb_0.v -如果你这样做了,Icarus会给出这个消息。所有源文件都需要在Icarus中一起编译。其他一些模拟器将允许你自己编译这个文件,然后只在精化过程中检查错误(即。当你运行模拟时),但是Icarus做它的方式是Verilog最初打算使用的方式。
发布于 2013-07-12 13:39:05
在这种情况下,registerindex中的索引必须是常量。在reg_arrayi中,i是一个变量,不是固定的。要模拟使用此代码,必须对设计进行重新建模,使其不需要变量索引寄存器。这可能是特定于模拟器的对此功能的支持不足。如果是这样的话,您应该尝试不同的模拟器。
https://stackoverflow.com/questions/17603469
复制相似问题