Internals: V3GenClk should scan CFunc internals only at the CCall

Signed-off-by: Wilson Snyder <wsnyder@wsnyder.org>
This commit is contained in:
John Coiner 2017-11-23 08:21:20 -05:00 committed by Wilson Snyder
parent 57c8590b21
commit 71b2eeef67

View File

@ -149,9 +149,10 @@ private:
AstUser1InUse m_inuser1; AstUser1InUse m_inuser1;
// STATE // STATE
AstActive* m_activep; // Inside activate statement AstActive* m_activep; // Inside activate statement
AstNodeAssign* m_assignp; // Inside assigndly statement AstCFunc* m_tracingCallp; // Currently tracing a call to this cfunc
AstNodeModule* m_topModp; // Top module AstNodeAssign* m_assignp; // Inside assigndly statement
AstNodeModule* m_topModp; // Top module
// VISITORS // VISITORS
virtual void visit(AstTopScope* nodep) { virtual void visit(AstTopScope* nodep) {
@ -173,8 +174,20 @@ private:
virtual void visit(AstCCall* nodep) { virtual void visit(AstCCall* nodep) {
nodep->iterateChildren(*this); nodep->iterateChildren(*this);
// Enter the function and trace it // Enter the function and trace it
m_tracingCallp = nodep->funcp();
nodep->funcp()->accept(*this); nodep->funcp()->accept(*this);
} }
virtual void visit(AstCFunc* nodep) {
if (m_tracingCallp != nodep) {
// Only consider logic within a CFunc when looking
// at the call to it, and not when scanning whatever
// scope it happens to live beneath.
return;
}
m_tracingCallp = NULL;
nodep->iterateChildren(*this);
}
//---- //----
virtual void visit(AstVarRef* nodep) { virtual void visit(AstVarRef* nodep) {
@ -213,11 +226,12 @@ private:
} }
public: public:
// CONSTRUCTORS // CONSTRUCTORS
explicit GenClkReadVisitor(AstNetlist* nodep) { explicit GenClkReadVisitor(AstNetlist* nodep)
m_activep = NULL; : m_activep(NULL)
m_assignp = NULL; , m_tracingCallp(NULL)
m_topModp = NULL; , m_assignp(NULL)
nodep->accept(*this); , m_topModp(NULL) {
nodep->accept(*this);
} }
virtual ~GenClkReadVisitor() {} virtual ~GenClkReadVisitor() {}
}; };