Tests: Update t_disable_inside (#6591)

This commit is contained in:
Wilson Snyder 2026-03-29 20:34:19 -04:00
parent 600eb7ec86
commit 86eb6f060f
1 changed files with 26 additions and 25 deletions

View File

@ -4,6 +4,11 @@
// SPDX-FileCopyrightText: 2025 Antmicro // SPDX-FileCopyrightText: 2025 Antmicro
// SPDX-License-Identifier: CC0-1.0 // SPDX-License-Identifier: CC0-1.0
// verilog_format: off
`define stop $stop
`define checkt(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got=%0t exp=%0t (%t !== %t)\n", `__FILE__,`__LINE__, (gotv), (expv), `"gotv`", `"expv`"); `stop; end while(0);
// verilog_format: on
module t; module t;
initial begin initial begin
static int x = 0; static int x = 0;
@ -14,7 +19,7 @@ module t;
$stop; $stop;
end end
begin begin
if ($time != 0) $stop; `checkt($time, 0);
x = 1; x = 1;
#2; #2;
$stop; $stop;
@ -36,10 +41,10 @@ module t;
$stop; $stop;
end end
begin begin
if ($time != 0) $stop; `checkt($time, 0);
y = 1; y = 1;
#2; #2;
if ($time != 2) $stop; `checkt($time, 2);
y = 2; y = 2;
end end
join_none join_none
@ -55,32 +60,28 @@ module t;
end end
end end
// TODO: This doesn't work due to the second fork branch not being added to initial begin
// the killQueue when the 'disable' is executed with no delay after fork : fork_blk2
// the fork starts. See the case below which is the same, but the begin
// fork branches are in the opposite order so it happens to work. `checkt($time, 0);
//initial begin disable fork_blk2;
// fork : fork_blk2 $stop;
// begin end
// if ($time != 0) $stop; begin
// disable fork_blk2; `checkt($time, 0);
// $stop; #1 $stop;
// end end
// begin join_none
// if ($time != 0) $stop; end
// #1 $stop;
// end
// join_none
//end
initial begin initial begin
fork : fork_blk3 fork : fork_blk3
begin begin
if ($time != 0) $stop; `checkt($time, 0);
#1 $stop; #1 $stop;
end end
begin begin
if ($time != 0) $stop; `checkt($time, 0);
disable fork_blk3; disable fork_blk3;
$stop; $stop;
end end
@ -90,7 +91,7 @@ module t;
initial begin initial begin
fork : fork_blk4 fork : fork_blk4
begin begin
if ($time != 0) $stop; `checkt($time, 0);
if ($c("false")) begin if ($c("false")) begin
disable fork_blk4; disable fork_blk4;
$stop; $stop;
@ -98,9 +99,9 @@ module t;
#1; #1;
end end
begin begin
if ($time != 0) $stop; `checkt($time, 0);
#1; #1;
if ($time != 1) $stop; `checkt($time, 1);
end end
join_none join_none
end end