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.
Fix signals read via virtual iface optimized out
Signed-off-by: Krzysztof Bieganski <[email protected]>
- Loading branch information
1 parent
c1c8b30
commit 0725e60
Showing
3 changed files
with
68 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env perl | ||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } | ||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition | ||
# | ||
# Copyright 2003 by Wilson Snyder. 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( | ||
); | ||
|
||
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, 2006 by Wilson Snyder. | ||
// SPDX-License-Identifier: CC0-1.0 | ||
|
||
interface Bus; | ||
logic [7:0] data; | ||
endinterface | ||
|
||
class Cls; | ||
virtual Bus vbus; | ||
|
||
function void check(logic [7:0] data); | ||
if (vbus.data != data) $stop; | ||
endfunction | ||
endclass | ||
|
||
module t (clk); | ||
input clk; | ||
int cyc = 0; | ||
|
||
Bus bus(); | ||
virtual Bus vbus; | ||
Cls obj; | ||
|
||
assign bus.data = 'hFA; | ||
|
||
always @(posedge clk) begin | ||
cyc <= cyc + 1; | ||
if (cyc == 1) begin | ||
obj = new; | ||
vbus = bus; | ||
obj.vbus = bus; | ||
end | ||
else if (cyc == 2) begin | ||
obj.check('hFA); | ||
$write("*-* All Finished *-*\n"); | ||
$finish; | ||
end | ||
end | ||
endmodule |