-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This implements scoped reference names for $var sections in VCD output, as defined in 1800-2017. The --random-trace flow now accepts "-" as filename for VCD output, to enable checking the VCD output in tests.
- Loading branch information
Showing
4 changed files
with
104 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
CORE | ||
vcd1.v | ||
--random-trace --trace-steps 1 --vcd - | ||
^\$date$ | ||
^\$timescale$ | ||
^ 1ns$ | ||
^\$scope module Verilog::main \$end$ | ||
^ \$var wire 32 main\.some_input some_input \[31:0\] \$end$ | ||
^ \$var wire 32 main\.x x \[31:0\] \$end$ | ||
^ \$scope module sub \$end$ | ||
^ \$var wire 32 main\.sub\.x x \[31:0\] \$end$ | ||
^ \$upscope \$end$ | ||
^\$upscope \$end$ | ||
^\$enddefinitions \$end$ | ||
^#0$ | ||
^b\d+ main\.some_input$ | ||
^b\d+ main\.x$ | ||
^b00000000000000000000000001111011 main\.sub\.x$ | ||
^#1$ | ||
^b\d+ main\.some_input$ | ||
^b\d+ main\.x$ | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^warning: ignoring |
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,13 @@ | ||
module main(input [31:0] some_input); | ||
|
||
wire [31:0] x = 456 + some_input; | ||
|
||
sub sub(); | ||
|
||
endmodule | ||
|
||
module sub; | ||
|
||
wire [31:0] x = 123; | ||
|
||
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 |
---|---|---|
|
@@ -27,6 +27,7 @@ Author: Daniel Kroening, [email protected] | |
#include "waveform.h" | ||
|
||
#include <algorithm> | ||
#include <iostream> | ||
#include <random> | ||
|
||
/*******************************************************************\ | ||
|
@@ -159,6 +160,9 @@ int random_traces(const cmdlinet &cmdline, message_handlert &message_handler) | |
return 10; // default | ||
}(); | ||
|
||
if(cmdline.isset("vcd") && cmdline.get_value("vcd") == "-") | ||
throw ebmc_errort() << "no stdout output for multiple VCDs"; | ||
|
||
const auto outfile_prefix = [&cmdline]() -> std::optional<std::string> { | ||
if(cmdline.isset("vcd")) | ||
return cmdline.get_value("vcd") + "."; | ||
|
@@ -285,6 +289,27 @@ int random_trace(const cmdlinet &cmdline, message_handlert &message_handler) | |
messaget message(message_handler); | ||
show_trans_trace_numbered(trace, message, ns, consolet::out()); | ||
} | ||
else if(cmdline.isset("vcd")) | ||
{ | ||
auto filename = cmdline.get_value("vcd"); | ||
messaget message(message_handler); | ||
|
||
if(filename == "-") | ||
{ | ||
show_trans_trace_vcd(trace, message, ns, std::cout); | ||
} | ||
else | ||
{ | ||
std::ofstream out(widen_if_needed(filename)); | ||
|
||
if(!out) | ||
throw ebmc_errort() << "failed to write trace to " << filename; | ||
|
||
consolet::out() << "*** Writing " << filename << '\n'; | ||
|
||
show_trans_trace_vcd(trace, message, ns, out); | ||
} | ||
} | ||
else // default | ||
{ | ||
messaget message(message_handler); | ||
|
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