From 3a002b6cf25f27f97417d623ee0c55014fa6aae3 Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Tue, 19 Jul 2022 13:58:18 +0100 Subject: [PATCH] Remove VerilatedVcd::m_evcd and related dead code. The legacy code that was using this was removed earlier, and m_evcd was constant false, so removed. --- include/verilated_vcd_c.cpp | 50 +++++++++++++------------------------ include/verilated_vcd_c.h | 1 - 2 files changed, 18 insertions(+), 33 deletions(-) diff --git a/include/verilated_vcd_c.cpp b/include/verilated_vcd_c.cpp index 1f5595ed2..ee3a43583 100644 --- a/include/verilated_vcd_c.cpp +++ b/include/verilated_vcd_c.cpp @@ -261,11 +261,6 @@ void VerilatedVcd::close() VL_MT_SAFE_EXCLUDES(m_mutex) { // This function is on the flush() call path const VerilatedLockGuard lock{m_mutex}; if (!isOpen()) return; - if (m_evcd) { - printStr("$vcdclose "); - printQuad(timeLastDump()); - printStr(" $end\n"); - } closePrev(); // closePrev() called Super::flush(), so we just // need to shut down the tracing thread here. @@ -515,38 +510,29 @@ void VerilatedVcd::declare(uint32_t code, const char* name, const char* wirep, b // Print reference std::string decl = "$var "; - if (m_evcd) { - decl += "port"; - } else { - decl += wirep; // usually "wire" - } + decl += wirep; // usually "wire" constexpr size_t bufsize = 1000; char buf[bufsize]; VL_SNPRINTF(buf, bufsize, " %2d ", bits); decl += buf; - if (m_evcd) { - VL_SNPRINTF(buf, bufsize, "<%u", code); - decl += buf; - } else { - // Add string code to decl - char* const endp = writeCode(buf, code); - *endp = '\0'; - decl += buf; - // Build suffix array entry - char* const entryp = &m_suffixes[code * VL_TRACE_SUFFIX_ENTRY_SIZE]; - const size_t length = endp - buf; - assert(length <= VL_TRACE_MAX_VCD_CODE_SIZE); - // 1 bit values don't have a ' ' separator between value and string code - const bool isBit = bits == 1; - entryp[0] = ' '; // Separator - // Use memcpy as we checked size above, and strcpy is flagged unsafe - std::memcpy(entryp + !isBit, buf, - std::strlen(buf)); // Code (overwrite separator if isBit) - entryp[length + !isBit] = '\n'; // Replace '\0' with line termination '\n' - // Set length of suffix (used to increment write pointer) - entryp[VL_TRACE_SUFFIX_ENTRY_SIZE - 1] = !isBit + length + 1; - } + // Add string code to decl + char* const endp = writeCode(buf, code); + *endp = '\0'; + decl += buf; + // Build suffix array entry + char* const entryp = &m_suffixes[code * VL_TRACE_SUFFIX_ENTRY_SIZE]; + const size_t length = endp - buf; + assert(length <= VL_TRACE_MAX_VCD_CODE_SIZE); + // 1 bit values don't have a ' ' separator between value and string code + const bool isBit = bits == 1; + entryp[0] = ' '; // Separator + // Use memcpy as we checked size above, and strcpy is flagged unsafe + std::memcpy(entryp + !isBit, buf, + std::strlen(buf)); // Code (overwrite separator if isBit) + entryp[length + !isBit] = '\n'; // Replace '\0' with line termination '\n' + // Set length of suffix (used to increment write pointer) + entryp[VL_TRACE_SUFFIX_ENTRY_SIZE - 1] = !isBit + length + 1; decl += " "; decl += basename; if (array) { diff --git a/include/verilated_vcd_c.h b/include/verilated_vcd_c.h index 2a6316d10..bba0f4253 100644 --- a/include/verilated_vcd_c.h +++ b/include/verilated_vcd_c.h @@ -49,7 +49,6 @@ private: VerilatedVcdFile* m_filep; // File we're writing to bool m_fileNewed; // m_filep needs destruction bool m_isOpen = false; // True indicates open file - bool m_evcd = false; // True for evcd format std::string m_filename; // Filename we're writing to (if open) uint64_t m_rolloverMB = 0; // MB of file size to rollover at int m_modDepth = 0; // Depth of module hierarchy