Using simulation grammar in verilog file
Hello,
I use a few simulation grammars, such as $display $time in my Verilog design file.
I know these might be unsynthesisable codes, but I have seen many codes use simulation grammar in their design files, for example, to achieve parameter check such as:
initial begin if (WORD_SIZE * STRB_WIDTH != DATA_WIDTH) begin $error("Error: AXI data width not evenly divisble (instance %m)"); $finish; end if (2**$clog2(WORD_WIDTH) != WORD_WIDTH) begin $error("Error: AXI word width must be even power of two (instance %m)"); $finish; end end
But I found when using Modelsim_altera and Quartus to perform simulation, the first step is to compile my design, but these unsynthesisable codes might lead to errors.
Is there any recommended method to do the same thing?
Thank you!
Hi,
OK so your version of Quartus supports Verilog-1995 and Verilog-2001. The system tasks you're using is that of SystemVerilog-2009. You should try replacing $error() with $display(). Make sure you set Verilog HDL Input to Verilog-2001 in the Compiler Settings.
More information on Verilog-2001 system tasks can be found here in clause 17: https://ieeexplore.ieee.org/document/954909
Regards,
Nurina