diff --git a/Changes b/Changes index 53db2ae98..699506b6c 100644 --- a/Changes +++ b/Changes @@ -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] diff --git a/bin/verilator b/bin/verilator index 848dfa07c..8f7b6d653 100755 --- a/bin/verilator +++ b/bin/verilator @@ -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 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 diff --git a/src/V3Options.cpp b/src/V3Options.cpp index 47f4e413a..28b41968d 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -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: "< 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}}, diff --git a/test_regress/t/t_case_write1.pl b/test_regress/t/t_case_write1.pl index 474b9b504..b7683d8a7 100755 --- a/test_regress/t/t_case_write1.pl +++ b/test_regress/t/t_case_write1.pl @@ -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 ( diff --git a/test_regress/t/t_case_write2.pl b/test_regress/t/t_case_write2.pl index 474b9b504..b7683d8a7 100755 --- a/test_regress/t/t_case_write2.pl +++ b/test_regress/t/t_case_write2.pl @@ -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 (