Verilog: introduce $unit scope to parser#1808
Merged
Conversation
71456ec to
3fdb43e
Compare
3fdb43e to
83ee108
Compare
tautschnig
approved these changes
Apr 22, 2026
Collaborator
tautschnig
left a comment
There was a problem hiding this comment.
Why does this not affect any test? Are all our tests too simple?
83ee108 to
503821c
Compare
Collaborator
Author
|
The problem here is that the name resolution done by most (but not all) tools is contextual. E.g., most tools accept |
Collaborator
Author
|
I.e., the right thing to do is likely to switch to a recursive descent parser, and then do lookups in different name spaces depending on syntax. |
Collaborator
|
Does the Verilog standard not specify what the lookup rules are? Or perhaps it does and tools just ignore what the standard says? |
Collaborator
Author
|
The clarity of the standard leaves room for improvement. See comments on test in #1818. ChatGPT says it's not valid. Claude says it's valid. |
503821c to
e222ac7
Compare
This adds the $unit scope to the parser scope stack. The parser to explicitly put modules and packages into the top (definitions) scope, not the current scope, which is now the $unit scope.
e222ac7 to
36e5d4f
Compare
$unit scope to parser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds the
$unitscope to the parser scope stack.The parser to explicitly put modules and packages into the top (definitions) scope, not the current scope, which is now the
$unitscope.