Add rr support

This commit is contained in:
Todd Strader 2019-07-25 21:34:09 -04:00
parent b045111a67
commit 43ce048f9e
4 changed files with 36 additions and 1 deletions

View File

@ -4,6 +4,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
* Verilator 4.017 devel
** Add --rr. [Todd Strader]
** When showing an error, show source code and offer suggestions of replacements.
*** Change MULTITOP to warning to help linting, see manual.

View File

@ -34,6 +34,7 @@ autoflush STDERR 1;
$Debug = 0;
my $opt_gdb;
my $opt_rr;
my $opt_gdbbt;
my $opt_quiet_exit;
@ -61,6 +62,7 @@ if (! GetOptions(
"gdb!" => \$opt_gdb,
"gdbbt!" => \$opt_gdbbt,
"quiet-exit!" => \$opt_quiet_exit,
"rr!" => \$opt_rr,
# Additional parameters
"<>" => sub {}, # Ignored
)) {
@ -93,6 +95,10 @@ if ($opt_gdb) {
." -ex \"run ".join(' ', @quoted_sw)."\""
." -ex 'set width 0'"
." -ex 'bt'");
} elsif ($opt_rr) {
# Record with rr
run ("rr record ".verilator_bin()
." ".join(' ', @quoted_sw));
} elsif ($opt_gdbbt && $Debug) {
# Run under GDB to get gdbbt
run ("gdb"
@ -353,6 +359,7 @@ detailed descriptions in L</"VERILATION ARGUMENTS"> for more information.
--relative-includes Resolve includes relative to current file
--no-relative-cfuncs Disallow 'this->' in generated functions
--report-unoptflat Extra diagnostics for UNOPTFLAT
--rr Run Verilator and record with rr
--savable Enable model save-restore
--sc Create SystemC output
--stats Create statistics file
@ -1192,6 +1199,10 @@ printing. For example:
will generate a PDF Vt_unoptflat_simple_2_35_unoptflat.dot.pdf from the DOT
file.
=item --rr
Run Verilator and record with rr. See: rr-project.org.
=item --savable
Enable including save and restore functions in the generated model.

View File

@ -1018,6 +1018,9 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
else if (!strcmp(sw, "-gdb")) {
// Used only in perl shell
}
else if (!strcmp(sw, "-rr")) {
// Used only in perl shell
}
else if (!strcmp(sw, "-gdbbt")) {
// Used only in perl shell
}

View File

@ -55,12 +55,14 @@ my $opt_benchmark;
my @opt_tests;
my $opt_dist;
my $opt_gdb;
my $opt_rr;
my $opt_gdbbt;
my $opt_gdbsim;
my $opt_jobs = 1;
my $opt_optimize;
my $opt_quiet;
my $opt_rerun;
my $opt_rrsim;
my %opt_scenarios;
my $opt_site;
my $opt_stop;
@ -85,6 +87,8 @@ if (! GetOptions(
"optimize:s" => \$opt_optimize,
"quiet!" => \$opt_quiet,
"rerun!" => \$opt_rerun,
"rr!" => \$opt_rr,
"rrsim!" => \$opt_rrsim,
"site!" => \$opt_site,
"stop!" => \$opt_stop,
"trace!" => \$opt_trace,
@ -727,6 +731,7 @@ sub compile_vlt_flags {
my @verilator_flags = @{$param{verilator_flags}};
unshift @verilator_flags, "--gdb" if $opt_gdb;
unshift @verilator_flags, "--gdbbt" if $opt_gdbbt;
unshift @verilator_flags, "--rr" if $opt_rr;
unshift @verilator_flags, "--x-assign unique"; # More likely to be buggy
unshift @verilator_flags, "--trace" if $opt_trace;
my $threads = ::calc_threads($Vltmt_threads);
@ -1047,9 +1052,15 @@ sub execute {
#&& (!$param{needs_v4} || -r "$ENV{VERILATOR_ROOT}/src/V3Gate.cpp")
) {
$param{executable} ||= "$self->{obj_dir}/$param{VM_PREFIX}";
my $debugger = "";
if ($opt_gdbsim) {
$debugger = ($ENV{VERILATOR_GDB}||"gdb")." ";
} elsif ($opt_rrsim) {
$debugger = "rr record ";
}
$self->_run(logfile=>"$self->{obj_dir}/vlt_sim.log",
cmd=>[($run_env
.($opt_gdbsim ? ($ENV{VERILATOR_GDB}||"gdb")." " : "")
.$debugger
.$param{executable}
.($opt_gdbsim ? " -ex 'run " : "")),
@{$param{all_run_flags}},
@ -2288,6 +2299,14 @@ C<--rerun>, and C<--verbose> which is not the opposite of C<--quiet>.
Rerun all tests that failed in this run. Reruns force the flags
C<--no-quiet --j 1>.
=item --rr
Same as C<verilator --rr>: Run Verilator and record with rr.
=item --rrsim
Run Verilator generated executable and record with rr.
=item --site
Run site specific tests also.