You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
After fixing a few violations from [proper-parameter-declaration] wrt checking parameters in packages, my synthesis tool (Quartus PRO) throws a warning. It seems Quartus expects "localparam" instead of "parameter". Usually I think Quartus is wrong, but after reviewing the LRM I think Quartus is right.
Section 6.20.4 in the LRM (2017 and older) states "parameters" in packages are treated as a synonym for a localparam, so tools should treat parameters as localparam's in a package. More intuitively, as parameters are overidable, a parameter in a package dosn't make sense in that packages are constant and not parameterisable.
I propose the rule default be changed to raise a violation when a parameter is used in a package.
Test case (preferably reduced)
// Ran the style linter on this code.packagetest_pkg;
parameter stringPARAM="BAD"; // No lint violationlocalparam stringLOCAL_PARAM="GOOD"; // lint violation reported hereendpackage
Actual vs. expected behavior
output from verible-verilog-lint
./test_pkg.sv:3:21-31: Non-type localparam names must be styled with CamelCase [Style: constants] [parameter-name-style]
What should have happened?
Expect "parameter" in package to be reported as lint failure.
Citations to published style guides:
System Verilog LRM IEEE Std 1800™-2017, Section 6.20.4
6.20.4 Local parameters (localparam)
Local parameters are identical to parameters except that they cannot directly be modified by defparam
statements (see 23.10.1) or instance parameter value assignments (see 23.10.2). Local parameters can be
assigned constant expressions (see 11.2.1) containing parameters, which in turn can be modified with
defparam statements or instance parameter value assignments.
Unlike nonlocal parameters, local parameters can be declared in a generate block, package, class body, or compilation-unit scope. In these contexts, the parameter keyword shall be a synonym for the localparam keyword.
Local parameters may be declared in a module’s parameter_port_list. Any parameter declaration appearing
in such a list between a localparam keyword and the next parameter keyword (or the end of the list, if
there is no next parameter keyword) shall be a local parameter. Any other parameter declaration in such a
list shall be a nonlocal parameter that may be overridden as described in 23.10.
The text was updated successfully, but these errors were encountered:
Thanks for the link, I guess that means there is a case for configuration.
I still think the default for parameters in packages should be changed to localparam based on the LRM. Specifically as compilers will treat parameters in packages as localparam. Better to be explicit.
Describe the bug
After fixing a few violations from [proper-parameter-declaration] wrt checking parameters in packages, my synthesis tool (Quartus PRO) throws a warning. It seems Quartus expects "localparam" instead of "parameter". Usually I think Quartus is wrong, but after reviewing the LRM I think Quartus is right.
Section 6.20.4 in the LRM (2017 and older) states "parameters" in packages are treated as a synonym for a localparam, so tools should treat parameters as localparam's in a package. More intuitively, as parameters are overidable, a parameter in a package dosn't make sense in that packages are constant and not parameterisable.
I propose the rule default be changed to raise a violation when a parameter is used in a package.
Test case (preferably reduced)
Actual vs. expected behavior
output from verible-verilog-lint
What should have happened?
Expect "parameter" in package to be reported as lint failure.
Citations to published style guides:
System Verilog LRM IEEE Std 1800™-2017, Section 6.20.4
The text was updated successfully, but these errors were encountered: