-
Notifications
You must be signed in to change notification settings - Fork 206
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
[proper-parameter-declaration] parameter vs localparam in packages #2190
Conversation
…h the LRM, where a violation is riased if the parameter keyword is used within a package. Configuration has been added to the rule to allow users to revert back to the original behaviour.
…ange (packages should use localparam)
…rible into package_localparam
The windows CI build seems to have broken with the latest runner release (windows2022 runner was updated 3rd June 2024). The build seems to be failing due to a number of missing standard libraries. Example below:
I've tried the following:
@corco, maybe you have some thoughts? |
Created #2193 to investigate. |
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.
Looks good, but I'd be careful changing the default behavior in one go.
I've updated the CI to use 2019, so hopefully it will pass now (and if not in this PR, we can ignore a Windows test failure)
…d reject pacakge localparams) limiting the changes in this PR to adding rule configuration.
da0a137
to
d33c0a9
Compare
Thanks! Can you now add a follow-up Pull Request so that we can change the default to warn about using |
} else if (ContextIsInsidePackage(context)) { | ||
if (!package_allow_parameter_) { | ||
violations_.insert(LintViolation(symbol, kParameterMessage, context)); | ||
} |
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.
We have a opportunity here to provide an autofix to change parameter
to localparam
.
That way, in the language server it is just one click away to get fixed.
Might be a good follow-up change.
I like it. I'll take a look.
…On Wed, 12 June 2024, 3:34 am Henner Zeller, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In verilog/analysis/checkers/proper_parameter_declaration_rule.cc
<#2190 (comment)>
:
> @@ -79,11 +122,24 @@ void ProperParameterDeclarationRule::HandleSymbol(
} else if (ContextIsInsideModule(context) &&
!ContextIsInsideFormalParameterList(context)) {
violations_.insert(LintViolation(symbol, kParameterMessage, context));
+ } else if (ContextIsInsidePackage(context)) {
+ if (!package_allow_parameter_) {
+ violations_.insert(LintViolation(symbol, kParameterMessage, context));
+ }
We have a opportunity here to provide an autofix to change parameter to
localparam.
That way, in the language server it is just one click away to get fixed.
Might be a good follow-up change.
—
Reply to this email directly, view it on GitHub
<#2190 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABVJSI3ZSKEU6TWSVGMGOPTZG4YJFAVCNFSM6AAAAABI4S2OM2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDCMJRGA3TGMZQGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Resolves #2160
This PR allows the user to configure the proper-parameter-declaration rule to allow either or both parameter and localparam in packages.
The default behaviour has changed to be more inline with the LRM, where the LRM encourages users to use localparam in packages as they cannot be overridden, so the rule defaults to only allow localparam's within packages.