I start getting this error after I actually make a register static.
This complies fine in 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
But Modelsim gives me this error:
# ** 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.
Now when I add static in front of reg [$clog2(AUTOREFRESH_CLOCKS):0] AutoRefreshCounter = 0; Quartus gives me this error (which looks to be the opposite of my change):
Error (10959): SystemVerilog error at Ram.sv(139): illegal assignment - automatic variables can't have non-blocking assignments
And this points to the register that I've just added the static keyword for!
The only possible explanation I can think of is that when I add static to this single reg it starts treating other regs as automatic, but then the line number in the error message is wrong.