forked from verilator/verilator
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Schedule #0 coroutines after any other act triggers
Signed-off-by: Krzysztof Boronski <[email protected]>
- Loading branch information
1 parent
cc982ec
commit dcbde87
Showing
9 changed files
with
107 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env perl | ||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } | ||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition | ||
# | ||
# Copyright 2022 by Antmicro Ltd. This program is free software; you | ||
# can redistribute it and/or modify it under the terms of either the GNU | ||
# Lesser General Public License Version 3 or the Perl Artistic License | ||
# Version 2.0. | ||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 | ||
|
||
scenarios(simulator => 1); | ||
|
||
compile( | ||
verilator_flags2 => ["--exe --main --timing"], | ||
make_main => 0, | ||
); | ||
|
||
execute( | ||
check_finished => 1, | ||
); | ||
|
||
ok(1); | ||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// DESCRIPTION: Verilator: Verilog Test module | ||
// | ||
// This file ONLY is placed under the Creative Commons Public Domain, for | ||
// any use, without warranty, 2023 by Antmicro Ltd. | ||
// SPDX-License-Identifier: CC0-1.0 | ||
|
||
class Foo; | ||
static task fork_w_zerodly(longint unsigned current_time); | ||
bit my_bit; | ||
bit zero_dly_first = 0; | ||
// Th code below relies on Verilator's deterministic scheduler and is not | ||
// compatible across different simulators. | ||
// | ||
// The `zero_dly` block is going to be executed first and then suspended at the #0 delay. | ||
// Then the `finish_before` block is going to be executed. Once that happens, the | ||
// execution of `zero_dly` block should be resumed, all within a single time-slot. | ||
// | ||
// IF THIS TEST FAILS AFTER CHANGES TO VERILATOR'S SCHEDULER, IT DOESN'T NECESSARILY | ||
// MEAN THE CHANGES ARE WRONG. | ||
fork | ||
begin : zero_dly | ||
zero_dly_first = 1; | ||
#0; | ||
if (current_time != $time) $stop; | ||
if (my_bit == 0) $stop; | ||
end : zero_dly | ||
begin : finish_before | ||
if (!zero_dly_first) $stop; | ||
my_bit = 1; | ||
end : finish_before | ||
join_none | ||
#1 $display("After fork."); // Check if there's no skipped coroutine | ||
endtask | ||
endclass | ||
|
||
module test(); | ||
initial begin | ||
Foo::fork_w_zerodly($time); | ||
$write("*-* All Finished *-*\n"); | ||
$finish; | ||
end | ||
endmodule |