Internals: Keep a ptr to _eval in AstNetlist, make it easier to find.
Signed-off-by: Wilson Snyder <wsnyder@wsnyder.org>
This commit is contained in:
parent
8f1798cc6f
commit
f0217edef1
|
|
@ -5471,13 +5471,19 @@ class AstNetlist : public AstNode {
|
|||
private:
|
||||
AstTypeTable* m_typeTablep; // Reference to top type table, for faster lookup
|
||||
AstPackage* m_dollarUnitPkgp;
|
||||
AstCFunc* m_evalp; // The '_eval' function
|
||||
public:
|
||||
AstNetlist() : AstNode(new FileLine("AstRoot",0)) {
|
||||
m_typeTablep = NULL;
|
||||
m_dollarUnitPkgp = NULL;
|
||||
}
|
||||
AstNetlist()
|
||||
: AstNode(new FileLine("AstRoot",0))
|
||||
, m_typeTablep(NULL)
|
||||
, m_dollarUnitPkgp(NULL)
|
||||
, m_evalp(NULL) { }
|
||||
ASTNODE_NODE_FUNCS(Netlist)
|
||||
virtual const char* broken() const { BROKEN_RTN(m_dollarUnitPkgp && !m_dollarUnitPkgp->brokeExists()); return NULL; }
|
||||
virtual const char* broken() const {
|
||||
BROKEN_RTN(m_dollarUnitPkgp && !m_dollarUnitPkgp->brokeExists());
|
||||
BROKEN_RTN(m_evalp && !m_evalp->brokeExists());
|
||||
return NULL;
|
||||
}
|
||||
AstNodeModule* modulesp() const { return op1p()->castNodeModule();} // op1 = List of modules
|
||||
AstNodeModule* topModulep() const { return op1p()->castNodeModule(); } // * = Top module in hierarchy (first one added, for now)
|
||||
void addModulep(AstNodeModule* modulep) { addOp1p(modulep); }
|
||||
|
|
@ -5497,6 +5503,8 @@ public:
|
|||
addModulep(m_dollarUnitPkgp);
|
||||
}
|
||||
return m_dollarUnitPkgp; }
|
||||
AstCFunc* evalp() const { return m_evalp; }
|
||||
void evalp(AstCFunc* evalp) { m_evalp = evalp; }
|
||||
};
|
||||
|
||||
//######################################################################
|
||||
|
|
|
|||
|
|
@ -394,6 +394,9 @@ public:
|
|||
m_scopep = NULL;
|
||||
//
|
||||
nodep->accept(*this);
|
||||
// Allow downstream modules to find _eval()
|
||||
// easily without iterating through the tree.
|
||||
nodep->evalp(m_evalFuncp);
|
||||
}
|
||||
virtual ~ClockVisitor() {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -90,19 +90,11 @@ private:
|
|||
virtual void visit(AstNodeModule* nodep) {
|
||||
allNodes(nodep);
|
||||
if (!m_fast) {
|
||||
nodep->iterateChildrenConst(*this);
|
||||
} else {
|
||||
for (AstNode* searchp = nodep->stmtsp(); searchp; searchp=searchp->nextp()) {
|
||||
if (AstCFunc* funcp = searchp->castCFunc()) {
|
||||
if (funcp->name() == "_eval") {
|
||||
m_instrs=0;
|
||||
m_counting = true;
|
||||
funcp->iterateChildrenConst(*this);
|
||||
m_counting = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Count all CFuncs below this module
|
||||
nodep->iterateChildrenConst(*this);
|
||||
}
|
||||
// Else we recursively trace fast CFuncs from the top _eval
|
||||
// func, see visit(AstNetlist*)
|
||||
}
|
||||
virtual void visit(AstVar* nodep) {
|
||||
allNodes(nodep);
|
||||
|
|
@ -213,6 +205,16 @@ private:
|
|||
allNodes(nodep);
|
||||
nodep->iterateChildrenConst(*this);
|
||||
}
|
||||
virtual void visit(AstNetlist* nodep) {
|
||||
if (m_fast && nodep->evalp()) {
|
||||
m_instrs = 0;
|
||||
m_counting = true;
|
||||
nodep->evalp()->iterateChildrenConst(*this);
|
||||
m_counting = false;
|
||||
}
|
||||
allNodes(nodep);
|
||||
nodep->iterateChildrenConst(*this);
|
||||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
StatsVisitor(AstNetlist* nodep, const string& stage, bool fast)
|
||||
|
|
|
|||
|
|
@ -625,7 +625,7 @@ private:
|
|||
V3GraphVertex* funcVtxp = getCFuncVertexp(nodep);
|
||||
if (!m_finding) { // If public, we need a unique activity code to allow for sets directly in this func
|
||||
if (nodep->funcPublic() || nodep->dpiExport()
|
||||
|| nodep->name() == "_eval") {
|
||||
|| nodep == v3Global.rootp()->evalp()) {
|
||||
// Need a non-null place to remember to later add a statement; make one
|
||||
if (!nodep->stmtsp()) nodep->addStmtsp(new AstComment(nodep->fileline(), "Tracing activity check"));
|
||||
V3GraphVertex* activityVtxp = getActivityVertexp(nodep->stmtsp(), nodep->slow());
|
||||
|
|
|
|||
Loading…
Reference in New Issue