【发布时间】:2018-09-17 22:07:05
【问题描述】:
在我实际将寄存器设为静态后,我开始收到此错误。
这在 Quartus 中很好:
task InitAutoRefresh;
reg [$clog2(AUTOREFRESH_CLOCKS):0] AutoRefreshCounter = 0;
AutoRefreshCounter <= AutoRefreshCounter + 1;
InitState <= (AutoRefreshCounter < AUTOREFRESH_CLOCKS) ? InitState : InitState + 1;
InitCmd <= (AutoRefreshCounter == 0) ? CMD_AR : CMD_NOP;
endtask
但是 Modelsim 给了我这个错误:
# ** Error (suppressible): C:/projects/Camera-RAM-VGA/Ram.sv(137): (vlog-2244) Variable 'AutoRefreshCounter' is implicitly static. You must either explicitly declare it as static or automatic
# or remove the initialization in the declaration of variable.
现在,当我在 reg [$clog2(AUTOREFRESH_CLOCKS):0] AutoRefreshCounter = 0; 前面添加 static 时,Quartus 给了我这个错误(这看起来与我的更改相反):
Error (10959): SystemVerilog error at Ram.sv(139): illegal assignment - automatic variables can't have non-blocking assignments
这指向我刚刚添加了static关键字的寄存器!
我能想到的唯一可能的解释是,当我将static 添加到单个reg 时,它开始将其他reg 视为automatic,但随后错误消息中的行号是错误的。
【问题讨论】:
标签: static system-verilog modelsim quartus