This commit is contained in:
parent
8ea814e4b4
commit
ec01008fe3
|
|
@ -134,6 +134,7 @@ Oleh Maksymenko
|
||||||
Patrick Stewart
|
Patrick Stewart
|
||||||
Paul Wright
|
Paul Wright
|
||||||
Pawel Sagan
|
Pawel Sagan
|
||||||
|
Pengcheng Xu
|
||||||
Peter Debacker
|
Peter Debacker
|
||||||
Peter Horvath
|
Peter Horvath
|
||||||
Peter Monsson
|
Peter Monsson
|
||||||
|
|
|
||||||
|
|
@ -2131,3 +2131,46 @@ List Of Warnings
|
||||||
Inactive region. Such processes do get resumed in the same time slot
|
Inactive region. Such processes do get resumed in the same time slot
|
||||||
somewhere in the Active region. Issued only if Verilator is run with the
|
somewhere in the Active region. Issued only if Verilator is run with the
|
||||||
:vlopt:`--timing` option.
|
:vlopt:`--timing` option.
|
||||||
|
|
||||||
|
.. option:: ZEROREPL
|
||||||
|
|
||||||
|
Warns that zero is used as the replication value in the replication
|
||||||
|
operator. This is specified as an error by IEEE 1800-2017 11.4.12.1.
|
||||||
|
|
||||||
|
Faulty example:
|
||||||
|
|
||||||
|
.. code-block:: sv
|
||||||
|
:linenos:
|
||||||
|
:emphasize-lines: 5
|
||||||
|
|
||||||
|
module dut
|
||||||
|
#(parameter int MY_PARAM = 0);
|
||||||
|
reg [7:0] data;
|
||||||
|
always @* begin
|
||||||
|
data = {MY_PARAM{1'b1}}; //<--- WARNING
|
||||||
|
end
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
Results in the following error:
|
||||||
|
|
||||||
|
.. code-block::
|
||||||
|
|
||||||
|
%Error-ZEROREPL: test.v:5:22: Replication value of 0 is only legal under a concatenation (IEEE 1800-2017 11.4.12.1)
|
||||||
|
|
||||||
|
Note that in some cases, this warning may be false, when a condition
|
||||||
|
upstream or downstream of the access means the zero replication will
|
||||||
|
never execute or be used.
|
||||||
|
|
||||||
|
Repaired example:
|
||||||
|
|
||||||
|
.. code-block:: sv
|
||||||
|
:linenos:
|
||||||
|
:emphasize-lines: 2
|
||||||
|
|
||||||
|
module dut
|
||||||
|
#(parameter int MY_PARAM = 1); //<--- REPAIRED
|
||||||
|
reg [7:0] data;
|
||||||
|
always @* begin
|
||||||
|
data = {MY_PARAM{1'b1}};
|
||||||
|
end
|
||||||
|
endmodule
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,7 @@ public:
|
||||||
WIDTHTRUNC, // Width mismatch- lhs < rhs
|
WIDTHTRUNC, // Width mismatch- lhs < rhs
|
||||||
WIDTHXZEXPAND, // Width mismatch- lhs > rhs xz filled
|
WIDTHXZEXPAND, // Width mismatch- lhs > rhs xz filled
|
||||||
ZERODLY, // #0 delay
|
ZERODLY, // #0 delay
|
||||||
|
ZEROREPL, // Replication width of zero
|
||||||
_ENUM_MAX
|
_ENUM_MAX
|
||||||
// ***Add new elements below also***
|
// ***Add new elements below also***
|
||||||
};
|
};
|
||||||
|
|
@ -210,7 +211,7 @@ public:
|
||||||
"UNDRIVEN", "UNOPT", "UNOPTFLAT", "UNOPTTHREADS",
|
"UNDRIVEN", "UNOPT", "UNOPTFLAT", "UNOPTTHREADS",
|
||||||
"UNPACKED", "UNSIGNED", "UNUSEDGENVAR", "UNUSEDPARAM", "UNUSEDSIGNAL",
|
"UNPACKED", "UNSIGNED", "UNUSEDGENVAR", "UNUSEDPARAM", "UNUSEDSIGNAL",
|
||||||
"USERERROR", "USERFATAL", "USERINFO", "USERWARN",
|
"USERERROR", "USERFATAL", "USERINFO", "USERWARN",
|
||||||
"VARHIDDEN", "WAITCONST", "WIDTH", "WIDTHCONCAT", "WIDTHEXPAND", "WIDTHTRUNC", "WIDTHXZEXPAND", "ZERODLY",
|
"VARHIDDEN", "WAITCONST", "WIDTH", "WIDTHCONCAT", "WIDTHEXPAND", "WIDTHTRUNC", "WIDTHXZEXPAND", "ZERODLY", "ZEROREPL",
|
||||||
" MAX"
|
" MAX"
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
@ -228,7 +229,7 @@ public:
|
||||||
return (m_e == ASSIGNIN || m_e == BADSTDPRAGMA || m_e == BLKANDNBLK || m_e == BLKLOOPINIT
|
return (m_e == ASSIGNIN || m_e == BADSTDPRAGMA || m_e == BLKANDNBLK || m_e == BLKLOOPINIT
|
||||||
|| m_e == CONTASSREG || m_e == ENCAPSULATED || m_e == ENDLABEL || m_e == ENUMVALUE
|
|| m_e == CONTASSREG || m_e == ENCAPSULATED || m_e == ENDLABEL || m_e == ENUMVALUE
|
||||||
|| m_e == IMPURE || m_e == PINNOTFOUND || m_e == PKGNODECL
|
|| m_e == IMPURE || m_e == PINNOTFOUND || m_e == PKGNODECL
|
||||||
|| m_e == PROCASSWIRE // Says IEEE
|
|| m_e == PROCASSWIRE || m_e == ZEROREPL // Says IEEE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Warnings to mention manual
|
// Warnings to mention manual
|
||||||
|
|
|
||||||
|
|
@ -781,7 +781,7 @@ class WidthVisitor final : public VNVisitor {
|
||||||
if (!constp) nodep->v3error("Replication value isn't a constant.");
|
if (!constp) nodep->v3error("Replication value isn't a constant.");
|
||||||
if (times == 0
|
if (times == 0
|
||||||
&& !VN_IS(nodep->backp(), Concat)) { // Concat Visitor will clean it up.
|
&& !VN_IS(nodep->backp(), Concat)) { // Concat Visitor will clean it up.
|
||||||
nodep->v3error("Replication value of 0 is only legal under a concatenation"
|
nodep->v3warn(ZEROREPL, "Replication value of 0 is only legal under a concatenation"
|
||||||
" (IEEE 1800-2017 11.4.12.1)");
|
" (IEEE 1800-2017 11.4.12.1)");
|
||||||
times = 1; // Set to 1, so we can continue looking for errors
|
times = 1; // Set to 1, so we can continue looking for errors
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
%Error: t/t_math_repl_bad.v:12:14: Replication value of 0 is only legal under a concatenation (IEEE 1800-2017 11.4.12.1)
|
%Error-ZEROREPL: t/t_math_repl_bad.v:12:14: Replication value of 0 is only legal under a concatenation (IEEE 1800-2017 11.4.12.1)
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
12 | o = {0 {1'b1}};
|
12 | o = {0 {1'b1}};
|
||||||
| ^
|
| ^
|
||||||
|
... For error description see https://verilator.org/warn/ZEROREPL?v=latest
|
||||||
%Warning-WIDTHEXPAND: t/t_math_repl_bad.v:12:9: Operator ASSIGN expects 32 bits on the Assign RHS, but Assign RHS's REPLICATE generates 1 bits.
|
%Warning-WIDTHEXPAND: t/t_math_repl_bad.v:12:9: Operator ASSIGN expects 32 bits on the Assign RHS, but Assign RHS's REPLICATE generates 1 bits.
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
12 | o = {0 {1'b1}};
|
12 | o = {0 {1'b1}};
|
||||||
| ^
|
| ^
|
||||||
... For warning description see https://verilator.org/warn/WIDTHEXPAND?v=latest
|
|
||||||
... Use "/* verilator lint_off WIDTHEXPAND */" and lint_on around source to disable this message.
|
... Use "/* verilator lint_off WIDTHEXPAND */" and lint_on around source to disable this message.
|
||||||
%Error: t/t_math_repl_bad.v:13:43: Replication value isn't a constant.
|
%Error: t/t_math_repl_bad.v:13:43: Replication value isn't a constant.
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue