Open KelvinChung2000 opened 5 months ago
Hmmm ... "const" is on the keyword list here:
So I think we would catch if you name a signal const
but maybe we don't check field names?
This is likely the case. My guess is the bitstruct
field is not checked.
Would make a great fix for a pull request if you are interested!
It is intended that we do not check for Verilog keywords when making a new bitstruct
class, since it still works for Python simulation. We only check if the bitstruct fields are Python keywords or valid Python identifiers.
https://github.com/pymtl/pymtl3/blob/4b3bc183b14ffacd069f48dc5997b00045aea53f/pymtl3/datatypes/bitstructs.py#L744-L747
I think it would be more appropriate to check if the field names are Verilog keywords in the translation pass.
Right ... I think our point was we currently have a list of verilog keywords that get checked at translation although currently it looks like we don't check if bitstruct fields are verilog keywords at translation ...
VerilogTranslationPass
fail with the following example.When running
verilator --lint-only ./test__t_aType__a_4__b_6__const_32__pickled.v
will give the following error.Fixing is easy as I can just not name things with the System Verilog key. But I will still report it as you have checks in place to prevent this, and the check fails to detect it.