Fix wait 0.

This commit is contained in:
Wilson Snyder 2022-11-11 17:18:59 -05:00
parent 0c75d4eaca
commit 9d7c4d9af3
4 changed files with 44 additions and 35 deletions

View File

@ -19,6 +19,7 @@ Verilator 5.003 devel
* Fix return type of $countbits functions to int (#3725). [Ryszard Rozak, Antmicro Ltd] * Fix return type of $countbits functions to int (#3725). [Ryszard Rozak, Antmicro Ltd]
* Fix missing UNUSED warnings with --coverage (#3736). [alejandro-castro-ortegon] * Fix missing UNUSED warnings with --coverage (#3736). [alejandro-castro-ortegon]
* Fix tracing parameters overridden with -G (#3723). [Iztok Jeras] * Fix tracing parameters overridden with -G (#3723). [Iztok Jeras]
* Fix wait 0.
Verilator 5.002 2022-10-29 Verilator 5.002 2022-10-29

View File

@ -709,11 +709,13 @@ private:
awaitp->dtypeSetVoid(); awaitp->dtypeSetVoid();
nodep->replaceWith(awaitp->makeStmt()); nodep->replaceWith(awaitp->makeStmt());
if (stmtsp) VL_DO_DANGLING(stmtsp->deleteTree(), stmtsp); if (stmtsp) VL_DO_DANGLING(stmtsp->deleteTree(), stmtsp);
VL_DO_DANGLING(condp->deleteTree(), condp);
} else if (stmtsp) { } else if (stmtsp) {
// Just put the statements there // Just put the statements there
nodep->replaceWith(stmtsp); nodep->replaceWith(stmtsp);
} else {
nodep->unlinkFrBack();
} }
VL_DO_DANGLING(condp->deleteTree(), condp);
} else if (needDynamicTrigger(condp)) { } else if (needDynamicTrigger(condp)) {
// No point in making a sentree, just use the expression as sensitivity // No point in making a sentree, just use the expression as sensitivity
// Put the event control in an if so we only wait if the condition isn't met already // Put the event control in an if so we only wait if the condition isn't met already

View File

@ -1,12 +1,15 @@
%Warning-WAITCONST: t/t_timing_wait.v:47:13: Wait statement condition is constant %Warning-WAITCONST: t/t_timing_wait.v:48:12: Wait statement condition is constant
47 | wait(0 < 1) $write("*-* All Finished *-*\n"); 48 | wait(1);
| ^ | ^
... For warning description see https://verilator.org/warn/WAITCONST?v=latest ... For warning description see https://verilator.org/warn/WAITCONST?v=latest
... Use "/* verilator lint_off WAITCONST */" and lint_on around source to disable this message. ... Use "/* verilator lint_off WAITCONST */" and lint_on around source to disable this message.
%Warning-WAITCONST: t/t_timing_wait.v:51:17: Wait statement condition is constant %Warning-WAITCONST: t/t_timing_wait.v:50:14: Wait statement condition is constant
51 | initial wait(0) $stop; 50 | wait(0 < 1) $write("*-* All Finished *-*\n");
| ^ | ^
%Warning-WAITCONST: t/t_timing_wait.v:52:19: Wait statement condition is constant %Warning-WAITCONST: t/t_timing_wait.v:54:17: Wait statement condition is constant
52 | initial wait(1 == 0) $stop; 54 | initial wait(0) $stop;
| ^
%Warning-WAITCONST: t/t_timing_wait.v:55:19: Wait statement condition is constant
55 | initial wait(1 == 0) $stop;
| ^~ | ^~
%Error: Exiting due to %Error: Exiting due to

View File

@ -44,6 +44,9 @@ module t;
wait(a + b < c) if (a + b >= c) $stop; wait(a + b < c) if (a + b >= c) $stop;
`WRITE_VERBOSE("waiting for a<b && b>c\n"); `WRITE_VERBOSE("waiting for a<b && b>c\n");
wait(a < b && b > c) if (a >= b || b <= c) $stop; wait(a < b && b > c) if (a >= b || b <= c) $stop;
wait(1);
wait(0 < 1) $write("*-* All Finished *-*\n"); wait(0 < 1) $write("*-* All Finished *-*\n");
$finish; $finish;
end end