-
Notifications
You must be signed in to change notification settings - Fork 299
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
[ExportVerilog] Avoid inlining unpacked array expressions to declarations for tool compatibility #4548
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are assigns allowed with embedded (not top level) unpacked arrays? Should the test be fore any unpacked type in the aggregate?
Thanks for fixing this, I didn't realize that the assignment syntax only worked for unpacked arrays.
I guess in Verilog you can't have a I am guessing that you could still inline the assignment by mixing array concat for packed and literal for unpacked, e.g. wire [1:0] w[1:0] = `{{1, 2}, {3, 4}} |
I read too quickly and thought you were saying "packed arrays aren't allowed to have assignment initializations", which I don't immediately see an example of in the spec. As far as the original statement goes, this is an example right from the SystemVerilog spec, section 10.9.1 Array assignment patterns: bit unpackedbits [1:0] = '{1,1}; And IIRC there was an issue with inlining this into port declarations in a specific tool, which should also be allowed, if I am understanding what this means correctly, 10.8 Assignment-like contexts includes "A port connection to an input or output port of a module, interface, or program". |
I agree, we should reject these at HW verifier.
Yeah, Interesting. It look we can inline assignments for variable types ( |
After some discussion, it seems like assignment expressions might be considered one of the more esoteric sections of the sverilog spec, which was surprising to me. I think the current suggestion is that we have a lowering flag to split the initialization of these vars/wires for tool compatibility. FWIW |
Is this true? If so we can make verifiers for sv types. |
Can we have a couple examples of verilog here which are tested on standard tools? Perhaps added to the rational doc for export. |
Looking at SV.10.10.1, it looks like there is assignment?
An example from 6.20: |
But to the |
5db8c2e
to
1b59d26
Compare
1b59d26
to
15a5c99
Compare
I rebased the PR since this issue actually blocks DPI adaption in verilator. Ideally it is more desirable to improve verilator (and I don't think it's hard) but for now I want to avoid inlining unpacked arrays to declaration since it's just a tiny readability optimization. I considered adding lowering options but I think it's overkill for this one. |
This changes emission style for unpacked array declaration. Verilator doesn't support initialization assignments for unpacked arrays.
This PR checks the value type and prevents inlining. Ideally it is more desirable to improve verilator but for now I want to avoid inlining unpacked arrays to declaration since it's just a tiny readability optimization.
Fix #6363.