From 8d5e37a413a10d7fdd3269cf9c56558b8e7967d6 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 21 Jul 2012 20:33:24 -0400 Subject: [PATCH] Internals: Move trace check up. No functional change. --- src/V3LinkDot.cpp | 12 ++---------- src/V3LinkParse.cpp | 12 ++++++++++++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index c79c85ed4..35a2b5c24 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -848,16 +848,6 @@ private: m_modp = NULL; } } - virtual void visit(AstVar* nodep, AstNUser*) { - // We used modTrace before leveling, and we may now - // want to turn it off now that we know the levelizations - if (v3Global.opt.traceDepth() - && (m_modp->level()-1) > v3Global.opt.traceDepth()) { - m_modp->modTrace(false); - nodep->trace(false); - } - nodep->iterateChildren(*this); - } virtual void visit(AstPin* nodep, AstNUser*) { // Pin: Link to submodule's port // Deal with implicit definitions - do before Resolve visitor as may be referenced above declaration @@ -912,6 +902,8 @@ private: } virtual void visit(AstAssignAlias* nodep, AstNUser*) { // tran gates need implicit creation + // As VarRefs don't exist in forPrimary, sanity check + if (m_statep->forPrimary()) nodep->v3fatalSrc("Assign aliases unexpected pre-dot"); if (AstVarRef* forrefp = nodep->lhsp()->castVarRef()) { pinImplicitExprRecurse(forrefp); } diff --git a/src/V3LinkParse.cpp b/src/V3LinkParse.cpp index 9389e8d91..09d49650c 100644 --- a/src/V3LinkParse.cpp +++ b/src/V3LinkParse.cpp @@ -67,6 +67,7 @@ private: bool m_inAlways; // Inside an always bool m_inGenerate; // Inside a generate AstNodeModule* m_valueModp; // If set, move AstVar->valuep() initial values to this module + AstNodeModule* m_modp; // Current module // METHODS static int debug() { @@ -282,6 +283,14 @@ private: virtual void visit(AstVar* nodep, AstNUser*) { cleanFileline(nodep); + // We used modTrace before leveling, and we may now + // want to turn it off now that we know the levelizations + if (v3Global.opt.traceDepth() + && m_modp + && (m_modp->level()-1) > v3Global.opt.traceDepth()) { + m_modp->modTrace(false); + nodep->trace(false); + } m_varp = nodep; nodep->iterateChildren(*this); m_varp = NULL; @@ -420,8 +429,10 @@ private: cleanFileline(nodep); checkExpected(nodep); // So we detect node types we forgot to list here // + m_modp = nodep; m_valueModp = nodep; nodep->iterateChildren(*this); + m_modp = NULL; m_valueModp = NULL; } void visitIterateNoValueMod(AstNode* nodep) { @@ -463,6 +474,7 @@ public: m_exp = AstParseRefExp::PX_NONE; m_baseTextp = NULL; m_varp = NULL; + m_modp = NULL; m_inAlways = false; m_inGenerate = false; m_valueModp = NULL;