Fix false IMPLICITSTATIC on localparam (#6835)
This commit is contained in:
parent
41937ecbe4
commit
04a7b31b84
|
|
@ -323,6 +323,7 @@ class LinkParseVisitor final : public VNVisitor {
|
||||||
"loop converted to automatic");
|
"loop converted to automatic");
|
||||||
} else if (nodep->valuep() && nodep->lifetime().isNone() && m_lifetime.isStatic()
|
} else if (nodep->valuep() && nodep->lifetime().isNone() && m_lifetime.isStatic()
|
||||||
&& !nodep->isIO()
|
&& !nodep->isIO()
|
||||||
|
&& !nodep->isParam()
|
||||||
// In task, or a procedure but not Initial/Final as executed only once
|
// In task, or a procedure but not Initial/Final as executed only once
|
||||||
&& ((m_ftaskp && !m_ftaskp->lifetime().isStaticExplicit())
|
&& ((m_ftaskp && !m_ftaskp->lifetime().isStaticExplicit())
|
||||||
|| (m_procedurep && !VN_IS(m_procedurep, Initial)
|
|| (m_procedurep && !VN_IS(m_procedurep, Initial)
|
||||||
|
|
|
||||||
|
|
@ -5,27 +5,27 @@
|
||||||
| ^~~~~~~~~~~~~
|
| ^~~~~~~~~~~~~
|
||||||
... For warning description see https://verilator.org/warn/IMPLICITSTATIC?v=latest
|
... For warning description see https://verilator.org/warn/IMPLICITSTATIC?v=latest
|
||||||
... Use "/* verilator lint_off IMPLICITSTATIC */" and lint_on around source to disable this message.
|
... Use "/* verilator lint_off IMPLICITSTATIC */" and lint_on around source to disable this message.
|
||||||
%Warning-IMPLICITSTATIC: t/t_lint_implicitstatic_bad.v:19:16: Function/task's lifetime implicitly set to static
|
%Warning-IMPLICITSTATIC: t/t_lint_implicitstatic_bad.v:20:16: Function/task's lifetime implicitly set to static
|
||||||
: ... Suggest use 'function automatic' or 'function static'
|
: ... Suggest use 'function automatic' or 'function static'
|
||||||
19 | function int f_implicit_static();
|
20 | function int f_implicit_static();
|
||||||
| ^~~~~~~~~~~~~~~~~
|
| ^~~~~~~~~~~~~~~~~
|
||||||
t/t_lint_implicitstatic_bad.v:20:9: ... Location of implicit static variable
|
t/t_lint_implicitstatic_bad.v:21:9: ... Location of implicit static variable
|
||||||
: ... The initializer value will only be set once
|
: ... The initializer value will only be set once
|
||||||
20 | int cnt = 0;
|
21 | int cnt = 0;
|
||||||
| ^~~
|
| ^~~
|
||||||
%Warning-IMPLICITSTATIC: t/t_lint_implicitstatic_bad.v:24:8: Function/task's lifetime implicitly set to static
|
%Warning-IMPLICITSTATIC: t/t_lint_implicitstatic_bad.v:25:8: Function/task's lifetime implicitly set to static
|
||||||
: ... Suggest use 'task automatic' or 'task static'
|
: ... Suggest use 'task automatic' or 'task static'
|
||||||
24 | task f_implicit_static();
|
25 | task f_implicit_static();
|
||||||
| ^~~~~~~~~~~~~~~~~
|
| ^~~~~~~~~~~~~~~~~
|
||||||
t/t_lint_implicitstatic_bad.v:25:9: ... Location of implicit static variable
|
t/t_lint_implicitstatic_bad.v:26:9: ... Location of implicit static variable
|
||||||
: ... The initializer value will only be set once
|
: ... The initializer value will only be set once
|
||||||
25 | int cnt = 0;
|
26 | int cnt = 0;
|
||||||
| ^~~
|
| ^~~
|
||||||
%Error: t/t_lint_implicitstatic_bad.v:24:8: Unsupported in C: Task has the same name as function: 'f_implicit_static'
|
%Error: t/t_lint_implicitstatic_bad.v:25:8: Unsupported in C: Task has the same name as function: 'f_implicit_static'
|
||||||
24 | task f_implicit_static();
|
25 | task f_implicit_static();
|
||||||
| ^~~~~~~~~~~~~~~~~
|
| ^~~~~~~~~~~~~~~~~
|
||||||
t/t_lint_implicitstatic_bad.v:19:16: ... Location of original declaration
|
t/t_lint_implicitstatic_bad.v:20:16: ... Location of original declaration
|
||||||
19 | function int f_implicit_static();
|
20 | function int f_implicit_static();
|
||||||
| ^~~~~~~~~~~~~~~~~
|
| ^~~~~~~~~~~~~~~~~
|
||||||
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
|
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
|
||||||
%Error: Exiting due to
|
%Error: Exiting due to
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ module t (
|
||||||
|
|
||||||
always @(posedge clk) begin
|
always @(posedge clk) begin
|
||||||
int implicit_warn = 1; // <--- Warning: IMPLICITSTATIC
|
int implicit_warn = 1; // <--- Warning: IMPLICITSTATIC
|
||||||
|
localparam int NO_WARN = 2; // No warning here
|
||||||
end
|
end
|
||||||
|
|
||||||
function int f_implicit_static();
|
function int f_implicit_static();
|
||||||
|
|
@ -26,4 +27,13 @@ module t (
|
||||||
++cnt;
|
++cnt;
|
||||||
endtask
|
endtask
|
||||||
|
|
||||||
|
function int f_no_implicit_static();
|
||||||
|
localparam int ONE = 1; // No warning here
|
||||||
|
return ONE;
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
task t_no_implicit_static();
|
||||||
|
localparam TWO = 2; // No warning here
|
||||||
|
endtask
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue