Add runtime arguments.
This commit is contained in:
parent
26c31db75e
commit
f3c9b4fb03
4
Changes
4
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.
|
** 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]
|
*** Better optimize large always block splitting, bug1244. [John Coiner]
|
||||||
|
|
||||||
|
|
|
@ -380,6 +380,16 @@ detailed descriptions in L</"VERILATION ARGUMENTS"> for more information.
|
||||||
--x-initial-edge Enable initial X->0 and X->1 edge triggers
|
--x-initial-edge Enable initial X->0 and X->1 edge triggers
|
||||||
-y <dir> Directory to search for modules
|
-y <dir> Directory to search for modules
|
||||||
|
|
||||||
|
This is a short summary of the arguments to run-time Verilated arguments.
|
||||||
|
detailed descriptions in L</"RUNTIME ARGUMENTS"> for more information.
|
||||||
|
|
||||||
|
+verilator+debug Enable debugging
|
||||||
|
+verilator+debugi+I<value> Enable debugging at a level
|
||||||
|
+verilator+help Display help
|
||||||
|
+verilator+rand+reset+I<value> Set random reset technique
|
||||||
|
+verilator+V Verbose version and config
|
||||||
|
+verilator+version Show version and exit
|
||||||
|
|
||||||
|
|
||||||
=head1 VERILATION ARGUMENTS
|
=head1 VERILATION ARGUMENTS
|
||||||
|
|
||||||
|
@ -1432,6 +1442,45 @@ are desired for error messages instead of relative filenames.
|
||||||
=back
|
=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<value>
|
||||||
|
|
||||||
|
Enable debugging at the provided level.
|
||||||
|
|
||||||
|
=item +verilator+help
|
||||||
|
|
||||||
|
Display help and exit.
|
||||||
|
|
||||||
|
=item +verilator+rand+reset+I<value>
|
||||||
|
|
||||||
|
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</"Unknown states">.
|
||||||
|
|
||||||
|
=item +verilator+V
|
||||||
|
|
||||||
|
Shows the verbose version, including configuration information.
|
||||||
|
|
||||||
|
=item +verilator+version
|
||||||
|
|
||||||
|
Displays program version and exits.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
|
||||||
=head1 EXAMPLE C++ EXECUTION
|
=head1 EXAMPLE C++ EXECUTION
|
||||||
|
|
||||||
We'll compile this example into C++.
|
We'll compile this example into C++.
|
||||||
|
|
|
@ -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();
|
if (!s_s.m_argVecLoaded) s_s.m_argVec.clear();
|
||||||
for (int i=0; i<argc; ++i) {
|
for (int i=0; i<argc; ++i) {
|
||||||
s_s.m_argVec.push_back(argv[i]);
|
s_s.m_argVec.push_back(argv[i]);
|
||||||
|
commandArgVl(argv[i]);
|
||||||
}
|
}
|
||||||
s_s.m_argVecLoaded = true; // Can't just test later for empty vector, no arguments is ok
|
s_s.m_argVecLoaded = true; // Can't just test later for empty vector, no arguments is ok
|
||||||
}
|
}
|
||||||
|
void VerilatedImp::commandArgVl(const std::string& arg) {
|
||||||
|
if (0 == strncmp(arg.c_str(), "+verilator+", strlen("+verilator+"))) {
|
||||||
|
std::string value;
|
||||||
|
if (0) {
|
||||||
|
}
|
||||||
|
else if (arg == "+verilator+debug") {
|
||||||
|
Verilated::debug(4);
|
||||||
|
}
|
||||||
|
else if (commandArgVlValue(arg, "+verilator+debugi+", value/*ref*/)) {
|
||||||
|
Verilated::debug(atoi(value.c_str()));
|
||||||
|
}
|
||||||
|
else if (arg == "+verilator+help") {
|
||||||
|
versionDump();
|
||||||
|
VL_PRINTF_MT("For help, please see 'verilator --help'\n");
|
||||||
|
VL_FATAL_MT("COMMAND_LINE", 0, "", "Exiting due to command line argument (not an error)");
|
||||||
|
}
|
||||||
|
else if (commandArgVlValue(arg, "+verilator+rand+reset+", value/*ref*/)) {
|
||||||
|
Verilated::randReset(atoi(value.c_str()));
|
||||||
|
}
|
||||||
|
else if (arg == "+verilator+V") {
|
||||||
|
versionDump(); // Someday more info too
|
||||||
|
VL_FATAL_MT("COMMAND_LINE", 0, "", "Exiting due to command line argument (not an error)");
|
||||||
|
}
|
||||||
|
else if (arg == "+verilator+version") {
|
||||||
|
versionDump();
|
||||||
|
VL_FATAL_MT("COMMAND_LINE", 0, "", "Exiting due to command line argument (not an error)");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
VL_PRINTF_MT("%%Warning: Unknown +verilator runtime argument: '%s'\n", arg.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool VerilatedImp::commandArgVlValue(const std::string& arg,
|
||||||
|
const std::string& prefix, std::string& valuer) {
|
||||||
|
size_t len = prefix.length();
|
||||||
|
if (0==strncmp(prefix.c_str(), arg.c_str(), len)) {
|
||||||
|
valuer = arg.substr(len);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// VerilatedSyms:: Methods
|
// VerilatedSyms:: Methods
|
||||||
|
|
|
@ -239,6 +239,9 @@ public:
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
static void commandArgsAddGuts(int argc, const char** argv) VL_REQUIRES(s_s.m_argMutex);
|
static void commandArgsAddGuts(int argc, const char** argv) VL_REQUIRES(s_s.m_argMutex);
|
||||||
|
static void commandArgVl(const std::string& arg);
|
||||||
|
static bool commandArgVlValue(const std::string& arg,
|
||||||
|
const std::string& prefix, std::string& valuer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// METHODS - user scope tracking
|
// METHODS - user scope tracking
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||||
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||||
|
#
|
||||||
|
# Copyright 2003 by Wilson Snyder. This program is free software; you can
|
||||||
|
# redistribute it and/or modify it under the terms of either the GNU
|
||||||
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
|
# Version 2.0.
|
||||||
|
|
||||||
|
scenarios(vlt_all => 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 {<thread>,<sequence_number>}.
|
||||||
|
-V{t0,2}- Verilated::debug is on. Message prefix indicates {<thread>,<sequence_number>}.
|
||||||
|
*-* 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;
|
|
@ -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
|
Loading…
Reference in New Issue