From 8b2666cd048eacc4f69d264606aad8a1760c9b4f Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Sat, 11 Apr 2020 16:00:43 +0100 Subject: [PATCH] Fix to make trace code allocation dense. (#2250) This looks like a bits/bytes bug. The affected m_codeInc member determines how many 32-bit words to allocate in a buffer used to store previous values of the signal, but this was off by a factor of 8, so we used to use too much memory. SweRV VCD tracing speed +6.5% (excluding IO, clang 6.0), due mainly to reduced D cache misses. --- Changes | 4 ++-- src/V3AstNodes.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index cfa741af5..e49f180d7 100644 --- a/Changes +++ b/Changes @@ -15,11 +15,11 @@ The contributors that suggested a given feature are shown in []. Thanks! **** Add error if use SystemC 2.2 and earlier (pre-2011) as is deprecated. -**** Improve FST dump performance, #2244. [Geza Lore] +**** Improve FST dump performance, #2244, #2250. [Geza Lore] **** Fix build of fast path tracing code to use OPT_FAST, #2245. [Geza Lore] -**** Improve VCD dump performance, ##2246. [Geza Lore] +**** Improve VCD dump performance, #2246, #2250. [Geza Lore] * Verilator 4.032 2020-04-04 diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index 600c3779e..dc4b9d8b8 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -4227,7 +4227,7 @@ public: m_code = 0; m_codeInc = ((arrayRange.ranged() ? arrayRange.elements() : 1) * valuep->dtypep()->widthWords() - * (VL_EDATASIZE / sizeof(uint32_t))); // A code is always 32-bits + * (VL_EDATASIZE / (8*sizeof(uint32_t)))); // A code is always 32-bits m_varType = varp->varType(); m_declKwd = varp->declKwd(); m_declDirection = varp->declDirection();