diff --git a/include/verilated.cpp b/include/verilated.cpp index 17ee99aa9..c975b76e0 100644 --- a/include/verilated.cpp +++ b/include/verilated.cpp @@ -2453,7 +2453,7 @@ void VerilatedContext::timeprecision(int value) VL_MT_SAFE { sc_prec = 15; } } - if (value != sc_prec) { + if (VL_UNLIKELY(value != sc_prec)) { std::ostringstream msg; msg << "SystemC's sc_set_time_resolution is 10^-" << sc_prec << ", which does not match Verilog timeprecision 10^-" << value @@ -2524,7 +2524,7 @@ void VerilatedContext::internalsDump() const VL_MT_SAFE { void VerilatedContext::addModel(VerilatedModel* modelp) { threadPoolp(); // Ensure thread pool is created, so m_threads cannot change any more - if (modelp->threads() > m_threads) { + if (VL_UNLIKELY(modelp->threads() > m_threads)) { std::ostringstream msg; msg << "VerilatedContext has " << m_threads << " threads but model '" << modelp->modelName() << "' (instantiated as '" << modelp->hierName() diff --git a/include/verilated_fst_sc.cpp b/include/verilated_fst_sc.cpp index f6bfeb41a..b093e1eac 100644 --- a/include/verilated_fst_sc.cpp +++ b/include/verilated_fst_sc.cpp @@ -29,7 +29,7 @@ //====================================================================== void VerilatedFstSc::open(const char* filename) { - if (!sc_core::sc_get_curr_simcontext()->elaboration_done()) { + if (VL_UNLIKELY(!sc_core::sc_get_curr_simcontext()->elaboration_done())) { vl_fatal(__FILE__, __LINE__, "VerilatedFstSc", ("%Error: VerilatedFstSc::open(\"" + std::string{filename} + "\") is called before sc_core::sc_start(). " diff --git a/include/verilated_vcd_sc.cpp b/include/verilated_vcd_sc.cpp index a7286d050..2da4de7b1 100644 --- a/include/verilated_vcd_sc.cpp +++ b/include/verilated_vcd_sc.cpp @@ -29,7 +29,7 @@ //====================================================================== void VerilatedVcdSc::open(const char* filename) { - if (!sc_core::sc_get_curr_simcontext()->elaboration_done()) { + if (VL_UNLIKELY(!sc_core::sc_get_curr_simcontext()->elaboration_done())) { vl_fatal(__FILE__, __LINE__, "VerilatedVcdSc", ("%Error: VerilatedVcdSc::open(\"" + std::string{filename} + "\") is called before sc_core::sc_start(). "