Internals: Avoid VM_COVERAGE ifdef in library to get closer to libverilated.a

This commit is contained in:
Wilson Snyder 2022-10-21 17:08:57 -04:00
parent 785c51dd0b
commit 9d02082801
2 changed files with 5 additions and 21 deletions

View File

@ -357,9 +357,6 @@ public:
void write(const char* filename) VL_MT_SAFE_EXCLUDES(m_mutex) {
Verilated::quiesce();
const VerilatedLockGuard lock{m_mutex};
#ifndef VM_COVERAGE
VL_FATAL_MT("", 0, "", "%Error: Called VerilatedCov::write when VM_COVERAGE disabled");
#endif
selftest();
std::ofstream os{filename};

View File

@ -35,22 +35,6 @@
class VerilatedCovImp;
//=============================================================================
/// Conditionally compile statements only when doing coverage (when
/// VM_COVERAGE is defined)
// clang-format off
#ifdef VM_COVERAGE
# define VL_IF_COVER(stmts) \
do { stmts; } while (false)
#else
# define VL_IF_COVER(stmts) \
do { \
if (false) { stmts; } \
} while (false)
#endif
// clang-format on
//=============================================================================
/// Insert a item for coverage analysis.
/// The first argument is a pointer to the count to be dumped.
@ -83,8 +67,11 @@ class VerilatedCovImp;
/// }
#define VL_COVER_INSERT(covcontextp, countp, ...) \
VL_IF_COVER(covcontextp->_inserti(countp); covcontextp->_insertf(__FILE__, __LINE__); \
covcontextp->_insertp("hier", name(), __VA_ARGS__))
do { \
covcontextp->_inserti(countp); \
covcontextp->_insertf(__FILE__, __LINE__); \
covcontextp->_insertp("hier", name(), __VA_ARGS__); \
} while (false)
//=============================================================================
// Convert VL_COVER_INSERT value arguments to strings, is \internal