Open udif opened 1 year ago
Hi udif,
Interesting, I wasn't aware about that System Verilog specification. Thanks for letting me know. So more than a simulator bug it indeed seems to be a SV quirk. Still, you could expect that, at least, commercial simulators would offer a configuration option to change the behaviour, and avoid unneeded differences with real synthesis, but I digress.
Yeah, I know that the translate_off directive is not a SV standard. But using ifdef is not a practical solution because there is no standard predefined macro to distinguish between simulation and synthesis. That means the user would require adding an external macro somehow. I don't like that solution.
By the standard, SYNTHESIS is predefined for all synthesis tools:
The SYNTHESIS macro seems a more generic solution, as it is defined by the standard.
By the standard, SYNTHESIS is predefined for all synthesis tools:
Doesn't seem so. Quartus, at least some versions, doesn't support this.
The quote above, is not 100% accurate. I mean it is accurate, but the citation is not from IEEE1364-2005, but rather from the withdrawn IEEE1364.1-2002 IEEE Standard for Verilog RTL.
Section 6.2 and 6.3 says two things:
`ifdef SYNTHESIS
translate_on
and translate_off
Personally, I haven't seen new code using this "feature" for the last 15 years, and I work with SystemVerilog daily.
Unfortunately it really doesn't matter here, if it is, or it was, a standard feature. As long as Quartus doesn't support this, I am afraid I cannot use it.
With respect to the following comments:
If you look at IEEE1800-2017, you will see the following, in section
11.4.3 Arithmetic operators
:That means that although in your case you naturally expect the low 16 output bits to not be affected by Xs on the upper 16 bits, this is not what the SystemVerilog spec says, so this is not a simulator bug, but more like a SystemVerilog gotcha.
Other than that, I would avoid the use of
`synthesis translate_off
altogether, and replace them with an`ifdef
...`endif
: