From 9d020828013af6df8a1e741ea506a0e08ddd12d0 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Fri, 21 Oct 2022 17:08:57 -0400 Subject: [PATCH] Internals: Avoid VM_COVERAGE ifdef in library to get closer to libverilated.a --- include/verilated_cov.cpp | 3 --- include/verilated_cov.h | 23 +++++------------------ 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/include/verilated_cov.cpp b/include/verilated_cov.cpp index 89b7fb86d..c442bbae7 100644 --- a/include/verilated_cov.cpp +++ b/include/verilated_cov.cpp @@ -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}; diff --git a/include/verilated_cov.h b/include/verilated_cov.h index 4c3b1550d..4697c4f88 100644 --- a/include/verilated_cov.h +++ b/include/verilated_cov.h @@ -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