当我实际做了一个静态寄存器之后,我就开始得到这个错误。
这符合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.现在,当我在static前面添加reg [$clog2(AUTOREFRESH_CLOCKS):0] AutoRefreshCounter = 0;时,Quartus给出了这个错误(看起来与我的更改正好相反):
Error (10959): SystemVerilog error at Ram.sv(139): illegal assignment - automatic variables can't have non-blocking assignments这指向我刚刚添加了static关键字的寄存器!
我能想到的唯一可能的解释是,当我将static添加到这个单一的reg中时,它开始将其他的规则视为automatic,但是错误消息中的行号是错误的。
发布于 2018-09-17 22:41:42
我只需将AutoRefreshCounter的声明移到任务之外。然后很明显,变量只能在0时刻初始化一次。(这就是首先出现“隐式静态”错误消息的原因)。
https://stackoverflow.com/questions/52376303
复制相似问题