diff --git a/bin/verilator b/bin/verilator index 9e5a0858e..f7376a484 100755 --- a/bin/verilator +++ b/bin/verilator @@ -249,8 +249,8 @@ To get started, jump down to "EXAMPLE C++ EXECUTION". =head1 ARGUMENT SUMMARY -This is a short summary of the arguments to Verilator. See the detailed -descriptions in the next sections for more information. +This is a short summary of the arguments to Verilator itself. See the +detailed descriptions in L for more information. {file.v} Verilog package, module and top module filenames {file.c/cc/cpp} Optional C++ files to compile in @@ -366,6 +366,7 @@ descriptions in the next sections for more information. -v Verilog library +verilog1995ext+ Synonym for +1364-1995ext+ +verilog2001ext+ Synonym for +1364-2001ext+ + --version Displays program version and exits --vpi Enable VPI compiles -Wall Enable all style warnings -Werror- Convert warnings to errors @@ -380,7 +381,9 @@ descriptions in the next sections for more information. -y Directory to search for modules -=head1 ARGUMENTS +=head1 VERILATION ARGUMENTS + +The following are the arguments that may be passed to Verilator itself. =over 4 @@ -1252,6 +1255,10 @@ Note -v is fairly standard across Verilog tools. Synonyms for C<+1364-1995ext+>I and C<+1364-2001ext+>I respectively +=item --version + +Displays program version and exits. + =item --vpi Enable use of VPI and linking against the verilated_vpi.cpp files. @@ -1371,7 +1378,7 @@ not otherwise initialized. --x-initial=unique, the default, initializes variables using a function, which determines the value to use each initialization. This gives greatest -flexibility and allows finding reset bugs. See L +flexibility and allows finding reset bugs. See L. --x-initial=fast, is best for performance, and initializes all variables to a state Verilator determines is optimal. This may allow further code diff --git a/include/verilated.cpp b/include/verilated.cpp index 215a5f137..d3a9a5d73 100644 --- a/include/verilated.cpp +++ b/include/verilated.cpp @@ -42,7 +42,7 @@ VL_THREAD_LOCAL Verilated::ThreadLocal Verilated::t_s; struct Verilated::CommandArgValues Verilated::s_args = {0, NULL}; -VerilatedImp VerilatedImp::s_s; +VerilatedImp VerilatedImp::s_s; //=========================================================================== // User definable functions @@ -1740,6 +1740,44 @@ void Verilated::endOfEvalGuts(VerilatedEvalMsgQueue* evalMsgQp) VL_MT_SAFE { } #endif +//=========================================================================== +// VerilatedImp:: Methods + +void VerilatedImp::internalsDump() VL_MT_SAFE { + VerilatedLockGuard lock(s_s.m_argMutex); + VL_PRINTF_MT("internalsDump:\n"); + versionDump(); + VL_PRINTF_MT(" Argv:"); + for (ArgVec::const_iterator it=s_s.m_argVec.begin(); it!=s_s.m_argVec.end(); ++it) { + VL_PRINTF_MT(" %s",it->c_str()); + } + VL_PRINTF_MT("\n"); + scopesDump(); + exportsDump(); + userDump(); +} +void VerilatedImp::versionDump() VL_MT_SAFE { + VL_PRINTF_MT(" Version: %s %s\n", + Verilated::productName(), Verilated::productVersion()); +} + +void VerilatedImp::commandArgs(int argc, const char** argv) VL_EXCLUDES(s_s.m_argMutex) { + VerilatedLockGuard lock(s_s.m_argMutex); + s_s.m_argVec.clear(); // Always clear + commandArgsAddGuts(argc, argv); +} +void VerilatedImp::commandArgsAdd(int argc, const char** argv) VL_EXCLUDES(s_s.m_argMutex) { + VerilatedLockGuard lock(s_s.m_argMutex); + commandArgsAddGuts(argc, argv); +} +void VerilatedImp::commandArgsAddGuts(int argc, const char** argv) VL_REQUIRES(s_s.m_argMutex) { + if (!s_s.m_argVecLoaded) s_s.m_argVec.clear(); + for (int i=0; i(argv)); } + static void commandArgs(int argc, char** argv) VL_MT_SAFE { + commandArgs(argc, const_cast(argv)); } static void commandArgsAdd(int argc, const char** argv); static CommandArgValues* getCommandArgs() VL_MT_SAFE { return &s_args; } /// Match plusargs with a given prefix. Returns static char* valid only for a single call diff --git a/include/verilated_imp.h b/include/verilated_imp.h index 621eef154..505a25fdd 100644 --- a/include/verilated_imp.h +++ b/include/verilated_imp.h @@ -212,31 +212,14 @@ public: // But only for verilated*.cpp private: VL_UNCOPYABLE(VerilatedImp); public: - static void internalsDump() VL_MT_SAFE { - VerilatedLockGuard lock(s_s.m_argMutex); - VL_PRINTF_MT("internalsDump:\n"); - VL_PRINTF_MT(" Argv:"); - for (ArgVec::const_iterator it=s_s.m_argVec.begin(); it!=s_s.m_argVec.end(); ++it) { - VL_PRINTF_MT(" %s",it->c_str()); - } - VL_PRINTF_MT("\n"); - VL_PRINTF_MT(" Version: %s %s\n", Verilated::productName(), Verilated::productVersion()); - scopesDump(); - exportsDump(); - userDump(); - } + // METHODS - debug + static void internalsDump() VL_MT_SAFE; + static void versionDump() VL_MT_SAFE; // METHODS - arguments public: - static void commandArgs(int argc, const char** argv) VL_EXCLUDES(s_s.m_argMutex) { - VerilatedLockGuard lock(s_s.m_argMutex); - s_s.m_argVec.clear(); // Always clear - commandArgsAddGuts(argc, argv); - } - static void commandArgsAdd(int argc, const char** argv) VL_EXCLUDES(s_s.m_argMutex) { - VerilatedLockGuard lock(s_s.m_argMutex); - commandArgsAddGuts(argc, argv); - } + static void commandArgs(int argc, const char** argv) VL_EXCLUDES(s_s.m_argMutex); + static void commandArgsAdd(int argc, const char** argv) VL_EXCLUDES(s_s.m_argMutex); static std::string argPlusMatch(const char* prefixp) VL_EXCLUDES(s_s.m_argMutex) { VerilatedLockGuard lock(s_s.m_argMutex); // Note prefixp does not include the leading "+" @@ -255,11 +238,7 @@ public: return ""; } private: - static void commandArgsAddGuts(int argc, const char** argv) VL_REQUIRES(s_s.m_argMutex) { - if (!s_s.m_argVecLoaded) s_s.m_argVec.clear(); - for (int i=0; i