Add --x-assign=fast, and make it the default.

This commit is contained in:
Wilson Snyder 2008-07-16 13:31:21 -04:00
parent d9e47a6293
commit f0a06182ca
6 changed files with 32 additions and 20 deletions

View File

@ -5,6 +5,9 @@ indicates the contributor was also the author of the fix; Thanks!
* Verilator 3.66*
** Add --x-assign=fast option, and make it the default.
This chooses performance over reset debugging. See the manual.
*** Add $feof, $fgetc, $fgets, $fflush, $fscanf, $sscanf. [Holger Waechtler]
*** Add $stime. [Holger Waechtler]

View File

@ -252,6 +252,8 @@ linking with make rules you write yourself.
Enable all assertions, includes enabling the --psl flag. (If psl is not
desired, but other assertions are, use --assert --nopsl.)
See also --x-assign; setting "--x-assign unique" may be desirable.
=item --bin I<filename>
Rarely needed. Override the default filename for Verilator itself. When a
@ -566,14 +568,18 @@ received from third parties.
=item -x-assign 1
=item -x-assign unique (default)
=item -x-assign fast (default)
=item -x-assign unique
Controls the two-state value that is replaced when an assignment to X is
encountered. -x-assign=0 converts all Xs to 0s, this is the fastest.
-x-assign=1 converts all Xs to 1s, this is nearly as fast, but more likely
to find reset bugs as active high logic will fire. The default,
-x-assign=func will call a function to determine the value, this allows
randomization of all Xs and is the slowest, but safest.
encountered. -x-assign=fast, the default, converts all Xs to whatever is
best for performance. -x-assign=0 converts all Xs to 0s, and is also fast.
-x-assign=1 converts all Xs to 1s, this is nearly as fast as 0, but more
likely to find reset bugs as active high logic will fire. -x-assign=unique
will call a function to determine the value, this allows randomization of
all Xs to find reset bugs and is the slowest, but safest for finding reset
bugs in code.
=back
@ -747,10 +753,10 @@ the test_sp directory in the distribution for an example.
=head1 BENCHMARKING & OPTIMIZATION
For best performance, run Verilator with the "-O3 -x-assign=0 --noassert"
flags. The -O3 flag will require longer compile times, and -x-assign=0 may
increase the risk of reset bugs in trade for performance; see the above
documentation for these flags.
For best performance, run Verilator with the "-O3 -x-assign=fast
--noassert" flags. The -O3 flag will require longer compile times, and
-x-assign=fast may increase the risk of reset bugs in trade for
performance; see the above documentation for these flags.
Minor Verilog code changes can also give big wins. You should not have any
UNOPTFLAT warnings from Verilator. Fixing these warnings can result in

View File

@ -685,6 +685,7 @@ void V3Options::parseOptsList(FileLine* fl, int argc, char** argv) {
shift;
if (!strcmp (argv[i], "0")) { m_xAssign="0"; }
else if (!strcmp (argv[i], "1")) { m_xAssign="1"; }
else if (!strcmp (argv[i], "fast")) { m_xAssign="fast"; }
else if (!strcmp (argv[i], "unique")) { m_xAssign="unique"; }
else {
fl->v3fatal("Unknown setting for --x-assign: "<<argv[i]);
@ -830,7 +831,7 @@ V3Options::V3Options() {
m_makeDir = "obj_dir";
m_bin = "";
m_flags = "";
m_xAssign = "unique";
m_xAssign = "fast";
m_language = V3LangCode::mostRecent();

View File

@ -325,9 +325,11 @@ sub compile {
}
if ($param{v3}) {
$opt_gdb="gdbrun" if defined $opt_gdb;
unshift @{$param{verilator_flags}}, "--gdb $opt_gdb" if $opt_gdb;
unshift @{$param{verilator_flags}}, "--debug" if $::Debug;
# unshift @{$param{verilator_flags}}, "--trace";
my @verilator_flags = @{$param{verilator_flags}};
unshift @verilator_flags, "--gdb $opt_gdb" if $opt_gdb;
unshift @verilator_flags, "--debug" if $::Debug;
unshift @verilator_flags, "--x-assign unique"; # More likely to be buggy
# unshift @verilator_flags, "--trace";
if (defined $opt_optimize) {
my $letters = "";
if ($opt_optimize =~ /[a-zA-Z]/) {
@ -336,15 +338,15 @@ sub compile {
foreach my $l ('a'..'z') {
$letters .= ((rand() > 0.5) ? $l : uc $l);
}
unshift @{$param{verilator_flags}}, "--trace" if rand() > 0.5;
unshift @{$param{verilator_flags}}, "--coverage" if rand() > 0.5;
unshift @verilator_flags, "--trace" if rand() > 0.5;
unshift @verilator_flags, "--coverage" if rand() > 0.5;
}
unshift @{$param{verilator_flags}}, "--O".$letters;
unshift @verilator_flags, "--O".$letters;
}
my @v3args = ("perl","../bin/verilator",
"--prefix ".$self->{VM_PREFIX},
@{$param{verilator_flags}},
@verilator_flags,
@{$param{verilator_flags2}},
@{$param{v_flags}},
@{$param{v_flags2}},

View File

@ -9,7 +9,7 @@ if (!$::Driver) { use FindBin; exec("./driver.pl", @ARGV, $0); die; }
$golden_out ||= "t/$Last_Self->{name}.out";
compile (
v_flags2 => [$Last_Self->{v3}?"--stats --O3 -x-assign 0":""],
v_flags2 => [$Last_Self->{v3}?"--stats --O3 -x-assign fast":""],
);
execute (

View File

@ -9,7 +9,7 @@ if (!$::Driver) { use FindBin; exec("./driver.pl", @ARGV, $0); die; }
$golden_out ||= "t/$Last_Self->{name}.out";
compile (
v_flags2 => [$Last_Self->{v3}?"--stats --O3 -x-assign 0":""],
v_flags2 => [$Last_Self->{v3}?"--stats --O3 -x-assign fast":""],
);
execute (