forked from verilator/verilator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Insert the check AssertOn to allow disabling of asserts. Asserts can be disabled by not using the `--assert` flag and by setting `AssertOn(false)`. Add tests for this behavior. Fixes verilator#2162. Signed-off-by: Tobias Wölfel <tobias.woelfel@mailbox.org>
- Loading branch information
Showing
13 changed files
with
206 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/perl | ||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } | ||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition | ||
# | ||
# Copyright 2003-2009 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. | ||
|
||
scenarios(simulator => 1); | ||
|
||
compile(); | ||
|
||
execute(); | ||
|
||
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,18 @@ | ||
// DESCRIPTION: Verilator: Verilog Test module | ||
// | ||
// This file ONLY is placed into the Public Domain, for any use, | ||
// without warranty, 2007 by Wilson Snyder. | ||
|
||
module t (/*AUTOARG*/ | ||
// Inputs | ||
clk | ||
); | ||
|
||
input clk; | ||
|
||
always @ (posedge clk) begin | ||
assert (0); | ||
$finish(); | ||
end | ||
|
||
endmodule |
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,22 @@ | ||
#!/usr/bin/perl | ||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } | ||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition | ||
# | ||
# Copyright 2003-2009 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. | ||
|
||
scenarios(simulator => 1); | ||
|
||
compile( | ||
verilator_flags2 => ['--assert'], | ||
nc_flags2 => ['+assert'], | ||
); | ||
|
||
execute( | ||
fails => 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,18 @@ | ||
// DESCRIPTION: Verilator: Verilog Test module | ||
// | ||
// This file ONLY is placed into the Public Domain, for any use, | ||
// without warranty, 2007 by Wilson Snyder. | ||
|
||
module t (/*AUTOARG*/ | ||
// Inputs | ||
clk | ||
); | ||
|
||
input clk; | ||
|
||
always @ (posedge clk) begin | ||
assert (0); | ||
$finish; | ||
end | ||
|
||
endmodule |
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,24 @@ | ||
// -*- mode: C++; c-file-style: "cc-mode" -*- | ||
// | ||
// DESCRIPTION: Verilator: Verilog Test module | ||
// | ||
// This file ONLY is placed into the Public Domain, for any use, | ||
// without warranty, 2006 by Wilson Snyder. | ||
|
||
#include "Vt_assert_enabled_off.h" | ||
|
||
VM_PREFIX* top = NULL; | ||
|
||
double sc_time_stamp() { return (double)0; } | ||
|
||
int main(int argc, char* argv[]) { | ||
top = new VM_PREFIX("top"); | ||
Verilated::debug(0); | ||
Verilated::assertOn(false); | ||
|
||
top->clk = 0; | ||
top->eval(); | ||
top->clk = 1; | ||
top->eval(); | ||
|
||
} |
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/perl | ||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } | ||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition | ||
# | ||
# Copyright 2003-2009 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. | ||
|
||
scenarios(vlt => 1); | ||
|
||
compile( | ||
make_top_shell => 0, | ||
make_main => 0, | ||
verilator_flags2 => ["--assert --exe $Self->{t_dir}/$Self->{name}.cpp"], | ||
); | ||
|
||
execute(); | ||
|
||
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,18 @@ | ||
// DESCRIPTION: Verilator: Verilog Test module | ||
// | ||
// This file ONLY is placed into the Public Domain, for any use, | ||
// without warranty, 2007 by Wilson Snyder. | ||
|
||
module t (/*AUTOARG*/ | ||
// Inputs | ||
clk | ||
); | ||
|
||
input clk; | ||
|
||
always @ (posedge clk) begin | ||
assert (0); | ||
$finish; | ||
end | ||
|
||
endmodule |
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,24 @@ | ||
// -*- mode: C++; c-file-style: "cc-mode" -*- | ||
// | ||
// DESCRIPTION: Verilator: Verilog Test module | ||
// | ||
// This file ONLY is placed into the Public Domain, for any use, | ||
// without warranty, 2006 by Wilson Snyder. | ||
|
||
#include "Vt_assert_enabled_on_bad.h" | ||
|
||
VM_PREFIX* top = NULL; | ||
|
||
double sc_time_stamp() { return (double)0; } | ||
|
||
int main(int argc, char* argv[]) { | ||
top = new VM_PREFIX("top"); | ||
Verilated::debug(0); | ||
Verilated::assertOn(true); | ||
|
||
top->clk = 0; | ||
top->eval(); | ||
top->clk = 1; | ||
top->eval(); | ||
|
||
} |
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/perl | ||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } | ||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition | ||
# | ||
# Copyright 2003-2009 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. | ||
|
||
scenarios(vlt => 1); | ||
|
||
compile( | ||
make_top_shell => 0, | ||
make_main => 0, | ||
verilator_flags2 => ["--assert --exe $Self->{t_dir}/$Self->{name}.cpp"], | ||
); | ||
|
||
execute( | ||
fails => 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,18 @@ | ||
// DESCRIPTION: Verilator: Verilog Test module | ||
// | ||
// This file ONLY is placed into the Public Domain, for any use, | ||
// without warranty, 2007 by Wilson Snyder. | ||
|
||
module t (/*AUTOARG*/ | ||
// Inputs | ||
clk | ||
); | ||
|
||
input clk; | ||
|
||
always @ (posedge clk) begin | ||
assert (0); | ||
$finish; | ||
end | ||
|
||
endmodule |