Fix false $dumpfile warning on model save (#2834).

This commit is contained in:
Wilson Snyder 2021-03-14 09:08:17 -04:00
parent 4261f72bd2
commit e6b19d557e
4 changed files with 10 additions and 3 deletions

View File

@ -10,6 +10,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
**** Fix exceeding command-line ar limit (#2834). [Yinan Xu]
**** Fix false $dumpfile warning on model save (#2834). [Yinan Xu]
* Verilator 4.200 2021-03-12

View File

@ -2202,11 +2202,15 @@ void VerilatedContext::dumpfile(const std::string& flag) VL_MT_SAFE_EXCLUDES(m_t
}
std::string VerilatedContext::dumpfile() const VL_MT_SAFE_EXCLUDES(m_timeDumpMutex) {
const VerilatedLockGuard lock(m_timeDumpMutex);
if (VL_UNLIKELY(m_dumpfile.empty())) {
return m_dumpfile;
}
std::string VerilatedContext::dumpfileCheck() const VL_MT_SAFE_EXCLUDES(m_timeDumpMutex) {
const std::string out = dumpfile();
if (VL_UNLIKELY(out.empty())) {
VL_PRINTF_MT("%%Warning: $dumpvar ignored as not proceeded by $dumpfile\n");
return "";
}
return m_dumpfile;
return out;
}
void VerilatedContext::errorCount(int val) VL_MT_SAFE {
const VerilatedLockGuard lock(m_mutex);

View File

@ -529,6 +529,7 @@ public: // But for internal use only
// Internal: $dumpfile
void dumpfile(const std::string& flag) VL_MT_SAFE_EXCLUDES(m_timeDumpMutex);
std::string dumpfile() const VL_MT_SAFE_EXCLUDES(m_timeDumpMutex);
std::string dumpfileCheck() const VL_MT_SAFE_EXCLUDES(m_timeDumpMutex);
// Internal: --prof-threads related settings
void profThreadsStart(vluint64_t flag) VL_MT_SAFE;

View File

@ -3523,7 +3523,7 @@ class EmitCTrace final : EmitCStmts {
puts("if (VL_UNLIKELY(!__VlSymsp->__Vm_dumperp)) {\n");
puts("__VlSymsp->__Vm_dumperp = new " + v3Global.opt.traceClassLang() + "();\n");
puts("trace(__VlSymsp->__Vm_dumperp, 0, 0);\n");
puts("std::string dumpfile = __VlSymsp->_vm_contextp__->dumpfile();\n");
puts("std::string dumpfile = __VlSymsp->_vm_contextp__->dumpfileCheck();\n");
puts("__VlSymsp->__Vm_dumperp->open(dumpfile.c_str());\n");
puts("__VlSymsp->__Vm_dumping = true;\n");
puts("}\n");