-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slightly modernize Verilog, take 2 #400
base: main
Are you sure you want to change the base?
Slightly modernize Verilog, take 2 #400
Conversation
Remove all support code for Verilog 95 compatibility. Not only is V95 ancient, it also doesn't support necessary features like vendor-agnostic attributes, which will now see use. This also deletes the relevant tests, and simplifies a little of the pretty-printing code, too. Signed-off-by: Austin Seipp <[email protected]>
Verilog 2001 attributes are supported by Vivado, Quartus, and other tools (like Yosys) in order to parallel/full case semantics. Usage of synopsys-specific synthesis comments can be done better this way, and it suppresses a real warning with Yosys. This takes us *out* of v95 territory, because Verilog attributes were added in Verilog 2001. Currently, no fallback is supported, though this could be fixed. It's unclear to me how much this harms "portability" of the output Verilog code, but such features can always be added back later on demand... Signed-off-by: Austin Seipp <[email protected]>
Modern tools such as Yosys hate ancient proprietary synopsys pragmas of the following, but handle them anyway: // synopsys translate_off .... // synopsys translate_on For translate pragmas, almost all reasonable synthesis tools support the following standardized alternative: `ifndef SYNTHESIS .... `endif // SYNTHESIS This moves all the compiler code to now emit the latter code, instead of the former. The former style currently still exists in the standard library's Verilog primitives. Signed-off-by: Austin Seipp <[email protected]>
To align with previous changes in the compiler, this migrates all Verilog primitives to use `ifndef SYNOPSYS` instead of `translate_off` pragmas. Signed-off-by: Austin Seipp <[email protected]>
Thank you! Apologies for the delay in reviewing! Some notes: (1) When you make changes in GenBin and GenABin (that affect the encoding of the (2) I'm curious about the two changes in this line of
There are two separate changes here: removing the In theory, the However, I suspect the However, I see that there is still one place in Ok, so, stepping back. The I'm OK with that decision, although I'd prefer to go a step further: remove the positional option altogether! (Remove the The (3) FYI, there's a convention in the source code to prepend (4) No action needed, but FYI: You removed the (5) Did you explicitly decide that you prefered this form:
instead of this form (which might have been my first thought):
Your way has the (6) I see that the User Guide is inconsistent about the order of the (7) There are 100+ failures in the testsuite. Most are just tests that compare the entire generated Verilog against an expected file (as an easy way to check for certain features in codegen). But there are two that are testing specifically for the pragmas around initial blocks and around system tasks. Those are in For all the tests that are just comparing the entire generated Verilog, it could be argued that those tests could be written to be more targeted in their checking. Or, since the compare procedure already runs a filter on both the generated and golden files to remove incidental differences, that the pragmas could be filtered/canonicalized in that script. But I think there's benefit to having the testsuite check the full file in lots of places, to help catch unexpected differences. So I'd say to just update the expected file in all these places. It's up to you whether you want to update each commit to include updates to the testsuite for that commit or whether you want to just add a new commit that udpates the test in one go. Also, if you would prefer that I take any of this work over the finish line, let me know. |
Thanks for the comments Julie, I'll try to handle these this week and reply more thoroughly when I get a chance to return to compiler hacking... |
This is a continuation of #294, with the following changes at the suggestion of @quark17:
-v95
flag, so users aren't mislead. Includes a tiny bit of cleanup.synopsys
pragmas entirely, like last time.ifndef SYNTHESIS
pragmas, as suggested by Julie. I found this to be a much more reasonable and less invasive change. This also avoids any changes in semantics in the output (for now.)This doesn't include the change for
always @*
for combinational components just yet; I'll add that in a separate PR, but I think all of these are straight-forward and uncontroversial.