mirror of
https://github.com/verilator/verilator.git
synced 2025-07-31 07:56:10 +00:00
Fix wait 0.
This commit is contained in:
parent
0c75d4eaca
commit
9d7c4d9af3
1
Changes
1
Changes
@ -19,6 +19,7 @@ Verilator 5.003 devel
|
||||
* Fix return type of $countbits functions to int (#3725). [Ryszard Rozak, Antmicro Ltd]
|
||||
* Fix missing UNUSED warnings with --coverage (#3736). [alejandro-castro-ortegon]
|
||||
* Fix tracing parameters overridden with -G (#3723). [Iztok Jeras]
|
||||
* Fix wait 0.
|
||||
|
||||
|
||||
Verilator 5.002 2022-10-29
|
||||
|
@ -709,11 +709,13 @@ private:
|
||||
awaitp->dtypeSetVoid();
|
||||
nodep->replaceWith(awaitp->makeStmt());
|
||||
if (stmtsp) VL_DO_DANGLING(stmtsp->deleteTree(), stmtsp);
|
||||
VL_DO_DANGLING(condp->deleteTree(), condp);
|
||||
} else if (stmtsp) {
|
||||
// Just put the statements there
|
||||
nodep->replaceWith(stmtsp);
|
||||
} else {
|
||||
nodep->unlinkFrBack();
|
||||
}
|
||||
VL_DO_DANGLING(condp->deleteTree(), condp);
|
||||
} else if (needDynamicTrigger(condp)) {
|
||||
// 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
|
||||
|
@ -1,12 +1,15 @@
|
||||
%Warning-WAITCONST: t/t_timing_wait.v:47:13: Wait statement condition is constant
|
||||
47 | wait(0 < 1) $write("*-* All Finished *-*\n");
|
||||
| ^
|
||||
%Warning-WAITCONST: t/t_timing_wait.v:48:12: Wait statement condition is constant
|
||||
48 | wait(1);
|
||||
| ^
|
||||
... 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.
|
||||
%Warning-WAITCONST: t/t_timing_wait.v:51:17: Wait statement condition is constant
|
||||
51 | initial wait(0) $stop;
|
||||
%Warning-WAITCONST: t/t_timing_wait.v:50:14: Wait statement condition is constant
|
||||
50 | wait(0 < 1) $write("*-* All Finished *-*\n");
|
||||
| ^
|
||||
%Warning-WAITCONST: t/t_timing_wait.v:54:17: Wait statement condition is constant
|
||||
54 | initial wait(0) $stop;
|
||||
| ^
|
||||
%Warning-WAITCONST: t/t_timing_wait.v:52:19: Wait statement condition is constant
|
||||
52 | initial wait(1 == 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
|
||||
|
@ -16,36 +16,39 @@ module t;
|
||||
int c = 0;
|
||||
|
||||
initial begin
|
||||
`WRITE_VERBOSE("start with a==0, b==0, c==0\n");
|
||||
#2 a = 1; `WRITE_VERBOSE("assign 1 to a\n");
|
||||
#1 a = 2; `WRITE_VERBOSE("assign 2 to a\n"); // a==2
|
||||
#1 a = 0; `WRITE_VERBOSE("assign 0 to a\n");
|
||||
#1 a = 2; `WRITE_VERBOSE("assign 2 to a\n"); // 1<a<3
|
||||
#1 b = 2; `WRITE_VERBOSE("assign 2 to b\n");
|
||||
#1 a = 1; `WRITE_VERBOSE("assign 1 to a\n"); // b>a
|
||||
#1 c = 3; `WRITE_VERBOSE("assign 3 to c\n");
|
||||
#1 c = 4; `WRITE_VERBOSE("assign 4 to c\n"); // a+b<c
|
||||
#1 c = 4; `WRITE_VERBOSE("assign 5 to b\n"); // a<b && b>c
|
||||
b = 5;
|
||||
`WRITE_VERBOSE("start with a==0, b==0, c==0\n");
|
||||
#2 a = 1; `WRITE_VERBOSE("assign 1 to a\n");
|
||||
#1 a = 2; `WRITE_VERBOSE("assign 2 to a\n"); // a==2
|
||||
#1 a = 0; `WRITE_VERBOSE("assign 0 to a\n");
|
||||
#1 a = 2; `WRITE_VERBOSE("assign 2 to a\n"); // 1<a<3
|
||||
#1 b = 2; `WRITE_VERBOSE("assign 2 to b\n");
|
||||
#1 a = 1; `WRITE_VERBOSE("assign 1 to a\n"); // b>a
|
||||
#1 c = 3; `WRITE_VERBOSE("assign 3 to c\n");
|
||||
#1 c = 4; `WRITE_VERBOSE("assign 4 to c\n"); // a+b<c
|
||||
#1 c = 4; `WRITE_VERBOSE("assign 5 to b\n"); // a<b && b>c
|
||||
b = 5;
|
||||
end
|
||||
|
||||
initial begin
|
||||
#1 `WRITE_VERBOSE("waiting for a==2\n");
|
||||
wait(a == 2) if (a != 2) $stop;
|
||||
`WRITE_VERBOSE("waiting for a<2\n");
|
||||
wait(a < 2) if (a >= 2) $stop;
|
||||
`WRITE_VERBOSE("waiting for a==0\n");
|
||||
wait(a == 0) if (a != 0) $stop;
|
||||
`WRITE_VERBOSE("waiting for 1<a<3\n");
|
||||
wait(a > 1 && a < 3) if (a <= 1 || a >= 3) $stop;
|
||||
`WRITE_VERBOSE("waiting for b>a\n");
|
||||
wait(b > a) if (b <= a) $stop;
|
||||
`WRITE_VERBOSE("waiting for a+b<c\n");
|
||||
wait(a + b < c) if (a + b >= c) $stop;
|
||||
`WRITE_VERBOSE("waiting for a<b && b>c\n");
|
||||
wait(a < b && b > c) if (a >= b || b <= c) $stop;
|
||||
wait(0 < 1) $write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
#1 `WRITE_VERBOSE("waiting for a==2\n");
|
||||
wait(a == 2) if (a != 2) $stop;
|
||||
`WRITE_VERBOSE("waiting for a<2\n");
|
||||
wait(a < 2) if (a >= 2) $stop;
|
||||
`WRITE_VERBOSE("waiting for a==0\n");
|
||||
wait(a == 0) if (a != 0) $stop;
|
||||
`WRITE_VERBOSE("waiting for 1<a<3\n");
|
||||
wait(a > 1 && a < 3) if (a <= 1 || a >= 3) $stop;
|
||||
`WRITE_VERBOSE("waiting for b>a\n");
|
||||
wait(b > a) if (b <= a) $stop;
|
||||
`WRITE_VERBOSE("waiting for a+b<c\n");
|
||||
wait(a + b < c) if (a + b >= c) $stop;
|
||||
`WRITE_VERBOSE("waiting for a<b && b>c\n");
|
||||
wait(a < b && b > c) if (a >= b || b <= c) $stop;
|
||||
|
||||
wait(1);
|
||||
|
||||
wait(0 < 1) $write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
|
||||
initial wait(0) $stop;
|
||||
|
Loading…
Reference in New Issue
Block a user