diff --git a/Changes b/Changes index bcb162f96..51f01a40f 100644 --- a/Changes +++ b/Changes @@ -6,7 +6,9 @@ The contributors that suggested a given feature are shown in []. Thanks! ** This is a major release. Any patches may require major rework to apply. -** Fix internals to make null-pointer-check clean. +** Add runtime arguments. + +** Fix internals to be C++ null-pointer-check clean. *** Better optimize large always block splitting, bug1244. [John Coiner] diff --git a/bin/verilator b/bin/verilator index f7376a484..3f00c21ef 100755 --- a/bin/verilator +++ b/bin/verilator @@ -380,6 +380,16 @@ detailed descriptions in L for more information. --x-initial-edge Enable initial X->0 and X->1 edge triggers -y Directory to search for modules +This is a short summary of the arguments to run-time Verilated arguments. +detailed descriptions in L for more information. + + +verilator+debug Enable debugging + +verilator+debugi+I Enable debugging at a level + +verilator+help Display help + +verilator+rand+reset+I Set random reset technique + +verilator+V Verbose version and config + +verilator+version Show version and exit + =head1 VERILATION ARGUMENTS @@ -1432,6 +1442,45 @@ are desired for error messages instead of relative filenames. =back +=head1 RUNTIME ARGUMENTS + +The following are the arguments that may be passed to a Verilated +executable, provided that executable calls Verilated::commandArgs(). + +All runtime arguments begin with +verilator, so that the user's executable +may skip over all +verilator arguments when parsing its command line. + +=over 4 + +=item +verilator+debug + +Enable debugging. Equivalent to +verilator+debugi+4. + +=item +verilator+debugi+I + +Enable debugging at the provided level. + +=item +verilator+help + +Display help and exit. + +=item +verilator+rand+reset+I + +When a model was Verilated using "-x-inital unique", sets the +initialization technique. 0 = Reset to zeros. 1 = Reset to all-ones. 2 = +Randomize. See L. + +=item +verilator+V + +Shows the verbose version, including configuration information. + +=item +verilator+version + +Displays program version and exits. + +=back + + =head1 EXAMPLE C++ EXECUTION We'll compile this example into C++. diff --git a/include/verilated.cpp b/include/verilated.cpp index d3a9a5d73..9483b3997 100644 --- a/include/verilated.cpp +++ b/include/verilated.cpp @@ -1774,9 +1774,52 @@ void VerilatedImp::commandArgsAddGuts(int argc, const char** argv) VL_REQUIRES(s if (!s_s.m_argVecLoaded) s_s.m_argVec.clear(); for (int i=0; i 1); + +compile( + ); + +execute( + all_run_flags => ["+verilator+debug +verilator+debugi+9 +verilator+rand+reset+1"], + check_finished => 1, + expect => ( +q{-V{t0,1}- Verilated::debug is on. Message prefix indicates {,}. +-V{t0,2}- Verilated::debug is on. Message prefix indicates {,}. +*-* All Finished *-* +}), + ); + +execute( + all_run_flags => ["+verilator+help"], + fails => 1, + expect => ( +q{.*For help, please see 'verilator --help' +.*}), + ); + +execute( + all_run_flags => ["+verilator+V"], + fails => 1, + expect => ( +q{.*Version:}), + ); + +execute( + all_run_flags => ["+verilator+version"], + fails => 1, + expect => ( +q{.*Version:}), + ); + +ok(1); + +1; diff --git a/test_regress/t/t_runflag.v b/test_regress/t/t_runflag.v new file mode 100644 index 000000000..5edda933b --- /dev/null +++ b/test_regress/t/t_runflag.v @@ -0,0 +1,11 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2003 by Wilson Snyder. + +module t; + initial begin + $write("*-* All Finished *-*\n"); + $finish; + end +endmodule