From 6ada513fa5351fb7c11ed5f8d21a017a39beaff2 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Mon, 22 Feb 2021 22:29:06 -0500 Subject: [PATCH] Internal: Don't serialize debug, turn on each run. --- include/verilated.cpp | 3 +-- include/verilated.h | 25 +++++++++++++------------ include/verilated_imp.h | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/verilated.cpp b/include/verilated.cpp index 180cc8d76..880297a0a 100644 --- a/include/verilated.cpp +++ b/include/verilated.cpp @@ -265,7 +265,6 @@ void VL_PRINTF_MT(const char* formatp, ...) VL_MT_SAFE { // Overall class init Verilated::Serialized::Serialized() { - s_debug = 0; s_calcUnusedSigs = false; s_gotFinish = false; s_assertOn = true; @@ -2216,7 +2215,7 @@ void VL_TIMEFORMAT_IINI(int units, int precision, const std::string& suffix, void Verilated::debug(int level) VL_MT_SAFE { const VerilatedLockGuard lock(s_mutex); - s_s.s_debug = level; + s_ns.s_debug = level; if (level) { #ifdef VL_DEBUG VL_DEBUG_IF(VL_DBG_MSGF("- Verilated::debug is on." diff --git a/include/verilated.h b/include/verilated.h index 2c6ee8cf5..1c90643db 100644 --- a/include/verilated.h +++ b/include/verilated.h @@ -364,7 +364,6 @@ class Verilated final { static struct Serialized { // All these members serialized/deserialized // Fast path - int s_debug; ///< See accessors... only when VL_DEBUG set bool s_calcUnusedSigs; ///< Waves file on, need all signals calculated bool s_gotFinish; ///< A $finish statement executed bool s_assertOn; ///< Assertions are enabled @@ -384,6 +383,7 @@ class Verilated final { static struct NonSerialized { // Non-serialized information // These are reloaded from on command-line settings, so do not need to persist // Fast path + int s_debug = 0; ///< See accessors... only when VL_DEBUG set vluint64_t s_profThreadsStart = 1; ///< +prof+threads starting time vluint32_t s_profThreadsWindow = 2; ///< +prof+threads window size // Slow path @@ -426,6 +426,18 @@ private: public: // METHODS - User called + /// Enable debug of internal verilated code + static void debug(int level) VL_MT_SAFE; +#ifdef VL_DEBUG + /// Return debug level + /// When multithreaded this may not immediately react to another thread + /// changing the level (no mutex) + static inline int debug() VL_MT_SAFE { return s_ns.s_debug; } +#else + /// Return constant 0 debug level, so C++'s optimizer rips up + static constexpr int debug() VL_PURE { return 0; } +#endif + /// Select initial value of otherwise uninitialized signals. //// /// 0 = Set to zeros @@ -439,17 +451,6 @@ public: /// Random seed extended to 64 bits, and defaulted if user seed==0 static vluint64_t randSeedDefault64() VL_MT_SAFE; - /// Enable debug of internal verilated code - static void debug(int level) VL_MT_SAFE; -#ifdef VL_DEBUG - /// Return debug level - /// When multithreaded this may not immediately react to another thread - /// changing the level (no mutex) - static inline int debug() VL_MT_SAFE { return s_s.s_debug; } -#else - /// Return constant 0 debug level, so C++'s optimizer rips up - static constexpr int debug() VL_PURE { return 0; } -#endif /// Enable calculation of unused signals static void calcUnusedSigs(bool flag) VL_MT_SAFE; static bool calcUnusedSigs() VL_MT_SAFE { ///< Return calcUnusedSigs value diff --git a/include/verilated_imp.h b/include/verilated_imp.h index 6102425f9..9287cf26e 100644 --- a/include/verilated_imp.h +++ b/include/verilated_imp.h @@ -235,7 +235,7 @@ protected: VerilatedScopeNameMap m_nameMap VL_GUARDED_BY(m_nameMutex); VerilatedMutex m_hierMapMutex; ///< Protect m_hierMap - /// Map the represents scope hierarchy + /// Map that represents scope hierarchy VerilatedHierarchyMap m_hierMap VL_GUARDED_BY(m_hierMapMutex); // Slow - somewhat static: