From 09178e52171580b37c8841be8a6a0c8644bc2c2f Mon Sep 17 00:00:00 2001 From: Yutetsu TAKATSUKASA Date: Sun, 5 Jan 2020 07:51:10 +0900 Subject: [PATCH] add stats for packed variables. --- src/V3SplitVar.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/V3SplitVar.cpp b/src/V3SplitVar.cpp index 0fc2345dd..6ce4d7ce0 100644 --- a/src/V3SplitVar.cpp +++ b/src/V3SplitVar.cpp @@ -350,6 +350,7 @@ class SplitPackedVarVisitor : public AstNVisitor { AstNetlist* m_netp; AstNodeModule* m_modp; // current module (just for log) AstVar* m_lastVarp; // the most recently declared variable + int m_numSplit; // total number of split variable bool m_isLhs; // true when traversing LHS of assignment // key:variable to be split. value:location where the variable is referenced. vl_unordered_map m_refs; @@ -490,6 +491,7 @@ class SplitPackedVarVisitor : public AstNVisitor { UASSERT_OBJ(varit->msb() >= refit->msb(), varit->varp(), "Out of range"); } } + ++m_numSplit; } m_refs.clear(); // done } @@ -499,10 +501,14 @@ public: : m_netp(nodep) , m_modp(NULL) , m_lastVarp(NULL) + , m_numSplit(0) , m_isLhs(false) { iterate(nodep); } - ~SplitPackedVarVisitor() { UASSERT(m_refs.empty(), "Don't forget to call split()"); } + ~SplitPackedVarVisitor() { + UASSERT(m_refs.empty(), "Don't forget to call split()"); + V3Stats::addStat("SplitVar, Split Packed variables", m_numSplit); + } // Check if the passed variable can be split. // Even if this function returns true, the variable may not be split