Fix ZERODLY to not warn on 'wait(0)'.
This commit is contained in:
parent
2fbd41e13b
commit
10c1653e72
1
Changes
1
Changes
|
|
@ -35,6 +35,7 @@ Verilator 5.015 devel
|
||||||
* Fix reference to extended class in parameterized class (#4466).
|
* Fix reference to extended class in parameterized class (#4466).
|
||||||
* Fix display %x formatting of real.
|
* Fix display %x formatting of real.
|
||||||
* Fix mis-warning on #() in classes' own functions.
|
* Fix mis-warning on #() in classes' own functions.
|
||||||
|
* Fix ZERODLY to not warn on 'wait(0)'.
|
||||||
|
|
||||||
|
|
||||||
Verilator 5.014 2023-08-06
|
Verilator 5.014 2023-08-06
|
||||||
|
|
|
||||||
|
|
@ -1990,11 +1990,15 @@ List Of Warnings
|
||||||
|
|
||||||
.. code-block:: sv
|
.. code-block:: sv
|
||||||
|
|
||||||
wait(0); // Blocks forever
|
wait(1); // Blocks forever
|
||||||
|
|
||||||
Warns that a `wait` statement awaits a constant condition, which means it
|
Warns that a `wait` statement awaits a constant condition, which means it
|
||||||
either blocks forever or never blocks.
|
either blocks forever or never blocks.
|
||||||
|
|
||||||
|
As a special case `wait(0)` with the literal constant `0` (as opposed to
|
||||||
|
something that elaborates to zero), does not warn, as it is presumed the
|
||||||
|
code is making the intent clear.
|
||||||
|
|
||||||
|
|
||||||
.. option:: WIDTH
|
.. option:: WIDTH
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -591,6 +591,17 @@ private:
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void visit(AstWait* nodep) override {
|
||||||
|
cleanFileline(nodep);
|
||||||
|
iterateChildren(nodep);
|
||||||
|
if (nodep->condp()->isZero()) {
|
||||||
|
// Special case "wait(0)" we won't throw WAITCONST as user wrote
|
||||||
|
// it that way with presumed intent - UVM does this.
|
||||||
|
FileLine* const newfl = nodep->fileline();
|
||||||
|
newfl->warnOff(V3ErrorCode::WAITCONST, true);
|
||||||
|
nodep->fileline(newfl);
|
||||||
|
}
|
||||||
|
}
|
||||||
void visit(AstWhile* nodep) override {
|
void visit(AstWhile* nodep) override {
|
||||||
cleanFileline(nodep);
|
cleanFileline(nodep);
|
||||||
VL_RESTORER(m_insideLoop);
|
VL_RESTORER(m_insideLoop);
|
||||||
|
|
|
||||||
|
|
@ -997,7 +997,9 @@ private:
|
||||||
AstNodeExpr* const condp = V3Const::constifyEdit(nodep->condp()->unlinkFrBack());
|
AstNodeExpr* const condp = V3Const::constifyEdit(nodep->condp()->unlinkFrBack());
|
||||||
auto* const constp = VN_CAST(condp, Const);
|
auto* const constp = VN_CAST(condp, Const);
|
||||||
if (constp) {
|
if (constp) {
|
||||||
condp->v3warn(WAITCONST, "Wait statement condition is constant");
|
if (!nodep->fileline()->warnIsOff(V3ErrorCode::WAITCONST)) {
|
||||||
|
condp->v3warn(WAITCONST, "Wait statement condition is constant");
|
||||||
|
}
|
||||||
if (constp->isZero()) {
|
if (constp->isZero()) {
|
||||||
// We have to await forever instead of simply returning in case we're deep in a
|
// We have to await forever instead of simply returning in case we're deep in a
|
||||||
// callstack
|
// callstack
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,6 @@
|
||||||
%Warning-WAITCONST: t/t_timing_wait1.v:54:14: Wait statement condition is constant
|
%Warning-WAITCONST: t/t_timing_wait1.v:54:14: Wait statement condition is constant
|
||||||
54 | wait(0 < 1) $write("*-* All Finished *-*\n");
|
54 | wait(0 < 1) $write("*-* All Finished *-*\n");
|
||||||
| ^
|
| ^
|
||||||
%Warning-WAITCONST: t/t_timing_wait1.v:58:17: Wait statement condition is constant
|
|
||||||
58 | initial wait(0) $stop;
|
|
||||||
| ^
|
|
||||||
%Warning-WAITCONST: t/t_timing_wait1.v:59:19: Wait statement condition is constant
|
%Warning-WAITCONST: t/t_timing_wait1.v:59:19: Wait statement condition is constant
|
||||||
59 | initial wait(1 == 0) $stop;
|
59 | initial wait(1 == 0) $stop;
|
||||||
| ^~
|
| ^~
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ module t;
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
||||||
initial wait(0) $stop;
|
initial wait(0) $stop; // Note this doesn't give WAITCONST
|
||||||
initial wait(1 == 0) $stop;
|
initial wait(1 == 0) $stop;
|
||||||
|
|
||||||
initial #12 $stop; // timeout
|
initial #12 $stop; // timeout
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue