From 4452a9b10f02052cf230d115e4a6fd874eec0b2f Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Mon, 28 Nov 2022 07:08:34 -0500 Subject: [PATCH] Internals: Fix some VL_MT metacomments. --- include/verilated.cpp | 2 +- include/verilated.h | 14 +++++++------- include/verilated_cov.h | 2 +- include/verilated_funcs.h | 8 ++++---- include/verilated_imp.h | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/verilated.cpp b/include/verilated.cpp index c5ec3af73..17ee99aa9 100644 --- a/include/verilated.cpp +++ b/include/verilated.cpp @@ -279,7 +279,7 @@ void VL_PRINTF_MT(const char* formatp, ...) VL_MT_SAFE { //=========================================================================== // Random -- Mostly called at init time, so not inline. -static uint32_t vl_sys_rand32() VL_MT_UNSAFE { +static uint32_t vl_sys_rand32() VL_MT_SAFE { // Return random 32-bits using system library. // Used only to construct seed for Verilator's PNRG. static VerilatedMutex s_mutex; diff --git a/include/verilated.h b/include/verilated.h index 09a8c8670..9aee9cfad 100644 --- a/include/verilated.h +++ b/include/verilated.h @@ -275,7 +275,7 @@ private: public: explicit VerilatedModule(const char* namep); // Create module with given hierarchy name ~VerilatedModule(); - const char* name() const { return m_namep; } ///< Return name of module + const char* name() const VL_MT_SAFE_POSTINIT { return m_namep; } ///< Return name of module }; //========================================================================= @@ -533,8 +533,8 @@ public: // METHODS - public but for internal use only // Internal: access to implementation class - VerilatedContextImp* impp() { return reinterpret_cast(this); } - const VerilatedContextImp* impp() const { + VerilatedContextImp* impp() VL_MT_SAFE { return reinterpret_cast(this); } + const VerilatedContextImp* impp() const VL_MT_SAFE { return reinterpret_cast(this); } @@ -617,10 +617,10 @@ public: // But internals only - called from VerilatedModule's void varInsert(int finalize, const char* namep, void* datap, bool isParam, VerilatedVarType vltype, int vlflags, int dims, ...) VL_MT_UNSAFE; // ACCESSORS - const char* name() const { return m_namep; } - const char* identifier() const { return m_identifierp; } - int8_t timeunit() const { return m_timeunit; } - VerilatedSyms* symsp() const { return m_symsp; } + const char* name() const VL_MT_SAFE_POSTINIT { return m_namep; } + const char* identifier() const VL_MT_SAFE_POSTINIT { return m_identifierp; } + int8_t timeunit() const VL_MT_SAFE_POSTINIT { return m_timeunit; } + VerilatedSyms* symsp() const VL_MT_SAFE_POSTINIT { return m_symsp; } VerilatedVar* varFind(const char* namep) const VL_MT_SAFE_POSTINIT; VerilatedVarNameMap* varsp() const VL_MT_SAFE_POSTINIT { return m_varsp; } void scopeDump() const; diff --git a/include/verilated_cov.h b/include/verilated_cov.h index 4697c4f88..01240f60f 100644 --- a/include/verilated_cov.h +++ b/include/verilated_cov.h @@ -152,7 +152,7 @@ protected: // METHODS // Internal: access to implementation class - VerilatedCovImp* impp() { return reinterpret_cast(this); } + VerilatedCovImp* impp() VL_MT_SAFE { return reinterpret_cast(this); } }; //============================================================================= diff --git a/include/verilated_funcs.h b/include/verilated_funcs.h index 605580cbb..c3db7c7a6 100644 --- a/include/verilated_funcs.h +++ b/include/verilated_funcs.h @@ -259,20 +259,20 @@ extern void _vl_debug_print_w(int lbits, WDataInP const iwp); #if defined(SYSTEMC_VERSION) /// Return current simulation time // Already defined: extern sc_time sc_time_stamp(); -inline uint64_t vl_time_stamp64() { return sc_time_stamp().value(); } +inline uint64_t vl_time_stamp64() VL_MT_SAFE { return sc_time_stamp().value(); } #else // Non-SystemC # if !defined(VL_TIME_CONTEXT) && !defined(VL_NO_LEGACY) # ifdef VL_TIME_STAMP64 // vl_time_stamp64() may be optionally defined by the user to return time. // On MSVC++ weak symbols are not supported so must be declared, or define // VL_TIME_CONTEXT. -extern uint64_t vl_time_stamp64() VL_ATTR_WEAK; +extern uint64_t vl_time_stamp64() VL_ATTR_WEAK VL_MT_SAFE; # else // sc_time_stamp() may be optionally defined by the user to return time. // On MSVC++ weak symbols are not supported so must be declared, or define // VL_TIME_CONTEXT. -extern double sc_time_stamp() VL_ATTR_WEAK; // Verilator 4.032 and newer -inline uint64_t vl_time_stamp64() { +extern double sc_time_stamp() VL_ATTR_WEAK VL_MT_SAFE; // Verilator 4.032 and newer +inline uint64_t vl_time_stamp64() VL_MT_SAFE { // clang9.0.1 requires & although we really do want the weak symbol value // cppcheck-suppress duplicateValueTernary return VL_LIKELY(&sc_time_stamp) ? static_cast(sc_time_stamp()) : 0; diff --git a/include/verilated_imp.h b/include/verilated_imp.h index 0d6c907b7..5684da3c5 100644 --- a/include/verilated_imp.h +++ b/include/verilated_imp.h @@ -226,7 +226,7 @@ class VerilatedContextImp final : VerilatedContext { // Number incrementing on each reseed, 0=illegal int s_randSeedEpoch = 1; // Reads ok, wish had a VL_WRITE_GUARDED_BY(s_randMutex) }; - static Statics& s() { + static Statics& s() VL_MT_SAFE { static Statics s_s; return s_s; }