Internals: Remove second argument to visitors. No functional change intended.
This commit is contained in:
parent
6d644dc764
commit
7efa40966a
|
|
@ -73,7 +73,7 @@ private:
|
||||||
m_scopep->addActivep(nodep);
|
m_scopep->addActivep(nodep);
|
||||||
}
|
}
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
m_scopep = nodep;
|
m_scopep = nodep;
|
||||||
m_iActivep = NULL;
|
m_iActivep = NULL;
|
||||||
m_cActivep = NULL;
|
m_cActivep = NULL;
|
||||||
|
|
@ -81,15 +81,15 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Don't clear scopep, the namer persists beyond this visit
|
// Don't clear scopep, the namer persists beyond this visit
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenTree* nodep, AstNUser*) {
|
virtual void visit(AstSenTree* nodep) {
|
||||||
// Simplify sensitivity list
|
// Simplify sensitivity list
|
||||||
V3Const::constifyExpensiveEdit(nodep); VL_DANGLING(nodep);
|
V3Const::constifyExpensiveEdit(nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
// Empty visitors, speed things up
|
// Empty visitors, speed things up
|
||||||
virtual void visit(AstNodeStmt* nodep, AstNUser*) { }
|
virtual void visit(AstNodeStmt* nodep) { }
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default
|
// Default
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
@ -169,7 +169,7 @@ private:
|
||||||
AstNode* m_alwaysp; // Always we're under
|
AstNode* m_alwaysp; // Always we're under
|
||||||
AstNode* m_assignp; // In assign
|
AstNode* m_assignp; // In assign
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstAssignDly* nodep, AstNUser*) {
|
virtual void visit(AstAssignDly* nodep) {
|
||||||
if (m_check != CT_SEQ) {
|
if (m_check != CT_SEQ) {
|
||||||
// Convert to a non-delayed assignment
|
// Convert to a non-delayed assignment
|
||||||
UINFO(5," ASSIGNDLY "<<nodep<<endl);
|
UINFO(5," ASSIGNDLY "<<nodep<<endl);
|
||||||
|
|
@ -187,7 +187,7 @@ private:
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssign* nodep, AstNUser*) {
|
virtual void visit(AstAssign* nodep) {
|
||||||
if (m_check == CT_SEQ) {
|
if (m_check == CT_SEQ) {
|
||||||
AstNode* las = m_assignp;
|
AstNode* las = m_assignp;
|
||||||
m_assignp = nodep;
|
m_assignp = nodep;
|
||||||
|
|
@ -195,7 +195,7 @@ private:
|
||||||
m_assignp = las;
|
m_assignp = las;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
AstVar* varp=nodep->varp();
|
AstVar* varp=nodep->varp();
|
||||||
if (m_check == CT_SEQ
|
if (m_check == CT_SEQ
|
||||||
&& m_assignp
|
&& m_assignp
|
||||||
|
|
@ -214,7 +214,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//--------------------
|
//--------------------
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -244,7 +244,7 @@ private:
|
||||||
bool m_itemSequent; // Found a SenItem sequential
|
bool m_itemSequent; // Found a SenItem sequential
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
// Create required actives and add to scope
|
// Create required actives and add to scope
|
||||||
UINFO(4," SCOPE "<<nodep<<endl);
|
UINFO(4," SCOPE "<<nodep<<endl);
|
||||||
// Clear last scope's names, and collect this scope's existing names
|
// Clear last scope's names, and collect this scope's existing names
|
||||||
|
|
@ -252,10 +252,10 @@ private:
|
||||||
m_scopeFinalp = NULL;
|
m_scopeFinalp = NULL;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstActive* nodep, AstNUser*) {
|
virtual void visit(AstActive* nodep) {
|
||||||
// Actives are being formed, so we can ignore any already made
|
// Actives are being formed, so we can ignore any already made
|
||||||
}
|
}
|
||||||
virtual void visit(AstInitial* nodep, AstNUser*) {
|
virtual void visit(AstInitial* nodep) {
|
||||||
// Relink to IACTIVE, unless already under it
|
// Relink to IACTIVE, unless already under it
|
||||||
UINFO(4," INITIAL "<<nodep<<endl);
|
UINFO(4," INITIAL "<<nodep<<endl);
|
||||||
ActiveDlyVisitor dlyvisitor (nodep, ActiveDlyVisitor::CT_INITIAL);
|
ActiveDlyVisitor dlyvisitor (nodep, ActiveDlyVisitor::CT_INITIAL);
|
||||||
|
|
@ -263,28 +263,28 @@ private:
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
wantactivep->addStmtsp(nodep);
|
wantactivep->addStmtsp(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignAlias* nodep, AstNUser*) {
|
virtual void visit(AstAssignAlias* nodep) {
|
||||||
// Relink to CACTIVE, unless already under it
|
// Relink to CACTIVE, unless already under it
|
||||||
UINFO(4," ASSIGNW "<<nodep<<endl);
|
UINFO(4," ASSIGNW "<<nodep<<endl);
|
||||||
AstActive* wantactivep = m_namer.getCActive(nodep->fileline());
|
AstActive* wantactivep = m_namer.getCActive(nodep->fileline());
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
wantactivep->addStmtsp(nodep);
|
wantactivep->addStmtsp(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignW* nodep, AstNUser*) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
// Relink to CACTIVE, unless already under it
|
// Relink to CACTIVE, unless already under it
|
||||||
UINFO(4," ASSIGNW "<<nodep<<endl);
|
UINFO(4," ASSIGNW "<<nodep<<endl);
|
||||||
AstActive* wantactivep = m_namer.getCActive(nodep->fileline());
|
AstActive* wantactivep = m_namer.getCActive(nodep->fileline());
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
wantactivep->addStmtsp(nodep);
|
wantactivep->addStmtsp(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCoverToggle* nodep, AstNUser*) {
|
virtual void visit(AstCoverToggle* nodep) {
|
||||||
// Relink to CACTIVE, unless already under it
|
// Relink to CACTIVE, unless already under it
|
||||||
UINFO(4," COVERTOGGLE "<<nodep<<endl);
|
UINFO(4," COVERTOGGLE "<<nodep<<endl);
|
||||||
AstActive* wantactivep = m_namer.getCActive(nodep->fileline());
|
AstActive* wantactivep = m_namer.getCActive(nodep->fileline());
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
wantactivep->addStmtsp(nodep);
|
wantactivep->addStmtsp(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstFinal* nodep, AstNUser*) {
|
virtual void visit(AstFinal* nodep) {
|
||||||
// Relink to CFUNC for the final
|
// Relink to CFUNC for the final
|
||||||
UINFO(4," FINAL "<<nodep<<endl);
|
UINFO(4," FINAL "<<nodep<<endl);
|
||||||
if (!nodep->bodysp()) { // Empty, Kill it.
|
if (!nodep->bodysp()) { // Empty, Kill it.
|
||||||
|
|
@ -370,7 +370,7 @@ private:
|
||||||
ActiveDlyVisitor dlyvisitor (nodep, ActiveDlyVisitor::CT_SEQ);
|
ActiveDlyVisitor dlyvisitor (nodep, ActiveDlyVisitor::CT_SEQ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
// Move always to appropriate ACTIVE based on its sense list
|
// Move always to appropriate ACTIVE based on its sense list
|
||||||
UINFO(4," ALW "<<nodep<<endl);
|
UINFO(4," ALW "<<nodep<<endl);
|
||||||
//if (debug()>=9) nodep->dumpTree(cout," Alw: ");
|
//if (debug()>=9) nodep->dumpTree(cout," Alw: ");
|
||||||
|
|
@ -382,13 +382,13 @@ private:
|
||||||
}
|
}
|
||||||
visitAlways(nodep, nodep->sensesp(), nodep->keyword());
|
visitAlways(nodep, nodep->sensesp(), nodep->keyword());
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlwaysPublic* nodep, AstNUser*) {
|
virtual void visit(AstAlwaysPublic* nodep) {
|
||||||
// Move always to appropriate ACTIVE based on its sense list
|
// Move always to appropriate ACTIVE based on its sense list
|
||||||
UINFO(4," ALWPub "<<nodep<<endl);
|
UINFO(4," ALWPub "<<nodep<<endl);
|
||||||
//if (debug()>=9) nodep->dumpTree(cout," Alw: ");
|
//if (debug()>=9) nodep->dumpTree(cout," Alw: ");
|
||||||
visitAlways(nodep, nodep->sensesp(), VAlwaysKwd::ALWAYS);
|
visitAlways(nodep, nodep->sensesp(), VAlwaysKwd::ALWAYS);
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenGate* nodep, AstNUser*) {
|
virtual void visit(AstSenGate* nodep) {
|
||||||
AstSenItem* subitemp = nodep->sensesp();
|
AstSenItem* subitemp = nodep->sensesp();
|
||||||
if (subitemp->edgeType() != AstEdgeType::ET_ANYEDGE
|
if (subitemp->edgeType() != AstEdgeType::ET_ANYEDGE
|
||||||
&& subitemp->edgeType() != AstEdgeType::ET_POSEDGE
|
&& subitemp->edgeType() != AstEdgeType::ET_POSEDGE
|
||||||
|
|
@ -397,7 +397,7 @@ private:
|
||||||
}
|
}
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenItem* nodep, AstNUser*) {
|
virtual void visit(AstSenItem* nodep) {
|
||||||
if (nodep->edgeType() == AstEdgeType::ET_ANYEDGE) {
|
if (nodep->edgeType() == AstEdgeType::ET_ANYEDGE) {
|
||||||
m_itemCombo = true;
|
m_itemCombo = true;
|
||||||
// Delete the sensitivity
|
// Delete the sensitivity
|
||||||
|
|
@ -413,10 +413,10 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty visitors, speed things up
|
// Empty visitors, speed things up
|
||||||
virtual void visit(AstNodeMath* nodep, AstNUser*) {}
|
virtual void visit(AstNodeMath* nodep) {}
|
||||||
virtual void visit(AstVarScope* nodep, AstNUser*) {}
|
virtual void visit(AstVarScope* nodep) {}
|
||||||
//--------------------
|
//--------------------
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -65,19 +65,19 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstTopScope* nodep, AstNUser*) {
|
virtual void visit(AstTopScope* nodep) {
|
||||||
m_topscopep = nodep;
|
m_topscopep = nodep;
|
||||||
m_finder.main(m_topscopep);
|
m_finder.main(m_topscopep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_topscopep = NULL;
|
m_topscopep = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
// Create required actives and add to module
|
// Create required actives and add to module
|
||||||
// We can start ordering at a module, or a scope
|
// We can start ordering at a module, or a scope
|
||||||
UINFO(4," MOD "<<nodep<<endl);
|
UINFO(4," MOD "<<nodep<<endl);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstActive* nodep, AstNUser*) {
|
virtual void visit(AstActive* nodep) {
|
||||||
UINFO(4," ACTIVE "<<nodep<<endl);
|
UINFO(4," ACTIVE "<<nodep<<endl);
|
||||||
V3Const::constifyExpensiveEdit(nodep); // Remove duplicate clocks and such; sensesp() may change!
|
V3Const::constifyExpensiveEdit(nodep); // Remove duplicate clocks and such; sensesp() may change!
|
||||||
AstSenTree* sensesp = nodep->sensesp();
|
AstSenTree* sensesp = nodep->sensesp();
|
||||||
|
|
@ -120,29 +120,29 @@ private:
|
||||||
// No need to do statements under it, they're already moved.
|
// No need to do statements under it, they're already moved.
|
||||||
//nodep->iterateChildren(*this);
|
//nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstInitial* nodep, AstNUser*) {
|
virtual void visit(AstInitial* nodep) {
|
||||||
nodep->v3fatalSrc("Node should have been under ACTIVE");
|
nodep->v3fatalSrc("Node should have been under ACTIVE");
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignAlias* nodep, AstNUser*) {
|
virtual void visit(AstAssignAlias* nodep) {
|
||||||
nodep->v3fatalSrc("Node should have been under ACTIVE");
|
nodep->v3fatalSrc("Node should have been under ACTIVE");
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignW* nodep, AstNUser*) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
nodep->v3fatalSrc("Node should have been under ACTIVE");
|
nodep->v3fatalSrc("Node should have been under ACTIVE");
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
nodep->v3fatalSrc("Node should have been under ACTIVE");
|
nodep->v3fatalSrc("Node should have been under ACTIVE");
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlwaysPublic* nodep, AstNUser*) {
|
virtual void visit(AstAlwaysPublic* nodep) {
|
||||||
nodep->v3fatalSrc("Node should have been under ACTIVE");
|
nodep->v3fatalSrc("Node should have been under ACTIVE");
|
||||||
}
|
}
|
||||||
virtual void visit(AstFinal* nodep, AstNUser*) {
|
virtual void visit(AstFinal* nodep) {
|
||||||
nodep->v3fatalSrc("Node should have been deleted");
|
nodep->v3fatalSrc("Node should have been deleted");
|
||||||
}
|
}
|
||||||
// Empty visitors, speed things up
|
// Empty visitors, speed things up
|
||||||
virtual void visit(AstNodeMath* nodep, AstNUser*) {}
|
virtual void visit(AstNodeMath* nodep) {}
|
||||||
virtual void visit(AstVarScope* nodep, AstNUser*) {}
|
virtual void visit(AstVarScope* nodep) {}
|
||||||
//--------------------
|
//--------------------
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ private:
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstIf* nodep, AstNUser*) {
|
virtual void visit(AstIf* nodep) {
|
||||||
if (nodep->user1SetOnce()) return;
|
if (nodep->user1SetOnce()) return;
|
||||||
if (nodep->uniquePragma() || nodep->unique0Pragma()) {
|
if (nodep->uniquePragma() || nodep->unique0Pragma()) {
|
||||||
AstNodeIf* ifp = nodep;
|
AstNodeIf* ifp = nodep;
|
||||||
|
|
@ -220,7 +220,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS //========== Case assertions
|
// VISITORS //========== Case assertions
|
||||||
virtual void visit(AstCase* nodep, AstNUser*) {
|
virtual void visit(AstCase* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (!nodep->user1SetOnce()) {
|
if (!nodep->user1SetOnce()) {
|
||||||
bool has_default=false;
|
bool has_default=false;
|
||||||
|
|
@ -268,7 +268,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS //========== Statements
|
// VISITORS //========== Statements
|
||||||
virtual void visit(AstDisplay* nodep, AstNUser*) {
|
virtual void visit(AstDisplay* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Replace the special types with standard text
|
// Replace the special types with standard text
|
||||||
if (nodep->displayType()==AstDisplayType::DT_INFO) {
|
if (nodep->displayType()==AstDisplayType::DT_INFO) {
|
||||||
|
|
@ -281,27 +281,27 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstPslCover* nodep, AstNUser*) {
|
virtual void visit(AstPslCover* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_beginp && nodep->name() == "") nodep->name(m_beginp->name());
|
if (m_beginp && nodep->name() == "") nodep->name(m_beginp->name());
|
||||||
newPslAssertion(nodep, nodep->propp(), nodep->sentreep(),
|
newPslAssertion(nodep, nodep->propp(), nodep->sentreep(),
|
||||||
nodep->stmtsp(), nodep->name()); VL_DANGLING(nodep);
|
nodep->stmtsp(), nodep->name()); VL_DANGLING(nodep);
|
||||||
++m_statAsCover;
|
++m_statAsCover;
|
||||||
}
|
}
|
||||||
virtual void visit(AstVAssert* nodep, AstNUser*) {
|
virtual void visit(AstVAssert* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
newVAssertion(nodep, nodep->propp()); VL_DANGLING(nodep);
|
newVAssertion(nodep, nodep->propp()); VL_DANGLING(nodep);
|
||||||
++m_statAsSV;
|
++m_statAsSV;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
//
|
//
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Reset defaults
|
// Reset defaults
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstBegin* nodep, AstNUser*) {
|
virtual void visit(AstBegin* nodep) {
|
||||||
// This code is needed rather than a visitor in V3Begin,
|
// This code is needed rather than a visitor in V3Begin,
|
||||||
// because V3Assert is called before V3Begin
|
// because V3Assert is called before V3Begin
|
||||||
AstBegin* lastp = m_beginp;
|
AstBegin* lastp = m_beginp;
|
||||||
|
|
@ -312,7 +312,7 @@ private:
|
||||||
m_beginp = lastp;
|
m_beginp = lastp;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS //========== Statements
|
// VISITORS //========== Statements
|
||||||
virtual void visit(AstClocking* nodep, AstNUser*) {
|
virtual void visit(AstClocking* nodep) {
|
||||||
UINFO(8," CLOCKING"<<nodep<<endl);
|
UINFO(8," CLOCKING"<<nodep<<endl);
|
||||||
// Store the new default clock, reset on new module
|
// Store the new default clock, reset on new module
|
||||||
m_seniDefaultp = nodep->sensesp();
|
m_seniDefaultp = nodep->sensesp();
|
||||||
|
|
@ -86,14 +86,14 @@ private:
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstPslCover* nodep, AstNUser*) {
|
virtual void visit(AstPslCover* nodep) {
|
||||||
if (nodep->sentreep()) return; // Already processed
|
if (nodep->sentreep()) return; // Already processed
|
||||||
clearAssertInfo();
|
clearAssertInfo();
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
nodep->sentreep(newSenTree(nodep));
|
nodep->sentreep(newSenTree(nodep));
|
||||||
clearAssertInfo();
|
clearAssertInfo();
|
||||||
}
|
}
|
||||||
virtual void visit(AstPslClocked* nodep, AstNUser*) {
|
virtual void visit(AstPslClocked* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_senip) {
|
if (m_senip) {
|
||||||
nodep->v3error("Unsupported: Only one PSL clock allowed per assertion");
|
nodep->v3error("Unsupported: Only one PSL clock allowed per assertion");
|
||||||
|
|
@ -111,12 +111,12 @@ private:
|
||||||
nodep->replaceWith(blockp);
|
nodep->replaceWith(blockp);
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Reset defaults
|
// Reset defaults
|
||||||
m_seniDefaultp = NULL;
|
m_seniDefaultp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -732,31 +732,31 @@ void AstNode::operator delete(void* objp, size_t size) {
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// Iterators
|
// Iterators
|
||||||
|
|
||||||
void AstNode::iterateChildren(AstNVisitor& v, AstNUser* vup) {
|
void AstNode::iterateChildren(AstNVisitor& v) {
|
||||||
// This is a very hot function
|
// This is a very hot function
|
||||||
ASTNODE_PREFETCH(m_op1p);
|
ASTNODE_PREFETCH(m_op1p);
|
||||||
ASTNODE_PREFETCH(m_op2p);
|
ASTNODE_PREFETCH(m_op2p);
|
||||||
ASTNODE_PREFETCH(m_op3p);
|
ASTNODE_PREFETCH(m_op3p);
|
||||||
ASTNODE_PREFETCH(m_op4p);
|
ASTNODE_PREFETCH(m_op4p);
|
||||||
if (m_op1p) m_op1p->iterateAndNext(v, vup);
|
if (m_op1p) m_op1p->iterateAndNext(v);
|
||||||
if (m_op2p) m_op2p->iterateAndNext(v, vup);
|
if (m_op2p) m_op2p->iterateAndNext(v);
|
||||||
if (m_op3p) m_op3p->iterateAndNext(v, vup);
|
if (m_op3p) m_op3p->iterateAndNext(v);
|
||||||
if (m_op4p) m_op4p->iterateAndNext(v, vup);
|
if (m_op4p) m_op4p->iterateAndNext(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AstNode::iterateChildrenConst(AstNVisitor& v, AstNUser* vup) {
|
void AstNode::iterateChildrenConst(AstNVisitor& v) {
|
||||||
// This is a very hot function
|
// This is a very hot function
|
||||||
ASTNODE_PREFETCH(m_op1p);
|
ASTNODE_PREFETCH(m_op1p);
|
||||||
ASTNODE_PREFETCH(m_op2p);
|
ASTNODE_PREFETCH(m_op2p);
|
||||||
ASTNODE_PREFETCH(m_op3p);
|
ASTNODE_PREFETCH(m_op3p);
|
||||||
ASTNODE_PREFETCH(m_op4p);
|
ASTNODE_PREFETCH(m_op4p);
|
||||||
if (m_op1p) m_op1p->iterateAndNextConst(v, vup);
|
if (m_op1p) m_op1p->iterateAndNextConst(v);
|
||||||
if (m_op2p) m_op2p->iterateAndNextConst(v, vup);
|
if (m_op2p) m_op2p->iterateAndNextConst(v);
|
||||||
if (m_op3p) m_op3p->iterateAndNextConst(v, vup);
|
if (m_op3p) m_op3p->iterateAndNextConst(v);
|
||||||
if (m_op4p) m_op4p->iterateAndNextConst(v, vup);
|
if (m_op4p) m_op4p->iterateAndNextConst(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AstNode::iterateAndNext(AstNVisitor& v, AstNUser* vup) {
|
void AstNode::iterateAndNext(AstNVisitor& v) {
|
||||||
// This is a very hot function
|
// This is a very hot function
|
||||||
// IMPORTANT: If you replace a node that's the target of this iterator,
|
// IMPORTANT: If you replace a node that's the target of this iterator,
|
||||||
// then the NEW node will be iterated on next, it isn't skipped!
|
// then the NEW node will be iterated on next, it isn't skipped!
|
||||||
|
|
@ -773,7 +773,7 @@ void AstNode::iterateAndNext(AstNVisitor& v, AstNUser* vup) {
|
||||||
//if (VL_UNLIKELY(niterp->m_iterpp)) niterp->v3fatalSrc("IterateAndNext under iterateAndNext may miss edits");
|
//if (VL_UNLIKELY(niterp->m_iterpp)) niterp->v3fatalSrc("IterateAndNext under iterateAndNext may miss edits");
|
||||||
// cppcheck-suppress nullPointer
|
// cppcheck-suppress nullPointer
|
||||||
niterp->m_iterpp = &niterp;
|
niterp->m_iterpp = &niterp;
|
||||||
niterp->accept(v, vup);
|
niterp->accept(v);
|
||||||
// accept may do a replaceNode and change niterp on us...
|
// accept may do a replaceNode and change niterp on us...
|
||||||
//if (niterp != nodep) UINFO(1,"iterateAndNext edited "<<(void*)nodep<<" now into "<<(void*)niterp<<endl); // niterp maybe NULL, so need cast
|
//if (niterp != nodep) UINFO(1,"iterateAndNext edited "<<(void*)nodep<<" now into "<<(void*)niterp<<endl); // niterp maybe NULL, so need cast
|
||||||
if (!niterp) return; // Perhaps node deleted inside accept
|
if (!niterp) return; // Perhaps node deleted inside accept
|
||||||
|
|
@ -786,37 +786,37 @@ void AstNode::iterateAndNext(AstNVisitor& v, AstNUser* vup) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AstNode::iterateListBackwards(AstNVisitor& v, AstNUser* vup) {
|
void AstNode::iterateListBackwards(AstNVisitor& v) {
|
||||||
UDEBUGONLY(UASSERT(dynamic_cast<AstNode*>(this),"this should not be NULL"););
|
UDEBUGONLY(UASSERT(dynamic_cast<AstNode*>(this),"this should not be NULL"););
|
||||||
AstNode* nodep=this;
|
AstNode* nodep=this;
|
||||||
while (nodep->m_nextp) nodep=nodep->m_nextp;
|
while (nodep->m_nextp) nodep=nodep->m_nextp;
|
||||||
while (nodep) {
|
while (nodep) {
|
||||||
// Edits not supported: nodep->m_iterpp = &nodep;
|
// Edits not supported: nodep->m_iterpp = &nodep;
|
||||||
nodep->accept(v, vup);
|
nodep->accept(v);
|
||||||
if (nodep->backp()->m_nextp == nodep) nodep=nodep->backp();
|
if (nodep->backp()->m_nextp == nodep) nodep=nodep->backp();
|
||||||
else nodep = NULL; // else: backp points up the tree.
|
else nodep = NULL; // else: backp points up the tree.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AstNode::iterateChildrenBackwards(AstNVisitor& v, AstNUser* vup) {
|
void AstNode::iterateChildrenBackwards(AstNVisitor& v) {
|
||||||
if (m_op1p) m_op1p->iterateListBackwards(v,vup);
|
if (m_op1p) m_op1p->iterateListBackwards(v);
|
||||||
if (m_op2p) m_op2p->iterateListBackwards(v,vup);
|
if (m_op2p) m_op2p->iterateListBackwards(v);
|
||||||
if (m_op3p) m_op3p->iterateListBackwards(v,vup);
|
if (m_op3p) m_op3p->iterateListBackwards(v);
|
||||||
if (m_op4p) m_op4p->iterateListBackwards(v,vup);
|
if (m_op4p) m_op4p->iterateListBackwards(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AstNode::iterateAndNextConst(AstNVisitor& v, AstNUser* vup) {
|
void AstNode::iterateAndNextConst(AstNVisitor& v) {
|
||||||
// Keep following the current list even if edits change it
|
// Keep following the current list even if edits change it
|
||||||
if (!this) return; // A few cases could be cleaned up, but want symmetry with iterateAndNext
|
if (!this) return; // A few cases could be cleaned up, but want symmetry with iterateAndNext
|
||||||
for (AstNode* nodep=this; nodep; ) { // effectively: if (!this) return; // Callers rely on this
|
for (AstNode* nodep=this; nodep; ) { // effectively: if (!this) return; // Callers rely on this
|
||||||
AstNode* nnextp = nodep->m_nextp;
|
AstNode* nnextp = nodep->m_nextp;
|
||||||
ASTNODE_PREFETCH(nnextp);
|
ASTNODE_PREFETCH(nnextp);
|
||||||
nodep->accept(v, vup);
|
nodep->accept(v);
|
||||||
nodep = nnextp;
|
nodep = nnextp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AstNode* AstNode::iterateSubtreeReturnEdits(AstNVisitor& v, AstNUser* vup) {
|
AstNode* AstNode::iterateSubtreeReturnEdits(AstNVisitor& v) {
|
||||||
// Some visitors perform tree edits (such as V3Const), and may even
|
// Some visitors perform tree edits (such as V3Const), and may even
|
||||||
// replace/delete the exact nodep that the visitor is called with. If
|
// replace/delete the exact nodep that the visitor is called with. If
|
||||||
// this happens, the parent will lose the handle to the node that was
|
// this happens, the parent will lose the handle to the node that was
|
||||||
|
|
@ -826,12 +826,12 @@ AstNode* AstNode::iterateSubtreeReturnEdits(AstNVisitor& v, AstNUser* vup) {
|
||||||
AstNode* nodep = this; // Note "this" may point to bogus point later in this function
|
AstNode* nodep = this; // Note "this" may point to bogus point later in this function
|
||||||
if (nodep->castNetlist()) {
|
if (nodep->castNetlist()) {
|
||||||
// Calling on top level; we know the netlist won't get replaced
|
// Calling on top level; we know the netlist won't get replaced
|
||||||
nodep->accept(v, vup);
|
nodep->accept(v);
|
||||||
} else if (!nodep->backp()) {
|
} else if (!nodep->backp()) {
|
||||||
// Calling on standalone tree; insert a shim node so we can keep track, then delete it on completion
|
// Calling on standalone tree; insert a shim node so we can keep track, then delete it on completion
|
||||||
AstBegin* tempp = new AstBegin(nodep->fileline(),"[EditWrapper]",nodep);
|
AstBegin* tempp = new AstBegin(nodep->fileline(),"[EditWrapper]",nodep);
|
||||||
{
|
{
|
||||||
tempp->stmtsp()->accept(v, vup); VL_DANGLING(nodep); // nodep to null as may be replaced
|
tempp->stmtsp()->accept(v); VL_DANGLING(nodep); // nodep to null as may be replaced
|
||||||
}
|
}
|
||||||
nodep = tempp->stmtsp()->unlinkFrBackWithNext();
|
nodep = tempp->stmtsp()->unlinkFrBackWithNext();
|
||||||
tempp->deleteTree(); VL_DANGLING(tempp);
|
tempp->deleteTree(); VL_DANGLING(tempp);
|
||||||
|
|
@ -845,7 +845,7 @@ AstNode* AstNode::iterateSubtreeReturnEdits(AstNVisitor& v, AstNUser* vup) {
|
||||||
else if (this->m_backp->m_nextp == this) nextnodepp = &(this->m_backp->m_nextp);
|
else if (this->m_backp->m_nextp == this) nextnodepp = &(this->m_backp->m_nextp);
|
||||||
if (!nextnodepp) this->v3fatalSrc("Node's back doesn't point to forward to node itself");
|
if (!nextnodepp) this->v3fatalSrc("Node's back doesn't point to forward to node itself");
|
||||||
{
|
{
|
||||||
nodep->accept(v, vup); VL_DANGLING(nodep); // nodep to null as may be replaced
|
nodep->accept(v); VL_DANGLING(nodep); // nodep to null as may be replaced
|
||||||
}
|
}
|
||||||
nodep = *nextnodepp; // Grab new node from point where old was connected
|
nodep = *nextnodepp; // Grab new node from point where old was connected
|
||||||
}
|
}
|
||||||
|
|
|
||||||
26
src/V3Ast.h
26
src/V3Ast.h
|
|
@ -862,8 +862,8 @@ public:
|
||||||
}
|
}
|
||||||
#include "V3Ast__gen_visitor.h" // From ./astgen
|
#include "V3Ast__gen_visitor.h" // From ./astgen
|
||||||
// Things like:
|
// Things like:
|
||||||
// virtual void visit(AstBreak* nodep, AstNUser* vup) { visit((AstNodeStmt*)(nodep),vup); }
|
// virtual void visit(AstBreak* nodep) { visit((AstNodeStmt*)(nodep)); }
|
||||||
// virtual void visit(AstNodeStmt* nodep, AstNUser* vup) { visit((AstNode*)(nodep),vup); }
|
// virtual void visit(AstNodeStmt* nodep) { visit((AstNode*)(nodep)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
|
|
@ -993,7 +993,7 @@ class AstNode {
|
||||||
void op4p(AstNode* nodep) { m_op4p = nodep; if (nodep) nodep->m_backp = this; }
|
void op4p(AstNode* nodep) { m_op4p = nodep; if (nodep) nodep->m_backp = this; }
|
||||||
|
|
||||||
void init(); // initialize value of AstNode
|
void init(); // initialize value of AstNode
|
||||||
void iterateListBackwards(AstNVisitor& v, AstNUser* vup=NULL);
|
void iterateListBackwards(AstNVisitor& v);
|
||||||
private:
|
private:
|
||||||
AstNode* cloneTreeIter();
|
AstNode* cloneTreeIter();
|
||||||
AstNode* cloneTreeIterList();
|
AstNode* cloneTreeIterList();
|
||||||
|
|
@ -1265,14 +1265,14 @@ public:
|
||||||
virtual const char* broken() const { return NULL; }
|
virtual const char* broken() const { return NULL; }
|
||||||
|
|
||||||
// INVOKERS
|
// INVOKERS
|
||||||
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) = 0;
|
virtual void accept(AstNVisitor& v) = 0;
|
||||||
void iterate(AstNVisitor& v, AstNUser* vup=NULL) { this->accept(v,vup); } // Does this; excludes following this->next
|
void iterate(AstNVisitor& v) { this->accept(v); } // Does this; excludes following this->next
|
||||||
void iterateAndNext(AstNVisitor& v, AstNUser* vup=NULL);
|
void iterateAndNext(AstNVisitor& v);
|
||||||
void iterateAndNextConst(AstNVisitor& v, AstNUser* vup=NULL);
|
void iterateAndNextConst(AstNVisitor& v);
|
||||||
void iterateChildren(AstNVisitor& v, AstNUser* vup=NULL); // Excludes following this->next
|
void iterateChildren(AstNVisitor& v); // Excludes following this->next
|
||||||
void iterateChildrenBackwards(AstNVisitor& v, AstNUser* vup=NULL); // Excludes following this->next
|
void iterateChildrenBackwards(AstNVisitor& v); // Excludes following this->next
|
||||||
void iterateChildrenConst(AstNVisitor& v, AstNUser* vup=NULL); // Excludes following this->next
|
void iterateChildrenConst(AstNVisitor& v); // Excludes following this->next
|
||||||
AstNode* iterateSubtreeReturnEdits(AstNVisitor& v, AstNUser* vup=NULL); // Return edited nodep; see comments in V3Ast.cpp
|
AstNode* iterateSubtreeReturnEdits(AstNVisitor& v); // Return edited nodep; see comments in V3Ast.cpp
|
||||||
|
|
||||||
// CONVERSION
|
// CONVERSION
|
||||||
#include "V3Ast__gen_interface.h" // From ./astgen
|
#include "V3Ast__gen_interface.h" // From ./astgen
|
||||||
|
|
@ -1318,7 +1318,7 @@ public:
|
||||||
// Know no children, and hot function, so skip iterator for speed
|
// Know no children, and hot function, so skip iterator for speed
|
||||||
// See checkTreeIter also that asserts no children
|
// See checkTreeIter also that asserts no children
|
||||||
// cppcheck-suppress functionConst
|
// cppcheck-suppress functionConst
|
||||||
void iterateChildren(AstNVisitor& v, AstNUser* vup=NULL) { }
|
void iterateChildren(AstNVisitor& v) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class AstNodeUniop : public AstNodeMath {
|
class AstNodeUniop : public AstNodeMath {
|
||||||
|
|
@ -1602,7 +1602,7 @@ public:
|
||||||
// Know no children, and hot function, so skip iterator for speed
|
// Know no children, and hot function, so skip iterator for speed
|
||||||
// See checkTreeIter also that asserts no children
|
// See checkTreeIter also that asserts no children
|
||||||
// cppcheck-suppress functionConst
|
// cppcheck-suppress functionConst
|
||||||
void iterateChildren(AstNVisitor& v, AstNUser* vup=NULL) { }
|
void iterateChildren(AstNVisitor& v) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class AstNodeText : public AstNode {
|
class AstNodeText : public AstNode {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
virtual ~Ast ##name() {} \
|
virtual ~Ast ##name() {} \
|
||||||
virtual AstType type() const { return AstType::at ## name; } \
|
virtual AstType type() const { return AstType::at ## name; } \
|
||||||
virtual AstNode* clone() { return new Ast ##name (*this); } \
|
virtual AstNode* clone() { return new Ast ##name (*this); } \
|
||||||
virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); } \
|
virtual void accept(AstNVisitor& v) { v.visit(this); } \
|
||||||
Ast ##name * cloneTree(bool cloneNext) { return static_cast<Ast ##name *>(AstNode::cloneTree(cloneNext)); } \
|
Ast ##name * cloneTree(bool cloneNext) { return static_cast<Ast ##name *>(AstNode::cloneTree(cloneNext)); } \
|
||||||
Ast ##name * clonep() const { return static_cast<Ast ##name *>(AstNode::clonep()); }
|
Ast ##name * clonep() const { return static_cast<Ast ##name *>(AstNode::clonep()); }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,13 +84,13 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
m_repeatNum = 0;
|
m_repeatNum = 0;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
UINFO(8," "<<nodep<<endl);
|
UINFO(8," "<<nodep<<endl);
|
||||||
// Rename it
|
// Rename it
|
||||||
if (m_unnamedScope != "") {
|
if (m_unnamedScope != "") {
|
||||||
|
|
@ -113,7 +113,7 @@ private:
|
||||||
m_namedScope = oldScope;
|
m_namedScope = oldScope;
|
||||||
m_unnamedScope = oldUnnamed;
|
m_unnamedScope = oldUnnamed;
|
||||||
}
|
}
|
||||||
virtual void visit(AstBegin* nodep, AstNUser*) {
|
virtual void visit(AstBegin* nodep) {
|
||||||
// Begin blocks were only useful in variable creation, change names and delete
|
// Begin blocks were only useful in variable creation, change names and delete
|
||||||
UINFO(8," "<<nodep<<endl);
|
UINFO(8," "<<nodep<<endl);
|
||||||
string oldScope = m_namedScope;
|
string oldScope = m_namedScope;
|
||||||
|
|
@ -162,7 +162,7 @@ private:
|
||||||
}
|
}
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
if (m_unnamedScope != "") {
|
if (m_unnamedScope != "") {
|
||||||
// Rename it
|
// Rename it
|
||||||
nodep->name(m_unnamedScope+"__DOT__"+nodep->name());
|
nodep->name(m_unnamedScope+"__DOT__"+nodep->name());
|
||||||
|
|
@ -173,7 +173,7 @@ private:
|
||||||
else m_modp->addStmtp(nodep);
|
else m_modp->addStmtp(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
UINFO(8," CELL "<<nodep<<endl);
|
UINFO(8," CELL "<<nodep<<endl);
|
||||||
if (m_namedScope != "") {
|
if (m_namedScope != "") {
|
||||||
m_statep->userMarkChanged(nodep);
|
m_statep->userMarkChanged(nodep);
|
||||||
|
|
@ -186,14 +186,14 @@ private:
|
||||||
}
|
}
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarXRef* nodep, AstNUser*) {
|
virtual void visit(AstVarXRef* nodep) {
|
||||||
UINFO(9, " VARXREF "<<nodep<<endl);
|
UINFO(9, " VARXREF "<<nodep<<endl);
|
||||||
if (m_namedScope != "" && nodep->inlinedDots() == "") {
|
if (m_namedScope != "" && nodep->inlinedDots() == "") {
|
||||||
nodep->inlinedDots(m_namedScope);
|
nodep->inlinedDots(m_namedScope);
|
||||||
UINFO(9, " rescope to "<<nodep<<endl);
|
UINFO(9, " rescope to "<<nodep<<endl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstScopeName* nodep, AstNUser*) {
|
virtual void visit(AstScopeName* nodep) {
|
||||||
// If there's a %m in the display text, we add a special node that will contain the name()
|
// If there's a %m in the display text, we add a special node that will contain the name()
|
||||||
// Similar code in V3Inline
|
// Similar code in V3Inline
|
||||||
if (nodep->user1SetOnce()) return; // Don't double-add text's
|
if (nodep->user1SetOnce()) return; // Don't double-add text's
|
||||||
|
|
@ -206,13 +206,13 @@ private:
|
||||||
}
|
}
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCoverDecl* nodep, AstNUser*) {
|
virtual void visit(AstCoverDecl* nodep) {
|
||||||
// Don't need to fix path in coverage statements, they're not under
|
// Don't need to fix path in coverage statements, they're not under
|
||||||
// any BEGINs, but V3Coverage adds them all under the module itself.
|
// any BEGINs, but V3Coverage adds them all under the module itself.
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
// VISITORS - LINT CHECK
|
// VISITORS - LINT CHECK
|
||||||
virtual void visit(AstIf* nodep, AstNUser*) { // Note not AstNodeIf; other types don't get covered
|
virtual void visit(AstIf* nodep) { // Note not AstNodeIf; other types don't get covered
|
||||||
// Check IFDEPTH warning - could be in other transform files if desire
|
// Check IFDEPTH warning - could be in other transform files if desire
|
||||||
int prevIfDepth = m_ifDepth;
|
int prevIfDepth = m_ifDepth;
|
||||||
if (m_ifDepth == -1 || v3Global.opt.ifDepth()<1) { // Turned off
|
if (m_ifDepth == -1 || v3Global.opt.ifDepth()<1) { // Turned off
|
||||||
|
|
@ -226,7 +226,7 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_ifDepth = prevIfDepth;
|
m_ifDepth = prevIfDepth;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -252,21 +252,21 @@ private:
|
||||||
// AstNodeFTask::user1p // Node replaced, rename it
|
// AstNodeFTask::user1p // Node replaced, rename it
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||||
if (nodep->taskp()->user1()) { // It was converted
|
if (nodep->taskp()->user1()) { // It was converted
|
||||||
UINFO(9, " relinkFTask "<<nodep<<endl);
|
UINFO(9, " relinkFTask "<<nodep<<endl);
|
||||||
nodep->name(nodep->taskp()->name());
|
nodep->name(nodep->taskp()->name());
|
||||||
}
|
}
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (nodep->varp()->user1()) { // It was converted
|
if (nodep->varp()->user1()) { // It was converted
|
||||||
UINFO(9, " relinVarRef "<<nodep<<endl);
|
UINFO(9, " relinVarRef "<<nodep<<endl);
|
||||||
nodep->name(nodep->varp()->name());
|
nodep->name(nodep->varp()->name());
|
||||||
}
|
}
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstIfaceRefDType* nodep, AstNUser*) {
|
virtual void visit(AstIfaceRefDType* nodep) {
|
||||||
// May have changed cell names
|
// May have changed cell names
|
||||||
// TypeTable is always after all modules, so names are stable
|
// TypeTable is always after all modules, so names are stable
|
||||||
UINFO(8," IFACEREFDTYPE "<<nodep<<endl);
|
UINFO(8," IFACEREFDTYPE "<<nodep<<endl);
|
||||||
|
|
@ -275,7 +275,7 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
//--------------------
|
//--------------------
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeIf* nodep, AstNUser*) {
|
virtual void visit(AstNodeIf* nodep) {
|
||||||
UINFO(4," IF: "<<nodep<<endl);
|
UINFO(4," IF: "<<nodep<<endl);
|
||||||
int lastLikely = m_likely;
|
int lastLikely = m_likely;
|
||||||
int lastUnlikely = m_unlikely;
|
int lastUnlikely = m_unlikely;
|
||||||
|
|
@ -101,17 +101,17 @@ private:
|
||||||
m_likely = lastLikely;
|
m_likely = lastLikely;
|
||||||
m_unlikely = lastUnlikely;
|
m_unlikely = lastUnlikely;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCCall* nodep, AstNUser*) {
|
virtual void visit(AstCCall* nodep) {
|
||||||
checkUnlikely(nodep);
|
checkUnlikely(nodep);
|
||||||
nodep->funcp()->user1Inc();
|
nodep->funcp()->user1Inc();
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
checkUnlikely(nodep);
|
checkUnlikely(nodep);
|
||||||
m_cfuncsp.push_back(nodep);
|
m_cfuncsp.push_back(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
checkUnlikely(nodep);
|
checkUnlikely(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ private:
|
||||||
nodep->iterateChildrenConst(*this);
|
nodep->iterateChildrenConst(*this);
|
||||||
}
|
}
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
processAndIterate(nodep);
|
processAndIterate(nodep);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -236,7 +236,7 @@ private:
|
||||||
nodep->iterateChildrenConst(*this);
|
nodep->iterateChildrenConst(*this);
|
||||||
BrokenTable::setUnder(nodep,false);
|
BrokenTable::setUnder(nodep,false);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
processAndIterate(nodep);
|
processAndIterate(nodep);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ private:
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeCase* nodep, AstNUser*) {
|
virtual void visit(AstNodeCase* nodep) {
|
||||||
if (nodep->castCase() && nodep->castCase()->casex()) {
|
if (nodep->castCase() && nodep->castCase()->casex()) {
|
||||||
nodep->v3warn(CASEX,"Suggest casez (with ?'s) in place of casex (with X's)");
|
nodep->v3warn(CASEX,"Suggest casez (with ?'s) in place of casex (with X's)");
|
||||||
}
|
}
|
||||||
|
|
@ -90,7 +90,7 @@ private:
|
||||||
m_caseExprp = NULL;
|
m_caseExprp = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) {
|
virtual void visit(AstConst* nodep) {
|
||||||
// See also neverItem
|
// See also neverItem
|
||||||
if (m_caseExprp && nodep->num().isFourState()) {
|
if (m_caseExprp && nodep->num().isFourState()) {
|
||||||
if (m_caseExprp->castGenCase()) {
|
if (m_caseExprp->castGenCase()) {
|
||||||
|
|
@ -107,7 +107,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -451,7 +451,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstCase* nodep, AstNUser*) {
|
virtual void visit(AstCase* nodep) {
|
||||||
V3Case::caseLint(nodep);
|
V3Case::caseLint(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (debug()>=9) nodep->dumpTree(cout," case_old: ");
|
if (debug()>=9) nodep->dumpTree(cout," case_old: ");
|
||||||
|
|
@ -467,7 +467,7 @@ private:
|
||||||
}
|
}
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -107,19 +107,19 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeUniop* nodep, AstNUser*) {
|
virtual void visit(AstNodeUniop* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
nodep->user1(nodep->lhsp()->user1());
|
nodep->user1(nodep->lhsp()->user1());
|
||||||
if (nodep->sizeMattersLhs()) insureCast(nodep->lhsp());
|
if (nodep->sizeMattersLhs()) insureCast(nodep->lhsp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeBiop* nodep, AstNUser*) {
|
virtual void visit(AstNodeBiop* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
nodep->user1(nodep->lhsp()->user1()
|
nodep->user1(nodep->lhsp()->user1()
|
||||||
| nodep->rhsp()->user1());
|
| nodep->rhsp()->user1());
|
||||||
if (nodep->sizeMattersLhs()) insureCast(nodep->lhsp());
|
if (nodep->sizeMattersLhs()) insureCast(nodep->lhsp());
|
||||||
if (nodep->sizeMattersRhs()) insureCast(nodep->rhsp());
|
if (nodep->sizeMattersRhs()) insureCast(nodep->rhsp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeTriop* nodep, AstNUser*) {
|
virtual void visit(AstNodeTriop* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
nodep->user1(nodep->lhsp()->user1()
|
nodep->user1(nodep->lhsp()->user1()
|
||||||
| nodep->rhsp()->user1()
|
| nodep->rhsp()->user1()
|
||||||
|
|
@ -128,12 +128,12 @@ private:
|
||||||
if (nodep->sizeMattersRhs()) insureCast(nodep->rhsp());
|
if (nodep->sizeMattersRhs()) insureCast(nodep->rhsp());
|
||||||
if (nodep->sizeMattersThs()) insureCast(nodep->thsp());
|
if (nodep->sizeMattersThs()) insureCast(nodep->thsp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstCCast* nodep, AstNUser*) {
|
virtual void visit(AstCCast* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
insureLower32Cast(nodep);
|
insureLower32Cast(nodep);
|
||||||
nodep->user1(1);
|
nodep->user1(1);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNegate* nodep, AstNUser*) {
|
virtual void visit(AstNegate* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
nodep->user1(nodep->lhsp()->user1());
|
nodep->user1(nodep->lhsp()->user1());
|
||||||
if (nodep->lhsp()->widthMin()==1) {
|
if (nodep->lhsp()->widthMin()==1) {
|
||||||
|
|
@ -145,7 +145,7 @@ private:
|
||||||
insureCast(nodep->lhsp());
|
insureCast(nodep->lhsp());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (!nodep->lvalue()
|
if (!nodep->lvalue()
|
||||||
&& !nodep->backp()->castCCast()
|
&& !nodep->backp()->castCCast()
|
||||||
&& nodep->backp()->castNodeMath()
|
&& nodep->backp()->castNodeMath()
|
||||||
|
|
@ -158,7 +158,7 @@ private:
|
||||||
}
|
}
|
||||||
nodep->user1(1);
|
nodep->user1(1);
|
||||||
}
|
}
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) {
|
virtual void visit(AstConst* nodep) {
|
||||||
// Constants are of unknown size if smaller than 33 bits, becase
|
// Constants are of unknown size if smaller than 33 bits, becase
|
||||||
// we're too lazy to wrap every constant in the universe in
|
// we're too lazy to wrap every constant in the universe in
|
||||||
// ((IData)#).
|
// ((IData)#).
|
||||||
|
|
@ -166,11 +166,11 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOPs
|
// NOPs
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {}
|
virtual void visit(AstVar* nodep) {}
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ private:
|
||||||
ofstream* m_ofp; // Output file
|
ofstream* m_ofp; // Output file
|
||||||
string m_prefix;
|
string m_prefix;
|
||||||
|
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
*m_ofp<<m_prefix;
|
*m_ofp<<m_prefix;
|
||||||
if (nodep->user3()) *m_ofp<<" %%";
|
if (nodep->user3()) *m_ofp<<" %%";
|
||||||
else *m_ofp<<" ";
|
else *m_ofp<<" ";
|
||||||
|
|
@ -172,7 +172,7 @@ private:
|
||||||
int m_maxLineno;
|
int m_maxLineno;
|
||||||
size_t m_maxFilenameLen;
|
size_t m_maxFilenameLen;
|
||||||
|
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Keeping line+filename lengths separate is much faster than calling ascii().length()
|
// Keeping line+filename lengths separate is much faster than calling ascii().length()
|
||||||
if (nodep->fileline()->lineno() >= m_maxLineno) {
|
if (nodep->fileline()->lineno() >= m_maxLineno) {
|
||||||
|
|
@ -604,19 +604,19 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
UINFO(4," SCOPE "<<nodep<<endl);
|
UINFO(4," SCOPE "<<nodep<<endl);
|
||||||
m_scopep = nodep;
|
m_scopep = nodep;
|
||||||
m_logicVertexp = NULL;
|
m_logicVertexp = NULL;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_scopep = NULL;
|
m_scopep = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstActive* nodep, AstNUser*) {
|
virtual void visit(AstActive* nodep) {
|
||||||
// Create required blocks and add to module
|
// Create required blocks and add to module
|
||||||
UINFO(4," BLOCK "<<nodep<<endl);
|
UINFO(4," BLOCK "<<nodep<<endl);
|
||||||
AstNode::user2ClearTree();
|
AstNode::user2ClearTree();
|
||||||
|
|
@ -627,7 +627,7 @@ private:
|
||||||
m_domainp = NULL;
|
m_domainp = NULL;
|
||||||
AstNode::user2ClearTree();
|
AstNode::user2ClearTree();
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeVarRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeVarRef* nodep) {
|
||||||
if (m_scopep) {
|
if (m_scopep) {
|
||||||
if (!m_logicVertexp) nodep->v3fatalSrc("Var ref not under a logic block\n");
|
if (!m_logicVertexp) nodep->v3fatalSrc("Var ref not under a logic block\n");
|
||||||
AstVarScope* varscp = nodep->varScopep();
|
AstVarScope* varscp = nodep->varScopep();
|
||||||
|
|
@ -655,72 +655,72 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignDly* nodep, AstNUser*) {
|
virtual void visit(AstAssignDly* nodep) {
|
||||||
m_inDly = true;
|
m_inDly = true;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_inDly = false;
|
m_inDly = false;
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenItem* nodep, AstNUser*) {
|
virtual void visit(AstSenItem* nodep) {
|
||||||
// Note we look at only AstSenItems, not AstSenGate's
|
// Note we look at only AstSenItems, not AstSenGate's
|
||||||
// The gating term of a AstSenGate is normal logic
|
// The gating term of a AstSenGate is normal logic
|
||||||
m_inSenItem = true;
|
m_inSenItem = true;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_inSenItem = false;
|
m_inSenItem = false;
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
iterateNewStmt(nodep);
|
iterateNewStmt(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlwaysPublic* nodep, AstNUser*) {
|
virtual void visit(AstAlwaysPublic* nodep) {
|
||||||
// CDC doesn't care about public variables
|
// CDC doesn't care about public variables
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
iterateNewStmt(nodep);
|
iterateNewStmt(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenGate* nodep, AstNUser*) {
|
virtual void visit(AstSenGate* nodep) {
|
||||||
// First handle the clock part will be handled in a minute by visit AstSenItem
|
// First handle the clock part will be handled in a minute by visit AstSenItem
|
||||||
// The logic gating term is delt with as logic
|
// The logic gating term is delt with as logic
|
||||||
iterateNewStmt(nodep);
|
iterateNewStmt(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignAlias* nodep, AstNUser*) {
|
virtual void visit(AstAssignAlias* nodep) {
|
||||||
iterateNewStmt(nodep);
|
iterateNewStmt(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignW* nodep, AstNUser*) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
iterateNewStmt(nodep);
|
iterateNewStmt(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Math that shouldn't cause us to clear hazard
|
// Math that shouldn't cause us to clear hazard
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) { }
|
virtual void visit(AstConst* nodep) { }
|
||||||
virtual void visit(AstReplicate* nodep, AstNUser*) {
|
virtual void visit(AstReplicate* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstConcat* nodep, AstNUser*) {
|
virtual void visit(AstConcat* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNot* nodep, AstNUser*) {
|
virtual void visit(AstNot* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstSel* nodep, AstNUser*) {
|
virtual void visit(AstSel* nodep) {
|
||||||
if (!nodep->lsbp()->castConst()) setNodeHazard(nodep);
|
if (!nodep->lsbp()->castConst()) setNodeHazard(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeSel* nodep, AstNUser*) {
|
virtual void visit(AstNodeSel* nodep) {
|
||||||
if (!nodep->bitp()->castConst()) setNodeHazard(nodep);
|
if (!nodep->bitp()->castConst()) setNodeHazard(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignores
|
// Ignores
|
||||||
virtual void visit(AstInitial* nodep, AstNUser*) { }
|
virtual void visit(AstInitial* nodep) { }
|
||||||
virtual void visit(AstTraceInc* nodep, AstNUser*) { }
|
virtual void visit(AstTraceInc* nodep) { }
|
||||||
virtual void visit(AstCoverToggle* nodep, AstNUser*) { }
|
virtual void visit(AstCoverToggle* nodep) { }
|
||||||
virtual void visit(AstNodeDType* nodep, AstNUser*) { }
|
virtual void visit(AstNodeDType* nodep) { }
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default
|
// Default
|
||||||
virtual void visit(AstNodeMath* nodep, AstNUser*) {
|
virtual void visit(AstNodeMath* nodep) {
|
||||||
setNodeHazard(nodep);
|
setNodeHazard(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,13 +143,13 @@ private:
|
||||||
m_statep->m_numStmts += visitor.count();
|
m_statep->m_numStmts += visitor.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstBasicDType* nodep, AstNUser*) {
|
virtual void visit(AstBasicDType* nodep) {
|
||||||
newChangeDet();
|
newChangeDet();
|
||||||
}
|
}
|
||||||
virtual void visit(AstPackArrayDType* nodep, AstNUser*) {
|
virtual void visit(AstPackArrayDType* nodep) {
|
||||||
newChangeDet();
|
newChangeDet();
|
||||||
}
|
}
|
||||||
virtual void visit(AstUnpackArrayDType* nodep, AstNUser*) {
|
virtual void visit(AstUnpackArrayDType* nodep) {
|
||||||
for (int index=0; index < nodep->elementsConst(); ++index) {
|
for (int index=0; index < nodep->elementsConst(); ++index) {
|
||||||
AstNode* origVEp = m_varEqnp;
|
AstNode* origVEp = m_varEqnp;
|
||||||
AstNode* origNLEp = m_newLvEqnp;
|
AstNode* origNLEp = m_newLvEqnp;
|
||||||
|
|
@ -170,7 +170,7 @@ private:
|
||||||
m_newRvEqnp = origNREp;
|
m_newRvEqnp = origNREp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeClassDType* nodep, AstNUser*) {
|
virtual void visit(AstNodeClassDType* nodep) {
|
||||||
if (nodep->packedUnsup()) {
|
if (nodep->packedUnsup()) {
|
||||||
newChangeDet();
|
newChangeDet();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -178,7 +178,7 @@ private:
|
||||||
m_vscp->v3warn(E_DETECTARRAY, "Unsupported: Can't detect changes on complex variable (probably with UNOPTFLAT warning suppressed): "<<m_vscp->varp()->prettyName());
|
m_vscp->v3warn(E_DETECTARRAY, "Unsupported: Can't detect changes on complex variable (probably with UNOPTFLAT warning suppressed): "<<m_vscp->varp()->prettyName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (debug()) nodep->dumpTree(cout,"-DETECTARRAY-general-");
|
if (debug()) nodep->dumpTree(cout,"-DETECTARRAY-general-");
|
||||||
m_vscp->v3warn(E_DETECTARRAY, "Unsupported: Can't detect changes on complex variable (probably with UNOPTFLAT warning suppressed): "<<m_vscp->varp()->prettyName());
|
m_vscp->v3warn(E_DETECTARRAY, "Unsupported: Can't detect changes on complex variable (probably with UNOPTFLAT warning suppressed): "<<m_vscp->varp()->prettyName());
|
||||||
|
|
@ -239,7 +239,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
UINFO(4," MOD "<<nodep<<endl);
|
UINFO(4," MOD "<<nodep<<endl);
|
||||||
if (nodep->isTop()) {
|
if (nodep->isTop()) {
|
||||||
m_statep->m_topModp = nodep;
|
m_statep->m_topModp = nodep;
|
||||||
|
|
@ -247,7 +247,7 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstTopScope* nodep, AstNUser*) {
|
virtual void visit(AstTopScope* nodep) {
|
||||||
UINFO(4," TS "<<nodep<<endl);
|
UINFO(4," TS "<<nodep<<endl);
|
||||||
// Clearing
|
// Clearing
|
||||||
AstNode::user1ClearTree();
|
AstNode::user1ClearTree();
|
||||||
|
|
@ -269,7 +269,7 @@ private:
|
||||||
|
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarScope* nodep, AstNUser*) {
|
virtual void visit(AstVarScope* nodep) {
|
||||||
if (nodep->isCircular()) {
|
if (nodep->isCircular()) {
|
||||||
UINFO(8," CIRC "<<nodep<<endl);
|
UINFO(8," CIRC "<<nodep<<endl);
|
||||||
if (!nodep->user1SetOnce()) {
|
if (!nodep->user1SetOnce()) {
|
||||||
|
|
@ -277,12 +277,12 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeMath* nodep, AstNUser*) {
|
virtual void visit(AstNodeMath* nodep) {
|
||||||
// Short-circuit
|
// Short-circuit
|
||||||
}
|
}
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -173,12 +173,12 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeUniop* nodep, AstNUser*) {
|
virtual void visit(AstNodeUniop* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
computeCppWidth(nodep);
|
computeCppWidth(nodep);
|
||||||
if (nodep->cleanLhs()) {
|
if (nodep->cleanLhs()) {
|
||||||
|
|
@ -186,45 +186,45 @@ private:
|
||||||
}
|
}
|
||||||
setClean (nodep, nodep->cleanOut());
|
setClean (nodep, nodep->cleanOut());
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeBiop* nodep, AstNUser*) {
|
virtual void visit(AstNodeBiop* nodep) {
|
||||||
operandBiop(nodep);
|
operandBiop(nodep);
|
||||||
setClean (nodep, nodep->cleanOut());
|
setClean (nodep, nodep->cleanOut());
|
||||||
}
|
}
|
||||||
virtual void visit(AstAnd* nodep, AstNUser*) {
|
virtual void visit(AstAnd* nodep) {
|
||||||
operandBiop(nodep);
|
operandBiop(nodep);
|
||||||
setClean (nodep, isClean(nodep->lhsp()) || isClean(nodep->rhsp()));
|
setClean (nodep, isClean(nodep->lhsp()) || isClean(nodep->rhsp()));
|
||||||
}
|
}
|
||||||
virtual void visit(AstXor* nodep, AstNUser*) {
|
virtual void visit(AstXor* nodep) {
|
||||||
operandBiop(nodep);
|
operandBiop(nodep);
|
||||||
setClean (nodep, isClean(nodep->lhsp()) && isClean(nodep->rhsp()));
|
setClean (nodep, isClean(nodep->lhsp()) && isClean(nodep->rhsp()));
|
||||||
}
|
}
|
||||||
virtual void visit(AstOr* nodep, AstNUser*) {
|
virtual void visit(AstOr* nodep) {
|
||||||
operandBiop(nodep);
|
operandBiop(nodep);
|
||||||
setClean (nodep, isClean(nodep->lhsp()) && isClean(nodep->rhsp()));
|
setClean (nodep, isClean(nodep->lhsp()) && isClean(nodep->rhsp()));
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeMath* nodep, AstNUser*) {
|
virtual void visit(AstNodeMath* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
computeCppWidth(nodep);
|
computeCppWidth(nodep);
|
||||||
setClean (nodep, nodep->cleanOut());
|
setClean (nodep, nodep->cleanOut());
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
computeCppWidth(nodep);
|
computeCppWidth(nodep);
|
||||||
if (nodep->cleanRhs()) {
|
if (nodep->cleanRhs()) {
|
||||||
insureClean(nodep->rhsp());
|
insureClean(nodep->rhsp());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstText* nodep, AstNUser*) {
|
virtual void visit(AstText* nodep) {
|
||||||
setClean (nodep, true);
|
setClean (nodep, true);
|
||||||
}
|
}
|
||||||
virtual void visit(AstScopeName* nodep, AstNUser*) {
|
virtual void visit(AstScopeName* nodep) {
|
||||||
setClean (nodep, true);
|
setClean (nodep, true);
|
||||||
}
|
}
|
||||||
virtual void visit(AstSel* nodep, AstNUser*) {
|
virtual void visit(AstSel* nodep) {
|
||||||
operandTriop(nodep);
|
operandTriop(nodep);
|
||||||
setClean (nodep, nodep->cleanOut());
|
setClean (nodep, nodep->cleanOut());
|
||||||
}
|
}
|
||||||
virtual void visit(AstUCFunc* nodep, AstNUser*) {
|
virtual void visit(AstUCFunc* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
computeCppWidth(nodep);
|
computeCppWidth(nodep);
|
||||||
setClean (nodep, false);
|
setClean (nodep, false);
|
||||||
|
|
@ -234,43 +234,43 @@ private:
|
||||||
}
|
}
|
||||||
insureCleanAndNext (nodep->bodysp());
|
insureCleanAndNext (nodep->bodysp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstTraceInc* nodep, AstNUser*) {
|
virtual void visit(AstTraceInc* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
insureCleanAndNext (nodep->valuep());
|
insureCleanAndNext (nodep->valuep());
|
||||||
}
|
}
|
||||||
virtual void visit(AstTypedef* nodep, AstNUser*) {
|
virtual void visit(AstTypedef* nodep) {
|
||||||
// No cleaning, or would loose pointer to enum
|
// No cleaning, or would loose pointer to enum
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstParamTypeDType* nodep, AstNUser*) {
|
virtual void visit(AstParamTypeDType* nodep) {
|
||||||
// No cleaning, or would loose pointer to enum
|
// No cleaning, or would loose pointer to enum
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Control flow operators
|
// Control flow operators
|
||||||
virtual void visit(AstNodeCond* nodep, AstNUser*) {
|
virtual void visit(AstNodeCond* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
insureClean(nodep->condp());
|
insureClean(nodep->condp());
|
||||||
setClean(nodep, isClean(nodep->expr1p()) && isClean(nodep->expr2p()));
|
setClean(nodep, isClean(nodep->expr1p()) && isClean(nodep->expr2p()));
|
||||||
}
|
}
|
||||||
virtual void visit(AstWhile* nodep, AstNUser*) {
|
virtual void visit(AstWhile* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
insureClean(nodep->condp());
|
insureClean(nodep->condp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeIf* nodep, AstNUser*) {
|
virtual void visit(AstNodeIf* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
insureClean(nodep->condp());
|
insureClean(nodep->condp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstSFormatF* nodep, AstNUser*) {
|
virtual void visit(AstSFormatF* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
insureCleanAndNext (nodep->exprsp());
|
insureCleanAndNext (nodep->exprsp());
|
||||||
setClean(nodep, true); // generates a string, so not relevant
|
setClean(nodep, true); // generates a string, so not relevant
|
||||||
}
|
}
|
||||||
virtual void visit(AstUCStmt* nodep, AstNUser*) {
|
virtual void visit(AstUCStmt* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
insureCleanAndNext (nodep->bodysp());
|
insureCleanAndNext (nodep->bodysp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstCCall* nodep, AstNUser*) {
|
virtual void visit(AstCCall* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
insureCleanAndNext (nodep->argsp());
|
insureCleanAndNext (nodep->argsp());
|
||||||
setClean (nodep, true);
|
setClean (nodep, true);
|
||||||
|
|
@ -278,7 +278,7 @@ private:
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
computeCppWidth(nodep);
|
computeCppWidth(nodep);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -199,19 +199,19 @@ private:
|
||||||
if (m_isSimple) nodep->iterateChildren(*this);
|
if (m_isSimple) nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstOr* nodep, AstNUser*) { okIterate(nodep); }
|
virtual void visit(AstOr* nodep) { okIterate(nodep); }
|
||||||
virtual void visit(AstAnd* nodep, AstNUser*) { okIterate(nodep); }
|
virtual void visit(AstAnd* nodep) { okIterate(nodep); }
|
||||||
virtual void visit(AstNot* nodep, AstNUser*) { okIterate(nodep); }
|
virtual void visit(AstNot* nodep) { okIterate(nodep); }
|
||||||
virtual void visit(AstLogOr* nodep, AstNUser*) { okIterate(nodep); }
|
virtual void visit(AstLogOr* nodep) { okIterate(nodep); }
|
||||||
virtual void visit(AstLogAnd* nodep, AstNUser*) { okIterate(nodep); }
|
virtual void visit(AstLogAnd* nodep) { okIterate(nodep); }
|
||||||
virtual void visit(AstLogNot* nodep, AstNUser*) { okIterate(nodep); }
|
virtual void visit(AstLogNot* nodep) { okIterate(nodep); }
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) { okIterate(nodep); }
|
virtual void visit(AstVarRef* nodep) { okIterate(nodep); }
|
||||||
|
|
||||||
// Other possibilities are equals, etc
|
// Other possibilities are equals, etc
|
||||||
// But, we don't want to get too complicated or it will take too much
|
// But, we don't want to get too complicated or it will take too much
|
||||||
// effort to calculate the gater
|
// effort to calculate the gater
|
||||||
|
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
m_isSimple = false;
|
m_isSimple = false;
|
||||||
//nodep->iterateChildren(*this);
|
//nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
@ -248,7 +248,7 @@ class GaterBodyVisitor : public GaterBaseVisitor {
|
||||||
uint32_t m_state; // Parsing state
|
uint32_t m_state; // Parsing state
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (nodep->lvalue()) {
|
if (nodep->lvalue()) {
|
||||||
AstVarScope* vscp = nodep->varScopep();
|
AstVarScope* vscp = nodep->varScopep();
|
||||||
if (vscp->user2p()->castNode() == m_exprp) {
|
if (vscp->user2p()->castNode() == m_exprp) {
|
||||||
|
|
@ -272,11 +272,11 @@ class GaterBodyVisitor : public GaterBaseVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//virtual void visit(AstNodeIf* nodep, AstNUser*) { ... }
|
//virtual void visit(AstNodeIf* nodep) { ... }
|
||||||
// Not needed, it's the same handling as any other statement. Cool, huh?
|
// Not needed, it's the same handling as any other statement. Cool, huh?
|
||||||
// (We may get empty IFs but the constant propagater will rip them up for us)
|
// (We may get empty IFs but the constant propagater will rip them up for us)
|
||||||
|
|
||||||
virtual void visit(AstNodeStmt* nodep, AstNUser*) {
|
virtual void visit(AstNodeStmt* nodep) {
|
||||||
uint32_t oldstate = m_state;
|
uint32_t oldstate = m_state;
|
||||||
// Find if children want to delete this or not.
|
// Find if children want to delete this or not.
|
||||||
// Note children may bicker, and want to both keep and delete (branches on a if)
|
// Note children may bicker, and want to both keep and delete (branches on a if)
|
||||||
|
|
@ -304,7 +304,7 @@ class GaterBodyVisitor : public GaterBaseVisitor {
|
||||||
m_state |= STATE_KEEP;
|
m_state |= STATE_KEEP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -701,7 +701,7 @@ class GaterVisitor : public GaterBaseVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
if (debug()>=9) cout<<endl<<endl<<endl;
|
if (debug()>=9) cout<<endl<<endl<<endl;
|
||||||
UINFO(5, "Gater: ALWAYS: "<<nodep<<endl);
|
UINFO(5, "Gater: ALWAYS: "<<nodep<<endl);
|
||||||
if (nodep->user4SetOnce()) return;
|
if (nodep->user4SetOnce()) return;
|
||||||
|
|
@ -751,7 +751,7 @@ class GaterVisitor : public GaterBaseVisitor {
|
||||||
}
|
}
|
||||||
UINFO(5, " Gater done"<<endl);
|
UINFO(5, " Gater done"<<endl);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (nodep->lvalue()) {
|
if (nodep->lvalue()) {
|
||||||
AstVarScope* vscp = nodep->varScopep();
|
AstVarScope* vscp = nodep->varScopep();
|
||||||
if (nodep->varp()->isSigPublic()) {
|
if (nodep->varp()->isSigPublic()) {
|
||||||
|
|
@ -778,7 +778,7 @@ class GaterVisitor : public GaterBaseVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeIf* nodep, AstNUser*) {
|
virtual void visit(AstNodeIf* nodep) {
|
||||||
m_ifDepth++;
|
m_ifDepth++;
|
||||||
bool allowGater = m_directlyUnderAlw && m_ifDepth <= IF_DEPTH_MAX;
|
bool allowGater = m_directlyUnderAlw && m_ifDepth <= IF_DEPTH_MAX;
|
||||||
if (allowGater) {
|
if (allowGater) {
|
||||||
|
|
@ -819,12 +819,12 @@ class GaterVisitor : public GaterBaseVisitor {
|
||||||
m_ifDepth--;
|
m_ifDepth--;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstAssignDly* nodep, AstNUser*) {
|
virtual void visit(AstAssignDly* nodep) {
|
||||||
// iterateChildrenAlw will detect this is a statement for us
|
// iterateChildrenAlw will detect this is a statement for us
|
||||||
iterateChildrenAlw(nodep, false);
|
iterateChildrenAlw(nodep, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
// Note NOT AssignDly; handled above, We'll just mark this block as
|
// Note NOT AssignDly; handled above, We'll just mark this block as
|
||||||
// not optimizable.
|
// not optimizable.
|
||||||
//
|
//
|
||||||
|
|
@ -836,7 +836,7 @@ class GaterVisitor : public GaterBaseVisitor {
|
||||||
// No reason to iterate.
|
// No reason to iterate.
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstSenItem* nodep, AstNUser*) {
|
virtual void visit(AstSenItem* nodep) {
|
||||||
if (!nodep->isClocked()) {
|
if (!nodep->isClocked()) {
|
||||||
nonOptimizable(nodep, "Non-clocked sensitivity");
|
nonOptimizable(nodep, "Non-clocked sensitivity");
|
||||||
}
|
}
|
||||||
|
|
@ -844,7 +844,7 @@ class GaterVisitor : public GaterBaseVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
if (m_nonopt=="") { // Else accelerate
|
if (m_nonopt=="") { // Else accelerate
|
||||||
iterateChildrenAlw(nodep, false);
|
iterateChildrenAlw(nodep, false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstTopScope* nodep, AstNUser*) {
|
virtual void visit(AstTopScope* nodep) {
|
||||||
UINFO(4," TOPSCOPE "<<nodep<<endl);
|
UINFO(4," TOPSCOPE "<<nodep<<endl);
|
||||||
m_topScopep=nodep;
|
m_topScopep=nodep;
|
||||||
m_scopep = nodep->scopep();
|
m_scopep = nodep->scopep();
|
||||||
|
|
@ -243,14 +243,14 @@ private:
|
||||||
m_topScopep=NULL;
|
m_topScopep=NULL;
|
||||||
m_scopep = NULL;
|
m_scopep = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
//UINFO(4," MOD "<<nodep<<endl);
|
//UINFO(4," MOD "<<nodep<<endl);
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
m_stableNum = 0;
|
m_stableNum = 0;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp= NULL;
|
m_modp= NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
//UINFO(4," SCOPE "<<nodep<<endl);
|
//UINFO(4," SCOPE "<<nodep<<endl);
|
||||||
m_scopep = nodep;
|
m_scopep = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -261,7 +261,7 @@ private:
|
||||||
}
|
}
|
||||||
m_scopep = NULL;
|
m_scopep = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName());
|
AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName());
|
||||||
nodep->replaceWith(cmtp);
|
nodep->replaceWith(cmtp);
|
||||||
if (AstNode* stmtsp = nodep->bodysp()) {
|
if (AstNode* stmtsp = nodep->bodysp()) {
|
||||||
|
|
@ -270,7 +270,7 @@ private:
|
||||||
}
|
}
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlwaysPost* nodep, AstNUser*) {
|
virtual void visit(AstAlwaysPost* nodep) {
|
||||||
AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName());
|
AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName());
|
||||||
nodep->replaceWith(cmtp);
|
nodep->replaceWith(cmtp);
|
||||||
if (AstNode* stmtsp = nodep->bodysp()) {
|
if (AstNode* stmtsp = nodep->bodysp()) {
|
||||||
|
|
@ -279,7 +279,7 @@ private:
|
||||||
}
|
}
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCoverToggle* nodep, AstNUser*) {
|
virtual void visit(AstCoverToggle* nodep) {
|
||||||
//nodep->dumpTree(cout,"ct:");
|
//nodep->dumpTree(cout,"ct:");
|
||||||
//COVERTOGGLE(INC, ORIG, CHANGE) ->
|
//COVERTOGGLE(INC, ORIG, CHANGE) ->
|
||||||
// IF(ORIG ^ CHANGE) { INC; CHANGE = ORIG; }
|
// IF(ORIG ^ CHANGE) { INC; CHANGE = ORIG; }
|
||||||
|
|
@ -299,7 +299,7 @@ private:
|
||||||
origp->cloneTree(false)));
|
origp->cloneTree(false)));
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstInitial* nodep, AstNUser*) {
|
virtual void visit(AstInitial* nodep) {
|
||||||
AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName());
|
AstNode* cmtp = new AstComment(nodep->fileline(), nodep->typeName());
|
||||||
nodep->replaceWith(cmtp);
|
nodep->replaceWith(cmtp);
|
||||||
if (AstNode* stmtsp = nodep->bodysp()) {
|
if (AstNode* stmtsp = nodep->bodysp()) {
|
||||||
|
|
@ -308,7 +308,7 @@ private:
|
||||||
}
|
}
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Link to global function
|
// Link to global function
|
||||||
if (nodep->formCallTree()) {
|
if (nodep->formCallTree()) {
|
||||||
|
|
@ -318,7 +318,7 @@ private:
|
||||||
m_finalFuncp->addStmtsp(callp);
|
m_finalFuncp->addStmtsp(callp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenTree* nodep, AstNUser*) {
|
virtual void visit(AstSenTree* nodep) {
|
||||||
// Delete it later; Actives still pointing to it
|
// Delete it later; Actives still pointing to it
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
pushDeletep(nodep);
|
pushDeletep(nodep);
|
||||||
|
|
@ -335,7 +335,7 @@ private:
|
||||||
if (m_untilp) m_untilp->addBodysp(stmtsp); // In a until loop, add to body
|
if (m_untilp) m_untilp->addBodysp(stmtsp); // In a until loop, add to body
|
||||||
else m_initFuncp->addStmtsp(stmtsp); // else add to top level function
|
else m_initFuncp->addStmtsp(stmtsp); // else add to top level function
|
||||||
}
|
}
|
||||||
virtual void visit(AstActive* nodep, AstNUser*) {
|
virtual void visit(AstActive* nodep) {
|
||||||
// Careful if adding variables here, ACTIVES can be under other ACTIVES
|
// Careful if adding variables here, ACTIVES can be under other ACTIVES
|
||||||
// Need to save and restore any member state in AstUntilStable block
|
// Need to save and restore any member state in AstUntilStable block
|
||||||
if (!m_topScopep || !nodep->stmtsp()) {
|
if (!m_topScopep || !nodep->stmtsp()) {
|
||||||
|
|
@ -380,7 +380,7 @@ private:
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -134,13 +134,13 @@ public:
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstCCall* nodep, AstNUser*) {
|
virtual void visit(AstCCall* nodep) {
|
||||||
addCall(nodep);
|
addCall(nodep);
|
||||||
}
|
}
|
||||||
// Speed things up
|
// Speed things up
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {}
|
virtual void visit(AstNodeAssign* nodep) {}
|
||||||
virtual void visit(AstNodeMath* nodep, AstNUser*) {}
|
virtual void visit(AstNodeMath* nodep) {}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -163,7 +163,7 @@ private:
|
||||||
// OUTPUT:
|
// OUTPUT:
|
||||||
// AstNode::user3() -> bool. True to indicate duplicated
|
// AstNode::user3() -> bool. True to indicate duplicated
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->user3(true);
|
nodep->user3(true);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
@ -389,7 +389,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
// Track all callers of each function
|
// Track all callers of each function
|
||||||
m_call.main(nodep);
|
m_call.main(nodep);
|
||||||
//
|
//
|
||||||
|
|
@ -398,7 +398,7 @@ private:
|
||||||
// Required so that a module instantiating another can benefit from collapsing.
|
// Required so that a module instantiating another can benefit from collapsing.
|
||||||
nodep->iterateChildrenBackwards(*this);
|
nodep->iterateChildrenBackwards(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
UINFO(4," MOD "<<nodep<<endl);
|
UINFO(4," MOD "<<nodep<<endl);
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
m_modNFuncs = 0;
|
m_modNFuncs = 0;
|
||||||
|
|
@ -426,7 +426,7 @@ private:
|
||||||
}
|
}
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
m_funcp = nodep;
|
m_funcp = nodep;
|
||||||
if (!nodep->dontCombine()) {
|
if (!nodep->dontCombine()) {
|
||||||
if (m_state == STATE_HASH) {
|
if (m_state == STATE_HASH) {
|
||||||
|
|
@ -437,7 +437,7 @@ private:
|
||||||
}
|
}
|
||||||
m_funcp = NULL;
|
m_funcp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeStmt* nodep, AstNUser*) {
|
virtual void visit(AstNodeStmt* nodep) {
|
||||||
if (m_state == STATE_HASH && m_funcp) {
|
if (m_state == STATE_HASH && m_funcp) {
|
||||||
hashStatement(nodep);
|
hashStatement(nodep);
|
||||||
}
|
}
|
||||||
|
|
@ -448,10 +448,10 @@ private:
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstVar*, AstNUser*) {}
|
virtual void visit(AstVar*) {}
|
||||||
virtual void visit(AstTraceDecl*, AstNUser*) {}
|
virtual void visit(AstTraceDecl*) {}
|
||||||
virtual void visit(AstTraceInc*, AstNUser*) {}
|
virtual void visit(AstTraceInc*) {}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,10 @@ class ConstVarMarkVisitor : public AstNVisitor {
|
||||||
// AstVar::user4p -> bool, Var marked, 0=not set yet
|
// AstVar::user4p -> bool, Var marked, 0=not set yet
|
||||||
private:
|
private:
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (nodep->varp()) nodep->varp()->user4(1);
|
if (nodep->varp()) nodep->varp()->user4(1);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -69,17 +69,17 @@ class ConstVarFindVisitor : public AstNVisitor {
|
||||||
bool m_found;
|
bool m_found;
|
||||||
private:
|
private:
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (nodep->varp() && nodep->varp()->user4()) m_found = true;
|
if (nodep->varp() && nodep->varp()->user4()) m_found = true;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
// CONSTUCTORS
|
// CONSTUCTORS
|
||||||
explicit ConstVarFindVisitor(AstNode* nodep) {
|
explicit ConstVarFindVisitor(AstNode* nodep) {
|
||||||
m_found = false;
|
m_found = false;
|
||||||
nodep->iterateAndNext(*this, NULL);
|
nodep->iterateAndNext(*this);
|
||||||
}
|
}
|
||||||
virtual ~ConstVarFindVisitor() {}
|
virtual ~ConstVarFindVisitor() {}
|
||||||
// METHODS
|
// METHODS
|
||||||
|
|
@ -1195,23 +1195,23 @@ private:
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
// Iterate modules backwards, in bottom-up order. That's faster
|
// Iterate modules backwards, in bottom-up order. That's faster
|
||||||
nodep->iterateChildrenBackwards(*this);
|
nodep->iterateChildrenBackwards(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
// No ASSIGNW removals under funcs, we've long eliminated INITIALs
|
// No ASSIGNW removals under funcs, we've long eliminated INITIALs
|
||||||
// (We should perhaps rename the assignw's to just assigns)
|
// (We should perhaps rename the assignw's to just assigns)
|
||||||
m_wremove = false;
|
m_wremove = false;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_wremove = true;
|
m_wremove = true;
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
// No ASSIGNW removals under scope, we've long eliminated INITIALs
|
// No ASSIGNW removals under scope, we've long eliminated INITIALs
|
||||||
m_scopep = nodep;
|
m_scopep = nodep;
|
||||||
m_wremove = false;
|
m_wremove = false;
|
||||||
|
|
@ -1284,16 +1284,16 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special cases
|
// Special cases
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) {} // Already constant
|
virtual void visit(AstConst* nodep) {} // Already constant
|
||||||
|
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
if (m_params) {
|
if (m_params) {
|
||||||
nodep->paramsp()->iterateAndNext(*this);
|
nodep->paramsp()->iterateAndNext(*this);
|
||||||
} else {
|
} else {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstPin* nodep, AstNUser*) {
|
virtual void visit(AstPin* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1414,14 +1414,14 @@ private:
|
||||||
nodep->replaceWith(fromp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(fromp); nodep->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstAttrOf* nodep, AstNUser*) {
|
virtual void visit(AstAttrOf* nodep) {
|
||||||
AstAttrOf* oldAttr = m_attrp;
|
AstAttrOf* oldAttr = m_attrp;
|
||||||
m_attrp = nodep;
|
m_attrp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_attrp = oldAttr;
|
m_attrp = oldAttr;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstArraySel* nodep, AstNUser*) {
|
virtual void visit(AstArraySel* nodep) {
|
||||||
nodep->bitp()->iterateAndNext(*this);
|
nodep->bitp()->iterateAndNext(*this);
|
||||||
if (nodep->bitp()->castConst()
|
if (nodep->bitp()->castConst()
|
||||||
&& nodep->fromp()->castVarRef()
|
&& nodep->fromp()->castVarRef()
|
||||||
|
|
@ -1440,7 +1440,7 @@ private:
|
||||||
}
|
}
|
||||||
m_selp = NULL;
|
m_selp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeVarRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeVarRef* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (!nodep->varp()) nodep->v3fatalSrc("Not linked");
|
if (!nodep->varp()) nodep->v3fatalSrc("Not linked");
|
||||||
bool did=false;
|
bool did=false;
|
||||||
|
|
@ -1492,7 +1492,7 @@ private:
|
||||||
nodep->v3error("Expecting expression to be constant, but variable isn't const: "<<nodep->varp()->prettyName());
|
nodep->v3error("Expecting expression to be constant, but variable isn't const: "<<nodep->varp()->prettyName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstEnumItemRef* nodep, AstNUser*) {
|
virtual void visit(AstEnumItemRef* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (!nodep->itemp()) nodep->v3fatalSrc("Not linked");
|
if (!nodep->itemp()) nodep->v3fatalSrc("Not linked");
|
||||||
bool did=false;
|
bool did=false;
|
||||||
|
|
@ -1510,7 +1510,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// virtual void visit(AstCvtPackString* nodep, AstNUser*) {
|
// virtual void visit(AstCvtPackString* nodep) {
|
||||||
// Not constant propagated (for today) because AstMath::isOpaque is set
|
// Not constant propagated (for today) because AstMath::isOpaque is set
|
||||||
// Someday if lower is constant, convert to quoted "string".
|
// Someday if lower is constant, convert to quoted "string".
|
||||||
|
|
||||||
|
|
@ -1518,7 +1518,7 @@ private:
|
||||||
// Only one if it's not in a list
|
// Only one if it's not in a list
|
||||||
return (!nodep->nextp() && nodep->backp()->nextp() != nodep);
|
return (!nodep->nextp() && nodep->backp()->nextp() != nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenItem* nodep, AstNUser*) {
|
virtual void visit(AstSenItem* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_doNConst
|
if (m_doNConst
|
||||||
&& (nodep->sensp()->castConst()
|
&& (nodep->sensp()->castConst()
|
||||||
|
|
@ -1558,7 +1558,7 @@ private:
|
||||||
if (nodep->hasVar() && !nodep->varrefp()) nodep->v3fatalSrc("Null sensitivity variable");
|
if (nodep->hasVar() && !nodep->varrefp()) nodep->v3fatalSrc("Null sensitivity variable");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenGate* nodep, AstNUser*) {
|
virtual void visit(AstSenGate* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (AstConst* constp = nodep->rhsp()->castConst()) {
|
if (AstConst* constp = nodep->rhsp()->castConst()) {
|
||||||
if (constp->isZero()) {
|
if (constp->isZero()) {
|
||||||
|
|
@ -1604,7 +1604,7 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void visit(AstSenTree* nodep, AstNUser*) {
|
virtual void visit(AstSenTree* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_doExpensive) {
|
if (m_doExpensive) {
|
||||||
//cout<<endl; nodep->dumpTree(cout,"ssin: ");
|
//cout<<endl; nodep->dumpTree(cout,"ssin: ");
|
||||||
|
|
@ -1708,17 +1708,17 @@ private:
|
||||||
|
|
||||||
//-----
|
//-----
|
||||||
// Zero elimination
|
// Zero elimination
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_doNConst && replaceNodeAssign(nodep)) return;
|
if (m_doNConst && replaceNodeAssign(nodep)) return;
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignAlias* nodep, AstNUser*) {
|
virtual void visit(AstAssignAlias* nodep) {
|
||||||
// Don't perform any optimizations, keep the alias around
|
// Don't perform any optimizations, keep the alias around
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignVarScope* nodep, AstNUser*) {
|
virtual void visit(AstAssignVarScope* nodep) {
|
||||||
// Don't perform any optimizations, the node won't be linked yet
|
// Don't perform any optimizations, the node won't be linked yet
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignW* nodep, AstNUser*) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_doNConst && replaceNodeAssign(nodep)) return;
|
if (m_doNConst && replaceNodeAssign(nodep)) return;
|
||||||
AstNodeVarRef* varrefp = nodep->lhsp()->castVarRef(); // Not VarXRef, as different refs may set different values to each hierarchy
|
AstNodeVarRef* varrefp = nodep->lhsp()->castVarRef(); // Not VarXRef, as different refs may set different values to each hierarchy
|
||||||
|
|
@ -1745,7 +1745,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeIf* nodep, AstNUser*) {
|
virtual void visit(AstNodeIf* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_doNConst) {
|
if (m_doNConst) {
|
||||||
if (AstConst* constp = nodep->condp()->castConst()) {
|
if (AstConst* constp = nodep->condp()->castConst()) {
|
||||||
|
|
@ -1823,7 +1823,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstSFormatF* nodep, AstNUser*) {
|
virtual void visit(AstSFormatF* nodep) {
|
||||||
// Substitute constants into displays. The main point of this is to
|
// Substitute constants into displays. The main point of this is to
|
||||||
// simplify assertion methodologies which call functions with display's.
|
// simplify assertion methodologies which call functions with display's.
|
||||||
// This eliminates a pile of wide temps, and makes the C a whole lot more readable.
|
// This eliminates a pile of wide temps, and makes the C a whole lot more readable.
|
||||||
|
|
@ -1885,17 +1885,17 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstFuncRef* nodep, AstNUser*) {
|
virtual void visit(AstFuncRef* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_params) { // Only parameters force us to do constant function call propagation
|
if (m_params) { // Only parameters force us to do constant function call propagation
|
||||||
replaceWithSimulation(nodep);
|
replaceWithSimulation(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstArg* nodep, AstNUser*) {
|
virtual void visit(AstArg* nodep) {
|
||||||
// replaceWithSimulation on the Arg's parent FuncRef replaces these
|
// replaceWithSimulation on the Arg's parent FuncRef replaces these
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstWhile* nodep, AstNUser*) {
|
virtual void visit(AstWhile* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_doNConst) {
|
if (m_doNConst) {
|
||||||
if (nodep->condp()->isZero()) {
|
if (nodep->condp()->isZero()) {
|
||||||
|
|
@ -1909,17 +1909,17 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstInitArray* nodep, AstNUser*) {
|
virtual void visit(AstInitArray* nodep) {
|
||||||
// Constant if all children are constant
|
// Constant if all children are constant
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// These are converted by V3Param. Don't constify as we don't want the from() VARREF to disappear, if any
|
// These are converted by V3Param. Don't constify as we don't want the from() VARREF to disappear, if any
|
||||||
// If output of a presel didn't get consted, chances are V3Param didn't visit properly
|
// If output of a presel didn't get consted, chances are V3Param didn't visit properly
|
||||||
virtual void visit(AstNodePreSel* nodep, AstNUser*) {}
|
virtual void visit(AstNodePreSel* nodep) {}
|
||||||
|
|
||||||
// Ignored, can eliminate early
|
// Ignored, can eliminate early
|
||||||
virtual void visit(AstSysIgnore* nodep, AstNUser*) {
|
virtual void visit(AstSysIgnore* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_doNConst) {
|
if (m_doNConst) {
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
||||||
|
|
@ -1927,7 +1927,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simplify
|
// Simplify
|
||||||
virtual void visit(AstBasicDType* nodep, AstNUser*) {
|
virtual void visit(AstBasicDType* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
nodep->cvtRangeConst();
|
nodep->cvtRangeConst();
|
||||||
}
|
}
|
||||||
|
|
@ -1935,12 +1935,12 @@ private:
|
||||||
//-----
|
//-----
|
||||||
// Jump elimination
|
// Jump elimination
|
||||||
|
|
||||||
virtual void visit(AstJumpGo* nodep, AstNUser*) {
|
virtual void visit(AstJumpGo* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_doExpensive) { nodep->labelp()->user4(true); }
|
if (m_doExpensive) { nodep->labelp()->user4(true); }
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstJumpLabel* nodep, AstNUser*) {
|
virtual void visit(AstJumpLabel* nodep) {
|
||||||
// Because JumpLabels disable many optimizations,
|
// Because JumpLabels disable many optimizations,
|
||||||
// remove JumpLabels that are not pointed to by any AstJumpGos
|
// remove JumpLabels that are not pointed to by any AstJumpGos
|
||||||
// Note this assumes all AstJumpGos are underneath the given label; V3Broken asserts this
|
// Note this assumes all AstJumpGos are underneath the given label; V3Broken asserts this
|
||||||
|
|
@ -2269,7 +2269,7 @@ private:
|
||||||
// Note we can't convert EqCase/NeqCase to Eq/Neq here because that would break 3'b1x1==3'b101
|
// Note we can't convert EqCase/NeqCase to Eq/Neq here because that would break 3'b1x1==3'b101
|
||||||
|
|
||||||
//-----
|
//-----
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
if (m_required) {
|
if (m_required) {
|
||||||
if (nodep->castNodeDType() || nodep->castRange()) {
|
if (nodep->castNodeDType() || nodep->castRange()) {
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS - BOTH
|
// VISITORS - BOTH
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
m_inModOff = nodep->isTop(); // Ignore coverage on top module; it's a shell we created
|
m_inModOff = nodep->isTop(); // Ignore coverage on top module; it's a shell we created
|
||||||
m_fileps.clear();
|
m_fileps.clear();
|
||||||
|
|
@ -138,7 +138,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS - TOGGLE COVERAGE
|
// VISITORS - TOGGLE COVERAGE
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
bool oldtog = m_inToggleOff;
|
bool oldtog = m_inToggleOff;
|
||||||
{
|
{
|
||||||
m_inToggleOff = true;
|
m_inToggleOff = true;
|
||||||
|
|
@ -146,7 +146,7 @@ private:
|
||||||
}
|
}
|
||||||
m_inToggleOff = oldtog;
|
m_inToggleOff = oldtog;
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_modp && !m_inModOff && !m_inToggleOff
|
if (m_modp && !m_inModOff && !m_inToggleOff
|
||||||
&& nodep->fileline()->coverageOn() && v3Global.opt.coverageToggle()) {
|
&& nodep->fileline()->coverageOn() && v3Global.opt.coverageToggle()) {
|
||||||
|
|
@ -279,7 +279,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS - LINE COVERAGE
|
// VISITORS - LINE COVERAGE
|
||||||
virtual void visit(AstIf* nodep, AstNUser*) { // Note not AstNodeIf; other types don't get covered
|
virtual void visit(AstIf* nodep) { // Note not AstNodeIf; other types don't get covered
|
||||||
UINFO(4," IF: "<<nodep<<endl);
|
UINFO(4," IF: "<<nodep<<endl);
|
||||||
if (m_checkBlock) {
|
if (m_checkBlock) {
|
||||||
// An else-if. When we iterate the if, use "elsif" marking
|
// An else-if. When we iterate the if, use "elsif" marking
|
||||||
|
|
@ -312,7 +312,7 @@ private:
|
||||||
m_checkBlock = true; // Reset as a child may have cleared it
|
m_checkBlock = true; // Reset as a child may have cleared it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstCaseItem* nodep, AstNUser*) {
|
virtual void visit(AstCaseItem* nodep) {
|
||||||
UINFO(4," CASEI: "<<nodep<<endl);
|
UINFO(4," CASEI: "<<nodep<<endl);
|
||||||
if (m_checkBlock && !m_inModOff
|
if (m_checkBlock && !m_inModOff
|
||||||
&& nodep->fileline()->coverageOn() && v3Global.opt.coverageLine()) {
|
&& nodep->fileline()->coverageOn() && v3Global.opt.coverageLine()) {
|
||||||
|
|
@ -324,7 +324,7 @@ private:
|
||||||
m_checkBlock = true; // Reset as a child may have cleared it
|
m_checkBlock = true; // Reset as a child may have cleared it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstPslCover* nodep, AstNUser*) {
|
virtual void visit(AstPslCover* nodep) {
|
||||||
UINFO(4," PSLCOVER: "<<nodep<<endl);
|
UINFO(4," PSLCOVER: "<<nodep<<endl);
|
||||||
m_checkBlock = true; // Always do cover blocks, even if there's a $stop
|
m_checkBlock = true; // Always do cover blocks, even if there's a $stop
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -334,11 +334,11 @@ private:
|
||||||
}
|
}
|
||||||
m_checkBlock = true; // Reset as a child may have cleared it
|
m_checkBlock = true; // Reset as a child may have cleared it
|
||||||
}
|
}
|
||||||
virtual void visit(AstStop* nodep, AstNUser*) {
|
virtual void visit(AstStop* nodep) {
|
||||||
UINFO(4," STOP: "<<nodep<<endl);
|
UINFO(4," STOP: "<<nodep<<endl);
|
||||||
m_checkBlock = false;
|
m_checkBlock = false;
|
||||||
}
|
}
|
||||||
virtual void visit(AstPragma* nodep, AstNUser*) {
|
virtual void visit(AstPragma* nodep) {
|
||||||
if (nodep->pragType() == AstPragmaType::COVERAGE_BLOCK_OFF) {
|
if (nodep->pragType() == AstPragmaType::COVERAGE_BLOCK_OFF) {
|
||||||
// Skip all NEXT nodes under this block, and skip this if/case branch
|
// Skip all NEXT nodes under this block, and skip this if/case branch
|
||||||
UINFO(4," OFF: "<<nodep<<endl);
|
UINFO(4," OFF: "<<nodep<<endl);
|
||||||
|
|
@ -348,7 +348,7 @@ private:
|
||||||
if (m_checkBlock) nodep->iterateChildren(*this);
|
if (m_checkBlock) nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstBegin* nodep, AstNUser*) {
|
virtual void visit(AstBegin* nodep) {
|
||||||
// Record the hierarchy of any named begins, so we can apply to user
|
// Record the hierarchy of any named begins, so we can apply to user
|
||||||
// coverage points. This is because there may be cov points inside
|
// coverage points. This is because there may be cov points inside
|
||||||
// generate blocks; each point should get separate consideration.
|
// generate blocks; each point should get separate consideration.
|
||||||
|
|
@ -368,7 +368,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS - BOTH
|
// VISITORS - BOTH
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
if (m_checkBlock) {
|
if (m_checkBlock) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
|
||||||
|
|
@ -103,19 +103,19 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
// Find all Coverage's
|
// Find all Coverage's
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Simplify
|
// Simplify
|
||||||
detectDuplicates();
|
detectDuplicates();
|
||||||
}
|
}
|
||||||
virtual void visit(AstCoverToggle* nodep, AstNUser*) {
|
virtual void visit(AstCoverToggle* nodep) {
|
||||||
m_toggleps.push_back(nodep);
|
m_toggleps.push_back(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
//--------------------
|
//--------------------
|
||||||
virtual void visit(AstNodeMath* nodep, AstNUser*) {} // Accelerate
|
virtual void visit(AstNodeMath* nodep) {} // Accelerate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,13 +58,13 @@ private:
|
||||||
// NODE STATE
|
// NODE STATE
|
||||||
// ** Shared with DeadVisitor **
|
// ** Shared with DeadVisitor **
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
nodep->modp()->user1Inc(-1);
|
nodep->modp()->user1Inc(-1);
|
||||||
}
|
}
|
||||||
//-----
|
//-----
|
||||||
virtual void visit(AstNodeMath* nodep, AstNUser*) {} // Accelerate
|
virtual void visit(AstNodeMath* nodep) {} // Accelerate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -135,18 +135,18 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
checkAll(nodep);
|
checkAll(nodep);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
checkAll(nodep);
|
checkAll(nodep);
|
||||||
if (nodep->scopep()) nodep->scopep()->user1Inc();
|
if (nodep->scopep()) nodep->scopep()->user1Inc();
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
checkAll(nodep);
|
checkAll(nodep);
|
||||||
if (nodep->aboveScopep()) nodep->aboveScopep()->user1Inc();
|
if (nodep->aboveScopep()) nodep->aboveScopep()->user1Inc();
|
||||||
|
|
@ -155,14 +155,14 @@ private:
|
||||||
m_scopesp.push_back(nodep);
|
m_scopesp.push_back(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
checkAll(nodep);
|
checkAll(nodep);
|
||||||
m_cellsp.push_back(nodep);
|
m_cellsp.push_back(nodep);
|
||||||
nodep->modp()->user1Inc();
|
nodep->modp()->user1Inc();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeVarRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeVarRef* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
checkAll(nodep);
|
checkAll(nodep);
|
||||||
if (nodep->varScopep()) {
|
if (nodep->varScopep()) {
|
||||||
|
|
@ -177,7 +177,7 @@ private:
|
||||||
else nodep->packagep()->user1Inc();
|
else nodep->packagep()->user1Inc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
checkAll(nodep);
|
checkAll(nodep);
|
||||||
if (nodep->packagep()) {
|
if (nodep->packagep()) {
|
||||||
|
|
@ -185,7 +185,7 @@ private:
|
||||||
else nodep->packagep()->user1Inc();
|
else nodep->packagep()->user1Inc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstRefDType* nodep, AstNUser*) {
|
virtual void visit(AstRefDType* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
checkDType(nodep);
|
checkDType(nodep);
|
||||||
checkAll(nodep);
|
checkAll(nodep);
|
||||||
|
|
@ -194,12 +194,12 @@ private:
|
||||||
else nodep->packagep()->user1Inc();
|
else nodep->packagep()->user1Inc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeDType* nodep, AstNUser*) {
|
virtual void visit(AstNodeDType* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
checkDType(nodep);
|
checkDType(nodep);
|
||||||
checkAll(nodep);
|
checkAll(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstEnumItemRef* nodep, AstNUser*) {
|
virtual void visit(AstEnumItemRef* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
checkAll(nodep);
|
checkAll(nodep);
|
||||||
if (nodep->packagep()) {
|
if (nodep->packagep()) {
|
||||||
|
|
@ -208,7 +208,7 @@ private:
|
||||||
}
|
}
|
||||||
checkAll(nodep);
|
checkAll(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstModport* nodep, AstNUser*) {
|
virtual void visit(AstModport* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_elimCells) {
|
if (m_elimCells) {
|
||||||
if (!nodep->varsp()) {
|
if (!nodep->varsp()) {
|
||||||
|
|
@ -218,7 +218,7 @@ private:
|
||||||
}
|
}
|
||||||
checkAll(nodep);
|
checkAll(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstTypedef* nodep, AstNUser*) {
|
virtual void visit(AstTypedef* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_elimCells && !nodep->attrPublic()) {
|
if (m_elimCells && !nodep->attrPublic()) {
|
||||||
pushDeletep(nodep->unlinkFrBack()); VL_DANGLING(nodep);
|
pushDeletep(nodep->unlinkFrBack()); VL_DANGLING(nodep);
|
||||||
|
|
@ -229,7 +229,7 @@ private:
|
||||||
// Normal modules may disappear, e.g. if they are parameterized then removed
|
// Normal modules may disappear, e.g. if they are parameterized then removed
|
||||||
if (nodep->attrPublic() && m_modp && m_modp->castPackage()) m_modp->user1Inc();
|
if (nodep->attrPublic() && m_modp && m_modp->castPackage()) m_modp->user1Inc();
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarScope* nodep, AstNUser*) {
|
virtual void visit(AstVarScope* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
checkAll(nodep);
|
checkAll(nodep);
|
||||||
if (nodep->scopep()) nodep->scopep()->user1Inc();
|
if (nodep->scopep()) nodep->scopep()->user1Inc();
|
||||||
|
|
@ -237,7 +237,7 @@ private:
|
||||||
m_vscsp.push_back(nodep);
|
m_vscsp.push_back(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
checkAll(nodep);
|
checkAll(nodep);
|
||||||
if (nodep->isSigPublic() && m_modp && m_modp->castPackage()) m_modp->user1Inc();
|
if (nodep->isSigPublic() && m_modp && m_modp->castPackage()) m_modp->user1Inc();
|
||||||
|
|
@ -245,7 +245,7 @@ private:
|
||||||
m_varsp.push_back(nodep);
|
m_varsp.push_back(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
// See if simple assignments to variables may be eliminated because that variable is never used.
|
// See if simple assignments to variables may be eliminated because that variable is never used.
|
||||||
// Similar code in V3Life
|
// Similar code in V3Life
|
||||||
m_sideEffect = false;
|
m_sideEffect = false;
|
||||||
|
|
@ -264,7 +264,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----
|
//-----
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
if (nodep->isOutputter()) m_sideEffect=true;
|
if (nodep->isOutputter()) m_sideEffect=true;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
checkAll(nodep);
|
checkAll(nodep);
|
||||||
|
|
|
||||||
|
|
@ -338,22 +338,22 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
//VV***** We reset all userp() on the netlist
|
//VV***** We reset all userp() on the netlist
|
||||||
m_modVarMap.clear();
|
m_modVarMap.clear();
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
UINFO(4," MOD "<<nodep<<endl);
|
UINFO(4," MOD "<<nodep<<endl);
|
||||||
AstNode::user3ClearTree();
|
AstNode::user3ClearTree();
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
m_cfuncp = nodep;
|
m_cfuncp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_cfuncp = NULL;
|
m_cfuncp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstActive* nodep, AstNUser*) {
|
virtual void visit(AstActive* nodep) {
|
||||||
m_activep = nodep;
|
m_activep = nodep;
|
||||||
bool oldinit = m_inInitial;
|
bool oldinit = m_inInitial;
|
||||||
m_inInitial = nodep->hasInitial();
|
m_inInitial = nodep->hasInitial();
|
||||||
|
|
@ -361,7 +361,7 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_inInitial = oldinit;
|
m_inInitial = oldinit;
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignDly* nodep, AstNUser*) {
|
virtual void visit(AstAssignDly* nodep) {
|
||||||
m_inDly = true;
|
m_inDly = true;
|
||||||
m_nextDlyp = nodep->nextp()->castAssignDly(); // Next assignment in same block, maybe NULL.
|
m_nextDlyp = nodep->nextp()->castAssignDly(); // Next assignment in same block, maybe NULL.
|
||||||
if (m_cfuncp) nodep->v3error("Unsupported: Delayed assignment inside public function/task");
|
if (m_cfuncp) nodep->v3error("Unsupported: Delayed assignment inside public function/task");
|
||||||
|
|
@ -385,7 +385,7 @@ private:
|
||||||
m_nextDlyp = NULL;
|
m_nextDlyp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (!nodep->user2Inc()) { // Not done yet
|
if (!nodep->user2Inc()) { // Not done yet
|
||||||
if (m_inDly && nodep->lvalue()) {
|
if (m_inDly && nodep->lvalue()) {
|
||||||
UINFO(4,"AssignDlyVar: "<<nodep<<endl);
|
UINFO(4,"AssignDlyVar: "<<nodep<<endl);
|
||||||
|
|
@ -432,10 +432,10 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeFor* nodep, AstNUser*) {
|
virtual void visit(AstNodeFor* nodep) {
|
||||||
nodep->v3fatalSrc("For statements should have been converted to while statements in V3Begin\n");
|
nodep->v3fatalSrc("For statements should have been converted to while statements in V3Begin\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstWhile* nodep, AstNUser*) {
|
virtual void visit(AstWhile* nodep) {
|
||||||
bool oldloop = m_inLoop;
|
bool oldloop = m_inLoop;
|
||||||
m_inLoop = true;
|
m_inLoop = true;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -444,7 +444,7 @@ private:
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,14 +85,14 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
UINFO(4," MOD "<<nodep<<endl);
|
UINFO(4," MOD "<<nodep<<endl);
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
m_funcp = NULL;
|
m_funcp = NULL;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
m_funcp = nodep;
|
m_funcp = nodep;
|
||||||
m_depth = 0;
|
m_depth = 0;
|
||||||
m_maxdepth = 0;
|
m_maxdepth = 0;
|
||||||
|
|
@ -106,13 +106,13 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_stmtp = NULL;
|
m_stmtp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeStmt* nodep, AstNUser*) {
|
virtual void visit(AstNodeStmt* nodep) {
|
||||||
visitStmt(nodep);
|
visitStmt(nodep);
|
||||||
}
|
}
|
||||||
// Operators
|
// Operators
|
||||||
virtual void visit(AstNodeTermop* nodep, AstNUser*) {
|
virtual void visit(AstNodeTermop* nodep) {
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeMath* nodep, AstNUser*) {
|
virtual void visit(AstNodeMath* nodep) {
|
||||||
// We have some operator defines that use 2 parens, so += 2.
|
// We have some operator defines that use 2 parens, so += 2.
|
||||||
m_depth += 2;
|
m_depth += 2;
|
||||||
if (m_depth>m_maxdepth) m_maxdepth=m_depth;
|
if (m_depth>m_maxdepth) m_maxdepth=m_depth;
|
||||||
|
|
@ -139,19 +139,19 @@ private:
|
||||||
m_funcp->isStatic(false);
|
m_funcp->isStatic(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstUCFunc* nodep, AstNUser*) {
|
virtual void visit(AstUCFunc* nodep) {
|
||||||
needNonStaticFunc(nodep);
|
needNonStaticFunc(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstUCStmt* nodep, AstNUser*) {
|
virtual void visit(AstUCStmt* nodep) {
|
||||||
needNonStaticFunc(nodep);
|
needNonStaticFunc(nodep);
|
||||||
visitStmt(nodep);
|
visitStmt(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {} // Don't hit varrefs under vars
|
virtual void visit(AstVar* nodep) {} // Don't hit varrefs under vars
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,14 +76,14 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
UINFO(4," MOD "<<nodep<<endl);
|
UINFO(4," MOD "<<nodep<<endl);
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
m_deepNum = 0;
|
m_deepNum = 0;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
// We recurse into this.
|
// We recurse into this.
|
||||||
int lastDepth = m_depth;
|
int lastDepth = m_depth;
|
||||||
AstCFunc* lastFuncp = m_funcp;
|
AstCFunc* lastFuncp = m_funcp;
|
||||||
|
|
@ -111,15 +111,15 @@ private:
|
||||||
}
|
}
|
||||||
m_depth--;
|
m_depth--;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeStmt* nodep, AstNUser*) {
|
virtual void visit(AstNodeStmt* nodep) {
|
||||||
visitStmt(nodep);
|
visitStmt(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeMath* nodep, AstNUser*) {} // Accelerate
|
virtual void visit(AstNodeMath* nodep) {} // Accelerate
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {} // Don't hit varrefs under vars
|
virtual void visit(AstVar* nodep) {} // Don't hit varrefs under vars
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,24 +178,24 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
m_modFuncs.clear();
|
m_modFuncs.clear();
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
makePublicFuncWrappers();
|
makePublicFuncWrappers();
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
m_scopep = nodep;
|
m_scopep = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_scopep = NULL;
|
m_scopep = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarScope* nodep, AstNUser*) {
|
virtual void visit(AstVarScope* nodep) {
|
||||||
// Delete the varscope when we're finished
|
// Delete the varscope when we're finished
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
pushDeletep(nodep);
|
pushDeletep(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeVarRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeVarRef* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Convert the hierch name
|
// Convert the hierch name
|
||||||
if (!m_scopep) nodep->v3fatalSrc("Node not under scope");
|
if (!m_scopep) nodep->v3fatalSrc("Node not under scope");
|
||||||
|
|
@ -204,7 +204,7 @@ private:
|
||||||
nodep->hierThis(hierThis);
|
nodep->hierThis(hierThis);
|
||||||
nodep->varScopep(NULL);
|
nodep->varScopep(NULL);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCCall* nodep, AstNUser*) {
|
virtual void visit(AstCCall* nodep) {
|
||||||
//UINFO(9," "<<nodep<<endl);
|
//UINFO(9," "<<nodep<<endl);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Convert the hierch name
|
// Convert the hierch name
|
||||||
|
|
@ -215,7 +215,7 @@ private:
|
||||||
// Can't do this, as we may have more calls later
|
// Can't do this, as we may have more calls later
|
||||||
// nodep->funcp()->scopep(NULL);
|
// nodep->funcp()->scopep(NULL);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
if (!nodep->user1()) {
|
if (!nodep->user1()) {
|
||||||
m_needThis = false;
|
m_needThis = false;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -241,8 +241,8 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar*, AstNUser*) {}
|
virtual void visit(AstVar*) {}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
140
src/V3EmitC.cpp
140
src/V3EmitC.cpp
|
|
@ -132,7 +132,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
bool paren = true; bool decind = false;
|
bool paren = true; bool decind = false;
|
||||||
if (AstSel* selp=nodep->lhsp()->castSel()) {
|
if (AstSel* selp=nodep->lhsp()->castSel()) {
|
||||||
if (selp->widthMin()==1) {
|
if (selp->widthMin()==1) {
|
||||||
|
|
@ -195,9 +195,9 @@ public:
|
||||||
if (decind) ofp()->blockDec();
|
if (decind) ofp()->blockDec();
|
||||||
if (!m_suppressSemi) puts(";\n");
|
if (!m_suppressSemi) puts(";\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlwaysPublic*, AstNUser*) {
|
virtual void visit(AstAlwaysPublic*) {
|
||||||
}
|
}
|
||||||
virtual void visit(AstCCall* nodep, AstNUser*) {
|
virtual void visit(AstCCall* nodep) {
|
||||||
puts(nodep->hiername());
|
puts(nodep->hiername());
|
||||||
puts(nodep->funcp()->name());
|
puts(nodep->funcp()->name());
|
||||||
puts("(");
|
puts("(");
|
||||||
|
|
@ -215,15 +215,15 @@ public:
|
||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeCase* nodep, AstNUser*) {
|
virtual void visit(AstNodeCase* nodep) {
|
||||||
// In V3Case...
|
// In V3Case...
|
||||||
nodep->v3fatalSrc("Case statements should have been reduced out\n");
|
nodep->v3fatalSrc("Case statements should have been reduced out\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstComment* nodep, AstNUser*) {
|
virtual void visit(AstComment* nodep) {
|
||||||
putsDecoration((string)"// "+nodep->name()+" at "+nodep->fileline()->ascii()+"\n");
|
putsDecoration((string)"// "+nodep->name()+" at "+nodep->fileline()->ascii()+"\n");
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCoverDecl* nodep, AstNUser*) {
|
virtual void visit(AstCoverDecl* nodep) {
|
||||||
puts("__vlCoverInsert("); // As Declared in emitCoverageDecl
|
puts("__vlCoverInsert("); // As Declared in emitCoverageDecl
|
||||||
puts("&(vlSymsp->__Vcoverage[");
|
puts("&(vlSymsp->__Vcoverage[");
|
||||||
puts(cvtToStr(nodep->dataDeclThisp()->binNum())); puts("])");
|
puts(cvtToStr(nodep->dataDeclThisp()->binNum())); puts("])");
|
||||||
|
|
@ -241,22 +241,22 @@ public:
|
||||||
puts(", "); putsQuoted(nodep->comment());
|
puts(", "); putsQuoted(nodep->comment());
|
||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstCoverInc* nodep, AstNUser*) {
|
virtual void visit(AstCoverInc* nodep) {
|
||||||
puts("++(vlSymsp->__Vcoverage[");
|
puts("++(vlSymsp->__Vcoverage[");
|
||||||
puts(cvtToStr(nodep->declp()->dataDeclThisp()->binNum()));
|
puts(cvtToStr(nodep->declp()->dataDeclThisp()->binNum()));
|
||||||
puts("]);\n");
|
puts("]);\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstCReturn* nodep, AstNUser*) {
|
virtual void visit(AstCReturn* nodep) {
|
||||||
puts("return (");
|
puts("return (");
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstDisplay* nodep, AstNUser*) {
|
virtual void visit(AstDisplay* nodep) {
|
||||||
string text = nodep->fmtp()->text();
|
string text = nodep->fmtp()->text();
|
||||||
if (nodep->addNewline()) text += "\n";
|
if (nodep->addNewline()) text += "\n";
|
||||||
displayNode(nodep, nodep->fmtp()->scopeNamep(), text, nodep->fmtp()->exprsp(), false);
|
displayNode(nodep, nodep->fmtp()->scopeNamep(), text, nodep->fmtp()->exprsp(), false);
|
||||||
}
|
}
|
||||||
virtual void visit(AstScopeName* nodep, AstNUser*) {
|
virtual void visit(AstScopeName* nodep) {
|
||||||
// For use under AstCCalls for dpiImports. ScopeNames under displays are handled in AstDisplay
|
// For use under AstCCalls for dpiImports. ScopeNames under displays are handled in AstDisplay
|
||||||
if (!nodep->dpiExport()) {
|
if (!nodep->dpiExport()) {
|
||||||
// this is where the DPI import context scope is set
|
// this is where the DPI import context scope is set
|
||||||
|
|
@ -264,19 +264,19 @@ public:
|
||||||
putbs("(&(vlSymsp->__Vscope_"+scope+"))");
|
putbs("(&(vlSymsp->__Vscope_"+scope+"))");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstSFormat* nodep, AstNUser*) {
|
virtual void visit(AstSFormat* nodep) {
|
||||||
displayNode(nodep, nodep->fmtp()->scopeNamep(), nodep->fmtp()->text(), nodep->fmtp()->exprsp(), false);
|
displayNode(nodep, nodep->fmtp()->scopeNamep(), nodep->fmtp()->text(), nodep->fmtp()->exprsp(), false);
|
||||||
}
|
}
|
||||||
virtual void visit(AstSFormatF* nodep, AstNUser*) {
|
virtual void visit(AstSFormatF* nodep) {
|
||||||
displayNode(nodep, nodep->scopeNamep(), nodep->text(), nodep->exprsp(), false);
|
displayNode(nodep, nodep->scopeNamep(), nodep->text(), nodep->exprsp(), false);
|
||||||
}
|
}
|
||||||
virtual void visit(AstFScanF* nodep, AstNUser*) {
|
virtual void visit(AstFScanF* nodep) {
|
||||||
displayNode(nodep, NULL, nodep->text(), nodep->exprsp(), true);
|
displayNode(nodep, NULL, nodep->text(), nodep->exprsp(), true);
|
||||||
}
|
}
|
||||||
virtual void visit(AstSScanF* nodep, AstNUser*) {
|
virtual void visit(AstSScanF* nodep) {
|
||||||
displayNode(nodep, NULL, nodep->text(), nodep->exprsp(), true);
|
displayNode(nodep, NULL, nodep->text(), nodep->exprsp(), true);
|
||||||
}
|
}
|
||||||
virtual void visit(AstValuePlusArgs* nodep, AstNUser*) {
|
virtual void visit(AstValuePlusArgs* nodep) {
|
||||||
string prefix;
|
string prefix;
|
||||||
char format = '?';
|
char format = '?';
|
||||||
bool pct=false;
|
bool pct=false;
|
||||||
|
|
@ -327,12 +327,12 @@ public:
|
||||||
nodep->exprsp()->iterateAndNext(*this);
|
nodep->exprsp()->iterateAndNext(*this);
|
||||||
puts(")");
|
puts(")");
|
||||||
}
|
}
|
||||||
virtual void visit(AstTestPlusArgs* nodep, AstNUser*) {
|
virtual void visit(AstTestPlusArgs* nodep) {
|
||||||
puts("VL_TESTPLUSARGS_I(");
|
puts("VL_TESTPLUSARGS_I(");
|
||||||
putsQuoted(nodep->text());
|
putsQuoted(nodep->text());
|
||||||
puts(")");
|
puts(")");
|
||||||
}
|
}
|
||||||
virtual void visit(AstFGetS* nodep, AstNUser*) {
|
virtual void visit(AstFGetS* nodep) {
|
||||||
checkMaxWords(nodep);
|
checkMaxWords(nodep);
|
||||||
emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), NULL);
|
emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), NULL);
|
||||||
}
|
}
|
||||||
|
|
@ -342,7 +342,7 @@ public:
|
||||||
nodep->v3error("String of "<<nodep->width()<<" bits exceeds hardcoded limit VL_TO_STRING_MAX_WORDS in verilatedos.h");
|
nodep->v3error("String of "<<nodep->width()<<" bits exceeds hardcoded limit VL_TO_STRING_MAX_WORDS in verilatedos.h");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstFOpen* nodep, AstNUser*) {
|
virtual void visit(AstFOpen* nodep) {
|
||||||
nodep->filep()->iterateAndNext(*this);
|
nodep->filep()->iterateAndNext(*this);
|
||||||
puts(" = VL_FOPEN_");
|
puts(" = VL_FOPEN_");
|
||||||
emitIQW(nodep->filenamep());
|
emitIQW(nodep->filenamep());
|
||||||
|
|
@ -359,7 +359,7 @@ public:
|
||||||
nodep->modep()->iterateAndNext(*this);
|
nodep->modep()->iterateAndNext(*this);
|
||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstReadMem* nodep, AstNUser*) {
|
virtual void visit(AstReadMem* nodep) {
|
||||||
puts("VL_READMEM_");
|
puts("VL_READMEM_");
|
||||||
emitIQW(nodep->filenamep());
|
emitIQW(nodep->filenamep());
|
||||||
puts(" ("); // We take a void* rather than emitIQW(nodep->memp());
|
puts(" ("); // We take a void* rather than emitIQW(nodep->memp());
|
||||||
|
|
@ -393,14 +393,14 @@ public:
|
||||||
putbs(","); if (nodep->msbp()) { nodep->msbp()->iterateAndNext(*this); } else puts("~0");
|
putbs(","); if (nodep->msbp()) { nodep->msbp()->iterateAndNext(*this); } else puts("~0");
|
||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstFClose* nodep, AstNUser*) {
|
virtual void visit(AstFClose* nodep) {
|
||||||
puts("VL_FCLOSE_I(");
|
puts("VL_FCLOSE_I(");
|
||||||
nodep->filep()->iterateAndNext(*this);
|
nodep->filep()->iterateAndNext(*this);
|
||||||
puts("); ");
|
puts("); ");
|
||||||
nodep->filep()->iterateAndNext(*this); // For saftey, so user doesn't later WRITE with it.
|
nodep->filep()->iterateAndNext(*this); // For saftey, so user doesn't later WRITE with it.
|
||||||
puts("=0;\n");
|
puts("=0;\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstFFlush* nodep, AstNUser*) {
|
virtual void visit(AstFFlush* nodep) {
|
||||||
if (!nodep->filep()) {
|
if (!nodep->filep()) {
|
||||||
puts("fflush (stdout);\n");
|
puts("fflush (stdout);\n");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -411,7 +411,7 @@ public:
|
||||||
puts(")); }\n");
|
puts(")); }\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstSystemT* nodep, AstNUser*) {
|
virtual void visit(AstSystemT* nodep) {
|
||||||
puts("(void)VL_SYSTEM_I");
|
puts("(void)VL_SYSTEM_I");
|
||||||
emitIQW(nodep->lhsp());
|
emitIQW(nodep->lhsp());
|
||||||
puts("(");
|
puts("(");
|
||||||
|
|
@ -423,7 +423,7 @@ public:
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstSystemF* nodep, AstNUser*) {
|
virtual void visit(AstSystemF* nodep) {
|
||||||
puts("VL_SYSTEM_I");
|
puts("VL_SYSTEM_I");
|
||||||
emitIQW(nodep->lhsp());
|
emitIQW(nodep->lhsp());
|
||||||
puts("(");
|
puts("(");
|
||||||
|
|
@ -435,16 +435,16 @@ public:
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
puts(")");
|
puts(")");
|
||||||
}
|
}
|
||||||
virtual void visit(AstJumpGo* nodep, AstNUser*) {
|
virtual void visit(AstJumpGo* nodep) {
|
||||||
puts("goto __Vlabel"+cvtToStr(nodep->labelp()->labelNum())+";\n");
|
puts("goto __Vlabel"+cvtToStr(nodep->labelp()->labelNum())+";\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstJumpLabel* nodep, AstNUser*) {
|
virtual void visit(AstJumpLabel* nodep) {
|
||||||
puts("{\n");
|
puts("{\n");
|
||||||
nodep->stmtsp()->iterateAndNext(*this);
|
nodep->stmtsp()->iterateAndNext(*this);
|
||||||
puts("}\n");
|
puts("}\n");
|
||||||
puts("__Vlabel"+cvtToStr(nodep->labelNum())+": ;\n");
|
puts("__Vlabel"+cvtToStr(nodep->labelNum())+": ;\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstWhile* nodep, AstNUser*) {
|
virtual void visit(AstWhile* nodep) {
|
||||||
nodep->precondsp()->iterateAndNext(*this);
|
nodep->precondsp()->iterateAndNext(*this);
|
||||||
puts("while (");
|
puts("while (");
|
||||||
nodep->condp()->iterateAndNext(*this);
|
nodep->condp()->iterateAndNext(*this);
|
||||||
|
|
@ -454,7 +454,7 @@ public:
|
||||||
nodep->precondsp()->iterateAndNext(*this); // Need to recompute before next loop
|
nodep->precondsp()->iterateAndNext(*this); // Need to recompute before next loop
|
||||||
puts("}\n");
|
puts("}\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeIf* nodep, AstNUser*) {
|
virtual void visit(AstNodeIf* nodep) {
|
||||||
puts("if (");
|
puts("if (");
|
||||||
if (nodep->branchPred() != AstBranchPred::BP_UNKNOWN) {
|
if (nodep->branchPred() != AstBranchPred::BP_UNKNOWN) {
|
||||||
puts(nodep->branchPred().ascii()); puts("(");
|
puts(nodep->branchPred().ascii()); puts("(");
|
||||||
|
|
@ -469,41 +469,41 @@ public:
|
||||||
}
|
}
|
||||||
puts("}\n");
|
puts("}\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstStop* nodep, AstNUser*) {
|
virtual void visit(AstStop* nodep) {
|
||||||
puts("vl_stop(");
|
puts("vl_stop(");
|
||||||
putsQuoted(nodep->fileline()->filename());
|
putsQuoted(nodep->fileline()->filename());
|
||||||
puts(",");
|
puts(",");
|
||||||
puts(cvtToStr(nodep->fileline()->lineno()));
|
puts(cvtToStr(nodep->fileline()->lineno()));
|
||||||
puts(",\"\");\n");
|
puts(",\"\");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstFinish* nodep, AstNUser*) {
|
virtual void visit(AstFinish* nodep) {
|
||||||
puts("vl_finish(");
|
puts("vl_finish(");
|
||||||
putsQuoted(nodep->fileline()->filename());
|
putsQuoted(nodep->fileline()->filename());
|
||||||
puts(",");
|
puts(",");
|
||||||
puts(cvtToStr(nodep->fileline()->lineno()));
|
puts(cvtToStr(nodep->fileline()->lineno()));
|
||||||
puts(",\"\");\n");
|
puts(",\"\");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstText* nodep, AstNUser*) {
|
virtual void visit(AstText* nodep) {
|
||||||
if (nodep->tracking()) {
|
if (nodep->tracking()) {
|
||||||
puts(nodep->text());
|
puts(nodep->text());
|
||||||
} else {
|
} else {
|
||||||
ofp()->putsNoTracking(nodep->text());
|
ofp()->putsNoTracking(nodep->text());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstCStmt* nodep, AstNUser*) {
|
virtual void visit(AstCStmt* nodep) {
|
||||||
putbs("");
|
putbs("");
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCMath* nodep, AstNUser*) {
|
virtual void visit(AstCMath* nodep) {
|
||||||
putbs("");
|
putbs("");
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstUCStmt* nodep, AstNUser*) {
|
virtual void visit(AstUCStmt* nodep) {
|
||||||
putsDecoration("// $c statement at "+nodep->fileline()->ascii()+"\n");
|
putsDecoration("// $c statement at "+nodep->fileline()->ascii()+"\n");
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
puts("\n");
|
puts("\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstUCFunc* nodep, AstNUser*) {
|
virtual void visit(AstUCFunc* nodep) {
|
||||||
puts("\n");
|
puts("\n");
|
||||||
putsDecoration("// $c function at "+nodep->fileline()->ascii()+"\n");
|
putsDecoration("// $c function at "+nodep->fileline()->ascii()+"\n");
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
|
|
@ -511,10 +511,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Operators
|
// Operators
|
||||||
virtual void visit(AstNodeTermop* nodep, AstNUser*) {
|
virtual void visit(AstNodeTermop* nodep) {
|
||||||
emitOpName(nodep, nodep->emitC(), NULL, NULL, NULL);
|
emitOpName(nodep, nodep->emitC(), NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeUniop* nodep, AstNUser*) {
|
virtual void visit(AstNodeUniop* nodep) {
|
||||||
if (emitSimpleOk(nodep)) {
|
if (emitSimpleOk(nodep)) {
|
||||||
putbs("("); puts(nodep->emitSimpleOperator()); puts(" ");
|
putbs("("); puts(nodep->emitSimpleOperator()); puts(" ");
|
||||||
nodep->lhsp()->iterateAndNext(*this); puts(")");
|
nodep->lhsp()->iterateAndNext(*this); puts(")");
|
||||||
|
|
@ -522,7 +522,7 @@ public:
|
||||||
emitOpName(nodep, nodep->emitC(), nodep->lhsp(), NULL, NULL);
|
emitOpName(nodep, nodep->emitC(), nodep->lhsp(), NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeBiop* nodep, AstNUser*) {
|
virtual void visit(AstNodeBiop* nodep) {
|
||||||
if (emitSimpleOk(nodep)) {
|
if (emitSimpleOk(nodep)) {
|
||||||
putbs("("); nodep->lhsp()->iterateAndNext(*this);
|
putbs("("); nodep->lhsp()->iterateAndNext(*this);
|
||||||
puts(" "); putbs(nodep->emitSimpleOperator()); puts(" ");
|
puts(" "); putbs(nodep->emitSimpleOperator()); puts(" ");
|
||||||
|
|
@ -531,9 +531,9 @@ public:
|
||||||
emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), NULL);
|
emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstRedXor* nodep, AstNUser* vup) {
|
virtual void visit(AstRedXor* nodep) {
|
||||||
if (nodep->lhsp()->isWide()) {
|
if (nodep->lhsp()->isWide()) {
|
||||||
visit(nodep->castNodeUniop(), vup);
|
visit(nodep->castNodeUniop());
|
||||||
} else {
|
} else {
|
||||||
putbs("VL_REDXOR_");
|
putbs("VL_REDXOR_");
|
||||||
puts(cvtToStr(nodep->lhsp()->dtypep()->widthPow2()));
|
puts(cvtToStr(nodep->lhsp()->dtypep()->widthPow2()));
|
||||||
|
|
@ -542,13 +542,13 @@ public:
|
||||||
puts(")");
|
puts(")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstMulS* nodep, AstNUser* vup) {
|
virtual void visit(AstMulS* nodep) {
|
||||||
if (nodep->widthWords() > VL_MULS_MAX_WORDS) {
|
if (nodep->widthWords() > VL_MULS_MAX_WORDS) {
|
||||||
nodep->v3error("Unsupported: Signed multiply of "<<nodep->width()<<" bits exceeds hardcoded limit VL_MULS_MAX_WORDS in verilatedos.h");
|
nodep->v3error("Unsupported: Signed multiply of "<<nodep->width()<<" bits exceeds hardcoded limit VL_MULS_MAX_WORDS in verilatedos.h");
|
||||||
}
|
}
|
||||||
visit(nodep->castNodeBiop(), vup);
|
visit(nodep->castNodeBiop());
|
||||||
}
|
}
|
||||||
virtual void visit(AstCCast* nodep, AstNUser*) {
|
virtual void visit(AstCCast* nodep) {
|
||||||
// Extending a value of the same word width is just a NOP.
|
// Extending a value of the same word width is just a NOP.
|
||||||
if (nodep->size()>VL_WORDSIZE) {
|
if (nodep->size()>VL_WORDSIZE) {
|
||||||
puts("(QData)(");
|
puts("(QData)(");
|
||||||
|
|
@ -558,7 +558,7 @@ public:
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
puts(")");
|
puts(")");
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeCond* nodep, AstNUser*) {
|
virtual void visit(AstNodeCond* nodep) {
|
||||||
// Widths match up already, so we'll just use C++'s operator w/o any temps.
|
// Widths match up already, so we'll just use C++'s operator w/o any temps.
|
||||||
if (nodep->expr1p()->isWide()) {
|
if (nodep->expr1p()->isWide()) {
|
||||||
emitOpName(nodep, nodep->emitC(), nodep->condp(), nodep->expr1p(), nodep->expr2p());
|
emitOpName(nodep, nodep->emitC(), nodep->condp(), nodep->expr1p(), nodep->expr2p());
|
||||||
|
|
@ -569,11 +569,11 @@ public:
|
||||||
nodep->expr2p()->iterateAndNext(*this); puts(")");
|
nodep->expr2p()->iterateAndNext(*this); puts(")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstSel* nodep, AstNUser*) {
|
virtual void visit(AstSel* nodep) {
|
||||||
// Note ASSIGN checks for this on a LHS
|
// Note ASSIGN checks for this on a LHS
|
||||||
emitOpName(nodep, nodep->emitC(), nodep->fromp(), nodep->lsbp(), nodep->thsp());
|
emitOpName(nodep, nodep->emitC(), nodep->fromp(), nodep->lsbp(), nodep->thsp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstReplicate* nodep, AstNUser*) {
|
virtual void visit(AstReplicate* nodep) {
|
||||||
if (nodep->lhsp()->widthMin() == 1 && !nodep->isWide()) {
|
if (nodep->lhsp()->widthMin() == 1 && !nodep->isWide()) {
|
||||||
if (((int)nodep->rhsp()->castConst()->toUInt()
|
if (((int)nodep->rhsp()->castConst()->toUInt()
|
||||||
* nodep->lhsp()->widthMin()) != nodep->widthMin())
|
* nodep->lhsp()->widthMin()) != nodep->widthMin())
|
||||||
|
|
@ -591,7 +591,7 @@ public:
|
||||||
emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), NULL);
|
emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstStreamL* nodep, AstNUser*) {
|
virtual void visit(AstStreamL* nodep) {
|
||||||
// Attempt to use a "fast" stream function for slice size = power of 2
|
// Attempt to use a "fast" stream function for slice size = power of 2
|
||||||
if (!nodep->isWide()) {
|
if (!nodep->isWide()) {
|
||||||
uint32_t isPow2 = nodep->rhsp()->castConst()->num().countOnes() == 1;
|
uint32_t isPow2 = nodep->rhsp()->castConst()->num().countOnes() == 1;
|
||||||
|
|
@ -614,7 +614,7 @@ public:
|
||||||
emitOpName(nodep, "VL_STREAML_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)", nodep->lhsp(), nodep->rhsp(), NULL);
|
emitOpName(nodep, "VL_STREAML_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)", nodep->lhsp(), nodep->rhsp(), NULL);
|
||||||
}
|
}
|
||||||
// Terminals
|
// Terminals
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
puts(nodep->hiername());
|
puts(nodep->hiername());
|
||||||
puts(nodep->varp()->name());
|
puts(nodep->varp()->name());
|
||||||
}
|
}
|
||||||
|
|
@ -677,7 +677,7 @@ public:
|
||||||
emitConstant(constp, NULL, assignString);
|
emitConstant(constp, NULL, assignString);
|
||||||
puts(";\n");
|
puts(";\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) {
|
virtual void visit(AstConst* nodep) {
|
||||||
if (nodep->isWide()) {
|
if (nodep->isWide()) {
|
||||||
if (!m_wideTempRefp) nodep->v3fatalSrc("Wide Constant w/ no temp");
|
if (!m_wideTempRefp) nodep->v3fatalSrc("Wide Constant w/ no temp");
|
||||||
emitConstant(nodep, m_wideTempRefp, "");
|
emitConstant(nodep, m_wideTempRefp, "");
|
||||||
|
|
@ -688,26 +688,26 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Just iterate
|
// Just iterate
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstTopScope* nodep, AstNUser*) {
|
virtual void visit(AstTopScope* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
// NOPs
|
// NOPs
|
||||||
virtual void visit(AstTypedef*, AstNUser*) {}
|
virtual void visit(AstTypedef*) {}
|
||||||
virtual void visit(AstPragma*, AstNUser*) {}
|
virtual void visit(AstPragma*) {}
|
||||||
virtual void visit(AstCell*, AstNUser*) {} // Handled outside the Visit class
|
virtual void visit(AstCell*) {} // Handled outside the Visit class
|
||||||
virtual void visit(AstVar*, AstNUser*) {} // Handled outside the Visit class
|
virtual void visit(AstVar*) {} // Handled outside the Visit class
|
||||||
virtual void visit(AstNodeText*, AstNUser*) {} // Handled outside the Visit class
|
virtual void visit(AstNodeText*) {} // Handled outside the Visit class
|
||||||
virtual void visit(AstTraceDecl*, AstNUser*) {} // Handled outside the Visit class
|
virtual void visit(AstTraceDecl*) {} // Handled outside the Visit class
|
||||||
virtual void visit(AstTraceInc*, AstNUser*) {} // Handled outside the Visit class
|
virtual void visit(AstTraceInc*) {} // Handled outside the Visit class
|
||||||
virtual void visit(AstCFile*, AstNUser*) {} // Handled outside the Visit class
|
virtual void visit(AstCFile*) {} // Handled outside the Visit class
|
||||||
// Default
|
// Default
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
puts((string)"\n???? // "+nodep->prettyTypeName()+"\n");
|
puts((string)"\n???? // "+nodep->prettyTypeName()+"\n");
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
nodep->v3fatalSrc("Unknown node type reached emitter: "<<nodep->prettyTypeName());
|
nodep->v3fatalSrc("Unknown node type reached emitter: "<<nodep->prettyTypeName());
|
||||||
|
|
@ -821,7 +821,7 @@ class EmitCImp : EmitCStmts {
|
||||||
//---------------------------------------
|
//---------------------------------------
|
||||||
// VISITORS
|
// VISITORS
|
||||||
using EmitCStmts::visit; // Suppress hidden overloaded virtual function warnng
|
using EmitCStmts::visit; // Suppress hidden overloaded virtual function warnng
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
// TRACE_* and DPI handled elsewhere
|
// TRACE_* and DPI handled elsewhere
|
||||||
if (nodep->funcType().isTrace()) return;
|
if (nodep->funcType().isTrace()) return;
|
||||||
if (nodep->dpiImport()) return;
|
if (nodep->dpiImport()) return;
|
||||||
|
|
@ -908,11 +908,11 @@ class EmitCImp : EmitCStmts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstChangeDet* nodep, AstNUser*) {
|
virtual void visit(AstChangeDet* nodep) {
|
||||||
m_blkChangeDetVec.push_back(nodep);
|
m_blkChangeDetVec.push_back(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstCReset* nodep, AstNUser*) {
|
virtual void visit(AstCReset* nodep) {
|
||||||
AstVar* varp = nodep->varrefp()->varp();
|
AstVar* varp = nodep->varrefp()->varp();
|
||||||
emitVarReset(varp);
|
emitVarReset(varp);
|
||||||
}
|
}
|
||||||
|
|
@ -2357,14 +2357,14 @@ class EmitCTrace : EmitCStmts {
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
using EmitCStmts::visit; // Suppress hidden overloaded virtual function warnng
|
using EmitCStmts::visit; // Suppress hidden overloaded virtual function warnng
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
// Top module only
|
// Top module only
|
||||||
nodep->topModulep()->accept(*this);
|
nodep->topModulep()->accept(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
if (nodep->slow() != m_slow) return;
|
if (nodep->slow() != m_slow) return;
|
||||||
if (nodep->funcType().isTrace()) { // TRACE_*
|
if (nodep->funcType().isTrace()) { // TRACE_*
|
||||||
m_funcp = nodep;
|
m_funcp = nodep;
|
||||||
|
|
@ -2411,7 +2411,7 @@ class EmitCTrace : EmitCStmts {
|
||||||
}
|
}
|
||||||
m_funcp = NULL;
|
m_funcp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstTraceDecl* nodep, AstNUser*) {
|
virtual void visit(AstTraceDecl* nodep) {
|
||||||
if (nodep->arrayRange().ranged()) {
|
if (nodep->arrayRange().ranged()) {
|
||||||
puts("{int i; for (i=0; i<"+cvtToStr(nodep->arrayRange().elements())+"; i++) {\n");
|
puts("{int i; for (i=0; i<"+cvtToStr(nodep->arrayRange().elements())+"; i++) {\n");
|
||||||
emitTraceInitOne(nodep);
|
emitTraceInitOne(nodep);
|
||||||
|
|
@ -2421,7 +2421,7 @@ class EmitCTrace : EmitCStmts {
|
||||||
puts("\n");
|
puts("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstTraceInc* nodep, AstNUser*) {
|
virtual void visit(AstTraceInc* nodep) {
|
||||||
if (nodep->declp()->arrayRange().ranged()) {
|
if (nodep->declp()->arrayRange().ranged()) {
|
||||||
// It traces faster if we unroll the loop
|
// It traces faster if we unroll the loop
|
||||||
for (int i=0; i<nodep->declp()->arrayRange().elements(); i++) {
|
for (int i=0; i<nodep->declp()->arrayRange().elements(); i++) {
|
||||||
|
|
@ -2431,9 +2431,9 @@ class EmitCTrace : EmitCStmts {
|
||||||
emitTraceChangeOne(nodep, -1);
|
emitTraceChangeOne(nodep, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstCoverDecl* nodep, AstNUser*) {
|
virtual void visit(AstCoverDecl* nodep) {
|
||||||
}
|
}
|
||||||
virtual void visit(AstCoverInc* nodep, AstNUser*) {
|
virtual void visit(AstCoverInc* nodep) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ private:
|
||||||
// STATE
|
// STATE
|
||||||
int m_count; // Number of statements
|
int m_count; // Number of statements
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
m_count++;
|
m_count++;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class EmitCInlines : EmitCBaseVisitor {
|
||||||
void emitInt();
|
void emitInt();
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
// All wide constants load into variables, so we can just hunt for them
|
// All wide constants load into variables, so we can just hunt for them
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
int words = nodep->widthWords();
|
int words = nodep->widthWords();
|
||||||
|
|
@ -56,16 +56,16 @@ class EmitCInlines : EmitCBaseVisitor {
|
||||||
v3Global.needHInlines(true);
|
v3Global.needHInlines(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstBasicDType* nodep, AstNUser*) {
|
virtual void visit(AstBasicDType* nodep) {
|
||||||
if (nodep->keyword() == AstBasicDTypeKwd::STRING) {
|
if (nodep->keyword() == AstBasicDTypeKwd::STRING) {
|
||||||
v3Global.needHeavy(true); // #include <string> via verilated_heavy.h when we create symbol file
|
v3Global.needHeavy(true); // #include <string> via verilated_heavy.h when we create symbol file
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOPs
|
// NOPs
|
||||||
virtual void visit(AstNodeStmt*, AstNUser*) {}
|
virtual void visit(AstNodeStmt*) {}
|
||||||
// Default
|
// Default
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
//---------------------------------------
|
//---------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ class EmitCSyms : EmitCBaseVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
// Collect list of scopes
|
// Collect list of scopes
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
varsExpand();
|
varsExpand();
|
||||||
|
|
@ -180,18 +180,18 @@ class EmitCSyms : EmitCBaseVisitor {
|
||||||
emitDpiImp();
|
emitDpiImp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
nameCheck(nodep);
|
nameCheck(nodep);
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
m_labelNum = 0;
|
m_labelNum = 0;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
nameCheck(nodep);
|
nameCheck(nodep);
|
||||||
m_scopes.push_back(make_pair(nodep, m_modp));
|
m_scopes.push_back(make_pair(nodep, m_modp));
|
||||||
}
|
}
|
||||||
virtual void visit(AstScopeName* nodep, AstNUser*) {
|
virtual void visit(AstScopeName* nodep) {
|
||||||
string name = nodep->scopeSymName();
|
string name = nodep->scopeSymName();
|
||||||
//UINFO(9,"scnameins sp "<<nodep->name()<<" sp "<<nodep->scopePrettySymName()<<" ss "<<name<<endl);
|
//UINFO(9,"scnameins sp "<<nodep->name()<<" sp "<<nodep->scopePrettySymName()<<" ss "<<name<<endl);
|
||||||
if (m_scopeNames.find(name) == m_scopeNames.end()) {
|
if (m_scopeNames.find(name) == m_scopeNames.end()) {
|
||||||
|
|
@ -207,7 +207,7 @@ class EmitCSyms : EmitCBaseVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
nameCheck(nodep);
|
nameCheck(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->isSigUserRdPublic()
|
if (nodep->isSigUserRdPublic()
|
||||||
|
|
@ -215,17 +215,17 @@ class EmitCSyms : EmitCBaseVisitor {
|
||||||
m_modVars.push_back(make_pair(m_modp, nodep));
|
m_modVars.push_back(make_pair(m_modp, nodep));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstCoverDecl* nodep, AstNUser*) {
|
virtual void visit(AstCoverDecl* nodep) {
|
||||||
// Assign numbers to all bins, so we know how big of an array to use
|
// Assign numbers to all bins, so we know how big of an array to use
|
||||||
if (!nodep->dataDeclNullp()) { // else duplicate we don't need code for
|
if (!nodep->dataDeclNullp()) { // else duplicate we don't need code for
|
||||||
nodep->binNum(m_coverBins++);
|
nodep->binNum(m_coverBins++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstJumpLabel* nodep, AstNUser*) {
|
virtual void visit(AstJumpLabel* nodep) {
|
||||||
nodep->labelNum(++m_labelNum);
|
nodep->labelNum(++m_labelNum);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
nameCheck(nodep);
|
nameCheck(nodep);
|
||||||
if (nodep->dpiImport() || nodep->dpiExportWrapper()) {
|
if (nodep->dpiImport() || nodep->dpiExportWrapper()) {
|
||||||
m_dpis.push_back(nodep);
|
m_dpis.push_back(nodep);
|
||||||
|
|
@ -235,9 +235,9 @@ class EmitCSyms : EmitCBaseVisitor {
|
||||||
m_funcp = NULL;
|
m_funcp = NULL;
|
||||||
}
|
}
|
||||||
// NOPs
|
// NOPs
|
||||||
virtual void visit(AstConst*, AstNUser*) {}
|
virtual void visit(AstConst*) {}
|
||||||
// Default
|
// Default
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nameCheck(nodep);
|
nameCheck(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->v3fatalSrc("No visitors implemented.");
|
nodep->v3fatalSrc("No visitors implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
164
src/V3EmitV.cpp
164
src/V3EmitV.cpp
|
|
@ -62,15 +62,15 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
putfs(nodep, nodep->verilogKwd()+" "+modClassName(nodep)+";\n");
|
putfs(nodep, nodep->verilogKwd()+" "+modClassName(nodep)+";\n");
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
putqs(nodep, "end"+nodep->verilogKwd()+"\n");
|
putqs(nodep, "end"+nodep->verilogKwd()+"\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
putfs(nodep, nodep->isFunction() ? "function":"task");
|
putfs(nodep, nodep->isFunction() ? "function":"task");
|
||||||
puts(" ");
|
puts(" ");
|
||||||
puts(nodep->prettyName());
|
puts(nodep->prettyName());
|
||||||
|
|
@ -80,7 +80,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
putqs(nodep, "end\n");
|
putqs(nodep, "end\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstBegin* nodep, AstNUser*) {
|
virtual void visit(AstBegin* nodep) {
|
||||||
if (nodep->unnamed()) {
|
if (nodep->unnamed()) {
|
||||||
putbs("begin\n");
|
putbs("begin\n");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -89,22 +89,22 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
puts("end\n");
|
puts("end\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstGenerate* nodep, AstNUser*) {
|
virtual void visit(AstGenerate* nodep) {
|
||||||
putfs(nodep, "generate\n");
|
putfs(nodep, "generate\n");
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
putqs(nodep, "end\n");
|
putqs(nodep, "end\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstFinal* nodep, AstNUser*) {
|
virtual void visit(AstFinal* nodep) {
|
||||||
putfs(nodep, "final begin\n");
|
putfs(nodep, "final begin\n");
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
putqs(nodep, "end\n");
|
putqs(nodep, "end\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstInitial* nodep, AstNUser*) {
|
virtual void visit(AstInitial* nodep) {
|
||||||
putfs(nodep,"initial begin\n");
|
putfs(nodep,"initial begin\n");
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
putqs(nodep, "end\n");
|
putqs(nodep, "end\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
putfs(nodep,"always ");
|
putfs(nodep,"always ");
|
||||||
if (m_sensesp) m_sensesp->iterateAndNext(*this); // In active
|
if (m_sensesp) m_sensesp->iterateAndNext(*this); // In active
|
||||||
else nodep->sensesp()->iterateAndNext(*this);
|
else nodep->sensesp()->iterateAndNext(*this);
|
||||||
|
|
@ -112,7 +112,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
putqs(nodep,"end\n");
|
putqs(nodep,"end\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlwaysPublic* nodep, AstNUser*) {
|
virtual void visit(AstAlwaysPublic* nodep) {
|
||||||
putfs(nodep,"/*verilator public_flat_rw ");
|
putfs(nodep,"/*verilator public_flat_rw ");
|
||||||
if (m_sensesp) m_sensesp->iterateAndNext(*this); // In active
|
if (m_sensesp) m_sensesp->iterateAndNext(*this); // In active
|
||||||
else nodep->sensesp()->iterateAndNext(*this);
|
else nodep->sensesp()->iterateAndNext(*this);
|
||||||
|
|
@ -120,37 +120,37 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
putqs(nodep,"*/\n");
|
putqs(nodep,"*/\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
putfs(nodep," "+nodep->verilogKwd()+" ");
|
putfs(nodep," "+nodep->verilogKwd()+" ");
|
||||||
nodep->rhsp()->iterateAndNext(*this);
|
nodep->rhsp()->iterateAndNext(*this);
|
||||||
if (!m_suppressSemi) puts(";\n");
|
if (!m_suppressSemi) puts(";\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignDly* nodep, AstNUser*) {
|
virtual void visit(AstAssignDly* nodep) {
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
putfs(nodep," <= ");
|
putfs(nodep," <= ");
|
||||||
nodep->rhsp()->iterateAndNext(*this);
|
nodep->rhsp()->iterateAndNext(*this);
|
||||||
puts(";\n");
|
puts(";\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignAlias* nodep, AstNUser*) {
|
virtual void visit(AstAssignAlias* nodep) {
|
||||||
putbs("alias ");
|
putbs("alias ");
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
putfs(nodep," = ");
|
putfs(nodep," = ");
|
||||||
nodep->rhsp()->iterateAndNext(*this);
|
nodep->rhsp()->iterateAndNext(*this);
|
||||||
if (!m_suppressSemi) puts(";\n");
|
if (!m_suppressSemi) puts(";\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignW* nodep, AstNUser*) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
putfs(nodep,"assign ");
|
putfs(nodep,"assign ");
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
putbs(" = ");
|
putbs(" = ");
|
||||||
nodep->rhsp()->iterateAndNext(*this);
|
nodep->rhsp()->iterateAndNext(*this);
|
||||||
if (!m_suppressSemi) puts(";\n");
|
if (!m_suppressSemi) puts(";\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstBreak* nodep, AstNUser*) {
|
virtual void visit(AstBreak* nodep) {
|
||||||
putbs("break");
|
putbs("break");
|
||||||
if (!m_suppressSemi) puts(";\n");
|
if (!m_suppressSemi) puts(";\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenTree* nodep, AstNUser*) {
|
virtual void visit(AstSenTree* nodep) {
|
||||||
// AstSenItem is called for dumping in isolation by V3Order
|
// AstSenItem is called for dumping in isolation by V3Order
|
||||||
putfs(nodep,"@(");
|
putfs(nodep,"@(");
|
||||||
for (AstNode* expp=nodep->sensesp(); expp; expp = expp->nextp()) {
|
for (AstNode* expp=nodep->sensesp(); expp; expp = expp->nextp()) {
|
||||||
|
|
@ -159,16 +159,16 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
}
|
}
|
||||||
puts(")");
|
puts(")");
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenGate* nodep, AstNUser*) {
|
virtual void visit(AstSenGate* nodep) {
|
||||||
emitVerilogFormat(nodep, nodep->emitVerilog(), nodep->sensesp(), nodep->rhsp());
|
emitVerilogFormat(nodep, nodep->emitVerilog(), nodep->sensesp(), nodep->rhsp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenItem* nodep, AstNUser*) {
|
virtual void visit(AstSenItem* nodep) {
|
||||||
putfs(nodep,"");
|
putfs(nodep,"");
|
||||||
puts(nodep->edgeType().verilogKwd());
|
puts(nodep->edgeType().verilogKwd());
|
||||||
if (nodep->sensp()) puts(" ");
|
if (nodep->sensp()) puts(" ");
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeCase* nodep, AstNUser*) {
|
virtual void visit(AstNodeCase* nodep) {
|
||||||
putfs(nodep,"");
|
putfs(nodep,"");
|
||||||
if (AstCase* casep = nodep->castCase()) {
|
if (AstCase* casep = nodep->castCase()) {
|
||||||
if (casep->priorityPragma()) puts("priority ");
|
if (casep->priorityPragma()) puts("priority ");
|
||||||
|
|
@ -189,7 +189,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
nodep->itemsp()->iterateAndNext(*this);
|
nodep->itemsp()->iterateAndNext(*this);
|
||||||
putqs(nodep,"endcase\n");
|
putqs(nodep,"endcase\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstCaseItem* nodep, AstNUser*) {
|
virtual void visit(AstCaseItem* nodep) {
|
||||||
if (nodep->condsp()) {
|
if (nodep->condsp()) {
|
||||||
nodep->condsp()->iterateAndNext(*this);
|
nodep->condsp()->iterateAndNext(*this);
|
||||||
} else putbs("default");
|
} else putbs("default");
|
||||||
|
|
@ -197,17 +197,17 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
putqs(nodep,"end\n");
|
putqs(nodep,"end\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstComment* nodep, AstNUser*) {
|
virtual void visit(AstComment* nodep) {
|
||||||
puts((string)"// "+nodep->name()+"\n");
|
puts((string)"// "+nodep->name()+"\n");
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstContinue* nodep, AstNUser*) {
|
virtual void visit(AstContinue* nodep) {
|
||||||
putbs("continue");
|
putbs("continue");
|
||||||
if (!m_suppressSemi) puts(";\n");
|
if (!m_suppressSemi) puts(";\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstCoverDecl*, AstNUser*) {} // N/A
|
virtual void visit(AstCoverDecl*) {} // N/A
|
||||||
virtual void visit(AstCoverInc*, AstNUser*) {} // N/A
|
virtual void visit(AstCoverInc*) {} // N/A
|
||||||
virtual void visit(AstCoverToggle*, AstNUser*) {} // N/A
|
virtual void visit(AstCoverToggle*) {} // N/A
|
||||||
|
|
||||||
void visitNodeDisplay(AstNode* nodep, AstNode* fileOrStrgp, const string& text, AstNode* exprsp) {
|
void visitNodeDisplay(AstNode* nodep, AstNode* fileOrStrgp, const string& text, AstNode* exprsp) {
|
||||||
putfs(nodep,nodep->verilogKwd());
|
putfs(nodep,nodep->verilogKwd());
|
||||||
|
|
@ -220,29 +220,29 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
}
|
}
|
||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstDisable* nodep, AstNUser*) {
|
virtual void visit(AstDisable* nodep) {
|
||||||
putbs("disable "+nodep->name()+";\n");
|
putbs("disable "+nodep->name()+";\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstDisplay* nodep, AstNUser*) {
|
virtual void visit(AstDisplay* nodep) {
|
||||||
visitNodeDisplay(nodep, nodep->filep(), nodep->fmtp()->text(), nodep->fmtp()->exprsp());
|
visitNodeDisplay(nodep, nodep->filep(), nodep->fmtp()->text(), nodep->fmtp()->exprsp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstFScanF* nodep, AstNUser*) {
|
virtual void visit(AstFScanF* nodep) {
|
||||||
visitNodeDisplay(nodep, nodep->filep(), nodep->text(), nodep->exprsp());
|
visitNodeDisplay(nodep, nodep->filep(), nodep->text(), nodep->exprsp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstSScanF* nodep, AstNUser*) {
|
virtual void visit(AstSScanF* nodep) {
|
||||||
visitNodeDisplay(nodep, nodep->fromp(), nodep->text(), nodep->exprsp());
|
visitNodeDisplay(nodep, nodep->fromp(), nodep->text(), nodep->exprsp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstSFormat* nodep, AstNUser*) {
|
virtual void visit(AstSFormat* nodep) {
|
||||||
visitNodeDisplay(nodep, nodep->lhsp(), nodep->fmtp()->text(), nodep->fmtp()->exprsp());
|
visitNodeDisplay(nodep, nodep->lhsp(), nodep->fmtp()->text(), nodep->fmtp()->exprsp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstSFormatF* nodep, AstNUser*) {
|
virtual void visit(AstSFormatF* nodep) {
|
||||||
visitNodeDisplay(nodep, NULL, nodep->text(), nodep->exprsp());
|
visitNodeDisplay(nodep, NULL, nodep->text(), nodep->exprsp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstValuePlusArgs* nodep, AstNUser*) {
|
virtual void visit(AstValuePlusArgs* nodep) {
|
||||||
visitNodeDisplay(nodep, NULL, nodep->text(), nodep->exprsp());
|
visitNodeDisplay(nodep, NULL, nodep->text(), nodep->exprsp());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstFOpen* nodep, AstNUser*) {
|
virtual void visit(AstFOpen* nodep) {
|
||||||
putfs(nodep,nodep->verilogKwd());
|
putfs(nodep,nodep->verilogKwd());
|
||||||
putbs(" (");
|
putbs(" (");
|
||||||
if (nodep->filep()) nodep->filep()->iterateAndNext(*this);
|
if (nodep->filep()) nodep->filep()->iterateAndNext(*this);
|
||||||
|
|
@ -252,27 +252,27 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
if (nodep->modep()) nodep->modep()->iterateAndNext(*this);
|
if (nodep->modep()) nodep->modep()->iterateAndNext(*this);
|
||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstFClose* nodep, AstNUser*) {
|
virtual void visit(AstFClose* nodep) {
|
||||||
putfs(nodep,nodep->verilogKwd());
|
putfs(nodep,nodep->verilogKwd());
|
||||||
putbs(" (");
|
putbs(" (");
|
||||||
if (nodep->filep()) nodep->filep()->iterateAndNext(*this);
|
if (nodep->filep()) nodep->filep()->iterateAndNext(*this);
|
||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstFFlush* nodep, AstNUser*) {
|
virtual void visit(AstFFlush* nodep) {
|
||||||
putfs(nodep,nodep->verilogKwd());
|
putfs(nodep,nodep->verilogKwd());
|
||||||
putbs(" (");
|
putbs(" (");
|
||||||
if (nodep->filep()) nodep->filep()->iterateAndNext(*this);
|
if (nodep->filep()) nodep->filep()->iterateAndNext(*this);
|
||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstJumpGo* nodep, AstNUser*) {
|
virtual void visit(AstJumpGo* nodep) {
|
||||||
putbs("disable "+cvtToStr((void*)(nodep->labelp()))+";\n");
|
putbs("disable "+cvtToStr((void*)(nodep->labelp()))+";\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstJumpLabel* nodep, AstNUser*) {
|
virtual void visit(AstJumpLabel* nodep) {
|
||||||
putbs("begin : "+cvtToStr((void*)(nodep))+"\n");
|
putbs("begin : "+cvtToStr((void*)(nodep))+"\n");
|
||||||
if (nodep->stmtsp()) nodep->stmtsp()->iterateAndNext(*this);
|
if (nodep->stmtsp()) nodep->stmtsp()->iterateAndNext(*this);
|
||||||
puts("end\n");
|
puts("end\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstReadMem* nodep, AstNUser*) {
|
virtual void visit(AstReadMem* nodep) {
|
||||||
putfs(nodep,nodep->verilogKwd());
|
putfs(nodep,nodep->verilogKwd());
|
||||||
putbs(" (");
|
putbs(" (");
|
||||||
if (nodep->filenamep()) nodep->filenamep()->iterateAndNext(*this);
|
if (nodep->filenamep()) nodep->filenamep()->iterateAndNext(*this);
|
||||||
|
|
@ -282,13 +282,13 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
if (nodep->msbp()) { putbs(","); nodep->msbp()->iterateAndNext(*this); }
|
if (nodep->msbp()) { putbs(","); nodep->msbp()->iterateAndNext(*this); }
|
||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstSysIgnore* nodep, AstNUser*) {
|
virtual void visit(AstSysIgnore* nodep) {
|
||||||
putfs(nodep,nodep->verilogKwd());
|
putfs(nodep,nodep->verilogKwd());
|
||||||
putbs(" (");
|
putbs(" (");
|
||||||
nodep->exprsp()->iterateAndNext(*this);
|
nodep->exprsp()->iterateAndNext(*this);
|
||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFor* nodep, AstNUser*) {
|
virtual void visit(AstNodeFor* nodep) {
|
||||||
putfs(nodep,"for (");
|
putfs(nodep,"for (");
|
||||||
m_suppressSemi = true;
|
m_suppressSemi = true;
|
||||||
nodep->initsp()->iterateAndNext(*this);
|
nodep->initsp()->iterateAndNext(*this);
|
||||||
|
|
@ -301,14 +301,14 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
putqs(nodep,"end\n");
|
putqs(nodep,"end\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstRepeat* nodep, AstNUser*) {
|
virtual void visit(AstRepeat* nodep) {
|
||||||
putfs(nodep,"repeat (");
|
putfs(nodep,"repeat (");
|
||||||
nodep->countp()->iterateAndNext(*this);
|
nodep->countp()->iterateAndNext(*this);
|
||||||
puts(") begin\n");
|
puts(") begin\n");
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
putfs(nodep,"end\n");
|
putfs(nodep,"end\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstWhile* nodep, AstNUser*) {
|
virtual void visit(AstWhile* nodep) {
|
||||||
nodep->precondsp()->iterateAndNext(*this);
|
nodep->precondsp()->iterateAndNext(*this);
|
||||||
putfs(nodep,"while (");
|
putfs(nodep,"while (");
|
||||||
nodep->condp()->iterateAndNext(*this);
|
nodep->condp()->iterateAndNext(*this);
|
||||||
|
|
@ -318,7 +318,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
nodep->precondsp()->iterateAndNext(*this); // Need to recompute before next loop
|
nodep->precondsp()->iterateAndNext(*this); // Need to recompute before next loop
|
||||||
putfs(nodep,"end\n");
|
putfs(nodep,"end\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeIf* nodep, AstNUser*) {
|
virtual void visit(AstNodeIf* nodep) {
|
||||||
putfs(nodep,"");
|
putfs(nodep,"");
|
||||||
if (AstIf* ifp = nodep->castIf()) {
|
if (AstIf* ifp = nodep->castIf()) {
|
||||||
if (ifp->priorityPragma()) puts("priority ");
|
if (ifp->priorityPragma()) puts("priority ");
|
||||||
|
|
@ -336,38 +336,38 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
}
|
}
|
||||||
putqs(nodep,"end\n");
|
putqs(nodep,"end\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstReturn* nodep, AstNUser*) {
|
virtual void visit(AstReturn* nodep) {
|
||||||
putfs(nodep,"return ");
|
putfs(nodep,"return ");
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
puts(";\n");
|
puts(";\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstStop* nodep, AstNUser*) {
|
virtual void visit(AstStop* nodep) {
|
||||||
putfs(nodep,"$stop;\n");
|
putfs(nodep,"$stop;\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstFinish* nodep, AstNUser*) {
|
virtual void visit(AstFinish* nodep) {
|
||||||
putfs(nodep,"$finish;\n");
|
putfs(nodep,"$finish;\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstText* nodep, AstNUser*) {
|
virtual void visit(AstText* nodep) {
|
||||||
putsNoTracking(nodep->text());
|
putsNoTracking(nodep->text());
|
||||||
}
|
}
|
||||||
virtual void visit(AstScopeName* nodep, AstNUser*) {
|
virtual void visit(AstScopeName* nodep) {
|
||||||
}
|
}
|
||||||
virtual void visit(AstCStmt* nodep, AstNUser*) {
|
virtual void visit(AstCStmt* nodep) {
|
||||||
putfs(nodep,"$_CSTMT(");
|
putfs(nodep,"$_CSTMT(");
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstCMath* nodep, AstNUser*) {
|
virtual void visit(AstCMath* nodep) {
|
||||||
putfs(nodep,"$_CMATH(");
|
putfs(nodep,"$_CMATH(");
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstUCStmt* nodep, AstNUser*) {
|
virtual void visit(AstUCStmt* nodep) {
|
||||||
putfs(nodep,"$c(");
|
putfs(nodep,"$c(");
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
puts(");\n");
|
puts(");\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstUCFunc* nodep, AstNUser*) {
|
virtual void visit(AstUCFunc* nodep) {
|
||||||
putfs(nodep,"$c(");
|
putfs(nodep,"$c(");
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
puts(")");
|
puts(")");
|
||||||
|
|
@ -425,19 +425,19 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeTermop* nodep, AstNUser*) {
|
virtual void visit(AstNodeTermop* nodep) {
|
||||||
emitVerilogFormat(nodep, nodep->emitVerilog());
|
emitVerilogFormat(nodep, nodep->emitVerilog());
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeUniop* nodep, AstNUser*) {
|
virtual void visit(AstNodeUniop* nodep) {
|
||||||
emitVerilogFormat(nodep, nodep->emitVerilog(), nodep->lhsp());
|
emitVerilogFormat(nodep, nodep->emitVerilog(), nodep->lhsp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeBiop* nodep, AstNUser*) {
|
virtual void visit(AstNodeBiop* nodep) {
|
||||||
emitVerilogFormat(nodep, nodep->emitVerilog(), nodep->lhsp(), nodep->rhsp());
|
emitVerilogFormat(nodep, nodep->emitVerilog(), nodep->lhsp(), nodep->rhsp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeTriop* nodep, AstNUser*) {
|
virtual void visit(AstNodeTriop* nodep) {
|
||||||
emitVerilogFormat(nodep, nodep->emitVerilog(), nodep->lhsp(), nodep->rhsp(), nodep->thsp());
|
emitVerilogFormat(nodep, nodep->emitVerilog(), nodep->lhsp(), nodep->rhsp(), nodep->thsp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstAttrOf* nodep, AstNUser*) {
|
virtual void visit(AstAttrOf* nodep) {
|
||||||
putfs(nodep,"$_ATTROF(");
|
putfs(nodep,"$_ATTROF(");
|
||||||
nodep->fromp()->iterateAndNext(*this);
|
nodep->fromp()->iterateAndNext(*this);
|
||||||
if (nodep->dimp()) {
|
if (nodep->dimp()) {
|
||||||
|
|
@ -446,7 +446,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
}
|
}
|
||||||
puts(")");
|
puts(")");
|
||||||
}
|
}
|
||||||
virtual void visit(AstInitArray* nodep, AstNUser*) {
|
virtual void visit(AstInitArray* nodep) {
|
||||||
putfs(nodep,"`{");
|
putfs(nodep,"`{");
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
for (AstNode* itemp = nodep->initsp(); itemp; ++pos, itemp=itemp->nextp()) {
|
for (AstNode* itemp = nodep->initsp(); itemp; ++pos, itemp=itemp->nextp()) {
|
||||||
|
|
@ -458,13 +458,13 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
}
|
}
|
||||||
puts("}");
|
puts("}");
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeCond* nodep, AstNUser*) {
|
virtual void visit(AstNodeCond* nodep) {
|
||||||
putbs("(");
|
putbs("(");
|
||||||
nodep->condp()->iterateAndNext(*this); putfs(nodep," ? ");
|
nodep->condp()->iterateAndNext(*this); putfs(nodep," ? ");
|
||||||
nodep->expr1p()->iterateAndNext(*this); putbs(" : ");
|
nodep->expr1p()->iterateAndNext(*this); putbs(" : ");
|
||||||
nodep->expr2p()->iterateAndNext(*this); puts(")");
|
nodep->expr2p()->iterateAndNext(*this); puts(")");
|
||||||
}
|
}
|
||||||
virtual void visit(AstRange* nodep, AstNUser*) {
|
virtual void visit(AstRange* nodep) {
|
||||||
puts("[");
|
puts("[");
|
||||||
if (nodep->msbp()->castConst() && nodep->lsbp()->castConst()) {
|
if (nodep->msbp()->castConst() && nodep->lsbp()->castConst()) {
|
||||||
// Looks nicer if we print [1:0] rather than [32'sh1:32sh0]
|
// Looks nicer if we print [1:0] rather than [32'sh1:32sh0]
|
||||||
|
|
@ -475,7 +475,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
nodep->rightp()->iterateAndNext(*this); puts("]");
|
nodep->rightp()->iterateAndNext(*this); puts("]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstSel* nodep, AstNUser*) {
|
virtual void visit(AstSel* nodep) {
|
||||||
nodep->fromp()->iterateAndNext(*this); puts("[");
|
nodep->fromp()->iterateAndNext(*this); puts("[");
|
||||||
if (nodep->lsbp()->castConst()) {
|
if (nodep->lsbp()->castConst()) {
|
||||||
if (nodep->widthp()->isOne()) {
|
if (nodep->widthp()->isOne()) {
|
||||||
|
|
@ -497,51 +497,51 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
}
|
}
|
||||||
puts("]");
|
puts("]");
|
||||||
}
|
}
|
||||||
virtual void visit(AstTypedef* nodep, AstNUser*) {
|
virtual void visit(AstTypedef* nodep) {
|
||||||
putfs(nodep,"typedef ");
|
putfs(nodep,"typedef ");
|
||||||
nodep->dtypep()->iterateAndNext(*this); puts(" ");
|
nodep->dtypep()->iterateAndNext(*this); puts(" ");
|
||||||
puts(nodep->prettyName());
|
puts(nodep->prettyName());
|
||||||
puts(";\n");
|
puts(";\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstBasicDType* nodep, AstNUser*) {
|
virtual void visit(AstBasicDType* nodep) {
|
||||||
if (nodep->isSigned()) putfs(nodep,"signed ");
|
if (nodep->isSigned()) putfs(nodep,"signed ");
|
||||||
putfs(nodep,nodep->prettyName());
|
putfs(nodep,nodep->prettyName());
|
||||||
if (nodep->rangep()) { puts(" "); nodep->rangep()->iterateAndNext(*this); puts(" "); }
|
if (nodep->rangep()) { puts(" "); nodep->rangep()->iterateAndNext(*this); puts(" "); }
|
||||||
else if (nodep->isRanged()) { puts(" ["); puts(cvtToStr(nodep->msb())); puts(":0] "); }
|
else if (nodep->isRanged()) { puts(" ["); puts(cvtToStr(nodep->msb())); puts(":0] "); }
|
||||||
}
|
}
|
||||||
virtual void visit(AstConstDType* nodep, AstNUser*) {
|
virtual void visit(AstConstDType* nodep) {
|
||||||
putfs(nodep,"const ");
|
putfs(nodep,"const ");
|
||||||
nodep->subDTypep()->accept(*this);
|
nodep->subDTypep()->accept(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeArrayDType* nodep, AstNUser*) {
|
virtual void visit(AstNodeArrayDType* nodep) {
|
||||||
nodep->subDTypep()->accept(*this);
|
nodep->subDTypep()->accept(*this);
|
||||||
nodep->rangep()->iterateAndNext(*this);
|
nodep->rangep()->iterateAndNext(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeClassDType* nodep, AstNUser*) {
|
virtual void visit(AstNodeClassDType* nodep) {
|
||||||
puts(nodep->verilogKwd()+" ");
|
puts(nodep->verilogKwd()+" ");
|
||||||
if (nodep->packed()) puts("packed ");
|
if (nodep->packed()) puts("packed ");
|
||||||
puts("\n");
|
puts("\n");
|
||||||
nodep->membersp()->iterateAndNext(*this);
|
nodep->membersp()->iterateAndNext(*this);
|
||||||
puts("}");
|
puts("}");
|
||||||
}
|
}
|
||||||
virtual void visit(AstMemberDType* nodep, AstNUser*) {
|
virtual void visit(AstMemberDType* nodep) {
|
||||||
nodep->subDTypep()->accept(*this);
|
nodep->subDTypep()->accept(*this);
|
||||||
puts(" ");
|
puts(" ");
|
||||||
puts(nodep->name());
|
puts(nodep->name());
|
||||||
puts("}");
|
puts("}");
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||||
if (nodep->dotted()!="") { putfs(nodep,nodep->dotted()); puts("."); puts(nodep->prettyName()); }
|
if (nodep->dotted()!="") { putfs(nodep,nodep->dotted()); puts("."); puts(nodep->prettyName()); }
|
||||||
else { putfs(nodep,nodep->prettyName()); }
|
else { putfs(nodep,nodep->prettyName()); }
|
||||||
puts("(");
|
puts("(");
|
||||||
nodep->pinsp()->iterateAndNext(*this);
|
nodep->pinsp()->iterateAndNext(*this);
|
||||||
puts(")");
|
puts(")");
|
||||||
}
|
}
|
||||||
virtual void visit(AstArg* nodep, AstNUser*) {
|
virtual void visit(AstArg* nodep) {
|
||||||
nodep->exprp()->iterateAndNext(*this);
|
nodep->exprp()->iterateAndNext(*this);
|
||||||
}
|
}
|
||||||
// Terminals
|
// Terminals
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (nodep->varScopep())
|
if (nodep->varScopep())
|
||||||
putfs(nodep,nodep->varScopep()->prettyName());
|
putfs(nodep,nodep->varScopep()->prettyName());
|
||||||
else {
|
else {
|
||||||
|
|
@ -549,43 +549,43 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
||||||
puts(nodep->varp()->prettyName());
|
puts(nodep->varp()->prettyName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarXRef* nodep, AstNUser*) {
|
virtual void visit(AstVarXRef* nodep) {
|
||||||
putfs(nodep,nodep->dotted());
|
putfs(nodep,nodep->dotted());
|
||||||
puts(".");
|
puts(".");
|
||||||
puts(nodep->varp()->prettyName());
|
puts(nodep->varp()->prettyName());
|
||||||
}
|
}
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) {
|
virtual void visit(AstConst* nodep) {
|
||||||
putfs(nodep,nodep->num().ascii(true,true));
|
putfs(nodep,nodep->num().ascii(true,true));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Just iterate
|
// Just iterate
|
||||||
virtual void visit(AstTopScope* nodep, AstNUser*) {
|
virtual void visit(AstTopScope* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
putfs(nodep,nodep->verilogKwd());
|
putfs(nodep,nodep->verilogKwd());
|
||||||
puts(" ");
|
puts(" ");
|
||||||
nodep->dtypep()->iterate(*this); puts(" ");
|
nodep->dtypep()->iterate(*this); puts(" ");
|
||||||
puts(nodep->prettyName());
|
puts(nodep->prettyName());
|
||||||
puts(";\n");
|
puts(";\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstActive* nodep, AstNUser*) {
|
virtual void visit(AstActive* nodep) {
|
||||||
m_sensesp = nodep->sensesp();
|
m_sensesp = nodep->sensesp();
|
||||||
nodep->stmtsp()->iterateAndNext(*this);
|
nodep->stmtsp()->iterateAndNext(*this);
|
||||||
m_sensesp = NULL;
|
m_sensesp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarScope*, AstNUser*) {}
|
virtual void visit(AstVarScope*) {}
|
||||||
virtual void visit(AstNodeText*, AstNUser*) {}
|
virtual void visit(AstNodeText*) {}
|
||||||
virtual void visit(AstTraceDecl*, AstNUser*) {}
|
virtual void visit(AstTraceDecl*) {}
|
||||||
virtual void visit(AstTraceInc*, AstNUser*) {}
|
virtual void visit(AstTraceInc*) {}
|
||||||
// NOPs
|
// NOPs
|
||||||
virtual void visit(AstPragma*, AstNUser*) {}
|
virtual void visit(AstPragma*) {}
|
||||||
virtual void visit(AstCell*, AstNUser*) {} // Handled outside the Visit class
|
virtual void visit(AstCell*) {} // Handled outside the Visit class
|
||||||
// Default
|
// Default
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
puts((string)"\n???? // "+nodep->prettyTypeName()+"\n");
|
puts((string)"\n???? // "+nodep->prettyTypeName()+"\n");
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Not v3fatalSrc so we keep processing
|
// Not v3fatalSrc so we keep processing
|
||||||
|
|
|
||||||
|
|
@ -81,23 +81,23 @@ class EmitXmlFileVisitor : public AstNVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
puts("<netlist>\n");
|
puts("<netlist>\n");
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
puts("</netlist>\n");
|
puts("</netlist>\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
outputTag(nodep, "");
|
outputTag(nodep, "");
|
||||||
if (nodep->level()==1 || nodep->level()==2) // ==2 because we don't add wrapper when in XML mode
|
if (nodep->level()==1 || nodep->level()==2) // ==2 because we don't add wrapper when in XML mode
|
||||||
puts(" topModule=\"1\""); // IEEE vpiTopModule
|
puts(" topModule=\"1\""); // IEEE vpiTopModule
|
||||||
outputChildrenEnd(nodep, "");
|
outputChildrenEnd(nodep, "");
|
||||||
}
|
}
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
outputTag(nodep, "instance"); // IEEE: vpiInstance
|
outputTag(nodep, "instance"); // IEEE: vpiInstance
|
||||||
puts(" defName="); putsQuoted(nodep->modName()); // IEEE vpiDefName
|
puts(" defName="); putsQuoted(nodep->modName()); // IEEE vpiDefName
|
||||||
outputChildrenEnd(nodep, "instance");
|
outputChildrenEnd(nodep, "instance");
|
||||||
}
|
}
|
||||||
virtual void visit(AstPin* nodep, AstNUser*) {
|
virtual void visit(AstPin* nodep) {
|
||||||
// What we call a pin in verilator is a port in the IEEE spec.
|
// What we call a pin in verilator is a port in the IEEE spec.
|
||||||
outputTag(nodep, "port"); // IEEE: vpiPort
|
outputTag(nodep, "port"); // IEEE: vpiPort
|
||||||
if (nodep->modVarp()->isInOnly())
|
if (nodep->modVarp()->isInOnly())
|
||||||
|
|
@ -109,13 +109,13 @@ class EmitXmlFileVisitor : public AstNVisitor {
|
||||||
// Children includes vpiHighConn and vpiLowConn; we don't support port bits (yet?)
|
// Children includes vpiHighConn and vpiLowConn; we don't support port bits (yet?)
|
||||||
outputChildrenEnd(nodep, "port");
|
outputChildrenEnd(nodep, "port");
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignW* nodep, AstNUser*) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
outputTag(nodep, "contAssign"); // IEEE: vpiContAssign
|
outputTag(nodep, "contAssign"); // IEEE: vpiContAssign
|
||||||
outputChildrenEnd(nodep, "contAssign");
|
outputChildrenEnd(nodep, "contAssign");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Data types
|
// Data types
|
||||||
virtual void visit(AstBasicDType* nodep, AstNUser*) {
|
virtual void visit(AstBasicDType* nodep) {
|
||||||
outputTag(nodep, "basicDType ");
|
outputTag(nodep, "basicDType ");
|
||||||
if (nodep->isRanged()) {
|
if (nodep->isRanged()) {
|
||||||
puts(" left=\""+cvtToStr(nodep->left())+"\"");
|
puts(" left=\""+cvtToStr(nodep->left())+"\"");
|
||||||
|
|
@ -125,7 +125,7 @@ class EmitXmlFileVisitor : public AstNVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default
|
// Default
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
outputTag(nodep, "");
|
outputTag(nodep, "");
|
||||||
outputChildrenEnd(nodep, "");
|
outputChildrenEnd(nodep, "");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -308,7 +308,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstExtend* nodep, AstNUser*) {
|
virtual void visit(AstExtend* nodep) {
|
||||||
if (nodep->user1SetOnce()) return; // Process once
|
if (nodep->user1SetOnce()) return; // Process once
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->isWide()) {
|
if (nodep->isWide()) {
|
||||||
|
|
@ -347,7 +347,7 @@ private:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstSel* nodep, AstNUser*) {
|
virtual void visit(AstSel* nodep) {
|
||||||
if (nodep->user1SetOnce()) return; // Process once
|
if (nodep->user1SetOnce()) return; // Process once
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Remember, Sel's may have non-integer rhs, so need to optimize for that!
|
// Remember, Sel's may have non-integer rhs, so need to optimize for that!
|
||||||
|
|
@ -648,7 +648,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstConcat* nodep, AstNUser*) {
|
virtual void visit(AstConcat* nodep) {
|
||||||
if (nodep->user1SetOnce()) return; // Process once
|
if (nodep->user1SetOnce()) return; // Process once
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->isWide()) {
|
if (nodep->isWide()) {
|
||||||
|
|
@ -688,7 +688,7 @@ private:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstReplicate* nodep, AstNUser*) {
|
virtual void visit(AstReplicate* nodep) {
|
||||||
if (nodep->user1SetOnce()) return; // Process once
|
if (nodep->user1SetOnce()) return; // Process once
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->isWide()) {
|
if (nodep->isWide()) {
|
||||||
|
|
@ -749,7 +749,7 @@ private:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstChangeXor* nodep, AstNUser*) {
|
virtual void visit(AstChangeXor* nodep) {
|
||||||
if (nodep->user1SetOnce()) return; // Process once
|
if (nodep->user1SetOnce()) return; // Process once
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
UINFO(8," Wordize ChangeXor "<<nodep<<endl);
|
UINFO(8," Wordize ChangeXor "<<nodep<<endl);
|
||||||
|
|
@ -787,10 +787,10 @@ private:
|
||||||
replaceWithDelete(nodep,newp); VL_DANGLING(nodep);
|
replaceWithDelete(nodep,newp); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstEq* nodep, AstNUser*) { visitEqNeq (nodep); }
|
virtual void visit(AstEq* nodep) { visitEqNeq (nodep); }
|
||||||
virtual void visit(AstNeq* nodep, AstNUser*) { visitEqNeq (nodep); }
|
virtual void visit(AstNeq* nodep) { visitEqNeq (nodep); }
|
||||||
|
|
||||||
virtual void visit(AstRedOr* nodep, AstNUser*) {
|
virtual void visit(AstRedOr* nodep) {
|
||||||
if (nodep->user1SetOnce()) return; // Process once
|
if (nodep->user1SetOnce()) return; // Process once
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->lhsp()->isWide()) {
|
if (nodep->lhsp()->isWide()) {
|
||||||
|
|
@ -814,7 +814,7 @@ private:
|
||||||
replaceWithDelete(nodep,newp); VL_DANGLING(nodep);
|
replaceWithDelete(nodep,newp); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstRedAnd* nodep, AstNUser*) {
|
virtual void visit(AstRedAnd* nodep) {
|
||||||
if (nodep->user1SetOnce()) return; // Process once
|
if (nodep->user1SetOnce()) return; // Process once
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->lhsp()->isWide()) {
|
if (nodep->lhsp()->isWide()) {
|
||||||
|
|
@ -843,7 +843,7 @@ private:
|
||||||
replaceWithDelete(nodep,newp); VL_DANGLING(nodep);
|
replaceWithDelete(nodep,newp); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstRedXor* nodep, AstNUser*) {
|
virtual void visit(AstRedXor* nodep) {
|
||||||
if (nodep->user1SetOnce()) return; // Process once
|
if (nodep->user1SetOnce()) return; // Process once
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->lhsp()->isWide()) {
|
if (nodep->lhsp()->isWide()) {
|
||||||
|
|
@ -862,13 +862,13 @@ private:
|
||||||
// which the inlined function does nicely.
|
// which the inlined function does nicely.
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeStmt* nodep, AstNUser*) {
|
virtual void visit(AstNodeStmt* nodep) {
|
||||||
if (nodep->user1SetOnce()) return; // Process once
|
if (nodep->user1SetOnce()) return; // Process once
|
||||||
m_stmtp = nodep;
|
m_stmtp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_stmtp = NULL;
|
m_stmtp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
if (nodep->user1SetOnce()) return; // Process once
|
if (nodep->user1SetOnce()) return; // Process once
|
||||||
m_stmtp = nodep;
|
m_stmtp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -914,8 +914,8 @@ private:
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstVar*, AstNUser*) {} // Don't hit varrefs under vars
|
virtual void visit(AstVar*) {} // Don't hit varrefs under vars
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeVarRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeVarRef* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// We only allow a LHS ref for the var being set, and a RHS ref for something else being read.
|
// We only allow a LHS ref for the var being set, and a RHS ref for something else being read.
|
||||||
if (nodep->varScopep()->varp()->isSc()) {
|
if (nodep->varScopep()->varp()->isSc()) {
|
||||||
|
|
@ -215,7 +215,7 @@ private:
|
||||||
m_rhsVarRefs.push_back(nodep);
|
m_rhsVarRefs.push_back(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
m_substTreep = nodep->rhsp();
|
m_substTreep = nodep->rhsp();
|
||||||
if (!nodep->lhsp()->castNodeVarRef())
|
if (!nodep->lhsp()->castNodeVarRef())
|
||||||
clearSimple("ASSIGN(non-VARREF)");
|
clearSimple("ASSIGN(non-VARREF)");
|
||||||
|
|
@ -236,7 +236,7 @@ private:
|
||||||
}
|
}
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default
|
// Default
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// *** Special iterator
|
// *** Special iterator
|
||||||
if (!m_isSimple) return; // Fastpath
|
if (!m_isSimple) return; // Fastpath
|
||||||
if (!(m_dedupe ? nodep->isGateDedupable() : nodep->isGateOptimizable())
|
if (!(m_dedupe ? nodep->isGateDedupable() : nodep->isGateOptimizable())
|
||||||
|
|
@ -360,7 +360,7 @@ private:
|
||||||
void mergeAssigns();
|
void mergeAssigns();
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
//if (debug()>6) m_graph.dump();
|
//if (debug()>6) m_graph.dump();
|
||||||
if (debug()>6) m_graph.dumpDotFilePrefixed("gate_pre");
|
if (debug()>6) m_graph.dumpDotFilePrefixed("gate_pre");
|
||||||
|
|
@ -383,20 +383,20 @@ private:
|
||||||
consumedMove();
|
consumedMove();
|
||||||
replaceAssigns();
|
replaceAssigns();
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
m_activeReducible = true;
|
m_activeReducible = true;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
UINFO(4," SCOPE "<<nodep<<endl);
|
UINFO(4," SCOPE "<<nodep<<endl);
|
||||||
m_scopep = nodep;
|
m_scopep = nodep;
|
||||||
m_logicVertexp = NULL;
|
m_logicVertexp = NULL;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_scopep = NULL;
|
m_scopep = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstActive* nodep, AstNUser*) {
|
virtual void visit(AstActive* nodep) {
|
||||||
// Create required blocks and add to module
|
// Create required blocks and add to module
|
||||||
UINFO(4," BLOCK "<<nodep<<endl);
|
UINFO(4," BLOCK "<<nodep<<endl);
|
||||||
m_activeReducible = !(nodep->hasClocked()); // Seq logic outputs aren't reducible
|
m_activeReducible = !(nodep->hasClocked()); // Seq logic outputs aren't reducible
|
||||||
|
|
@ -407,7 +407,7 @@ private:
|
||||||
m_activep = NULL;
|
m_activep = NULL;
|
||||||
m_activeReducible = true;
|
m_activeReducible = true;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeVarRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeVarRef* nodep) {
|
||||||
if (m_scopep) {
|
if (m_scopep) {
|
||||||
if (!m_logicVertexp) nodep->v3fatalSrc("Var ref not under a logic block\n");
|
if (!m_logicVertexp) nodep->v3fatalSrc("Var ref not under a logic block\n");
|
||||||
AstVarScope* varscp = nodep->varScopep();
|
AstVarScope* varscp = nodep->varScopep();
|
||||||
|
|
@ -433,19 +433,19 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
iterateNewStmt(nodep, (nodep->isJustOneBodyStmt()?NULL:"Multiple Stmts"), NULL);
|
iterateNewStmt(nodep, (nodep->isJustOneBodyStmt()?NULL:"Multiple Stmts"), NULL);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlwaysPublic* nodep, AstNUser*) {
|
virtual void visit(AstAlwaysPublic* nodep) {
|
||||||
bool lastslow = m_inSlow;
|
bool lastslow = m_inSlow;
|
||||||
m_inSlow = true;
|
m_inSlow = true;
|
||||||
iterateNewStmt(nodep, "AlwaysPublic", NULL);
|
iterateNewStmt(nodep, "AlwaysPublic", NULL);
|
||||||
m_inSlow = lastslow;
|
m_inSlow = lastslow;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
iterateNewStmt(nodep, "User C Function", "User C Function");
|
iterateNewStmt(nodep, "User C Function", "User C Function");
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenItem* nodep, AstNUser*) {
|
virtual void visit(AstSenItem* nodep) {
|
||||||
// Note we look at only AstSenItems, not AstSenGate's
|
// Note we look at only AstSenItems, not AstSenGate's
|
||||||
// The gating term of a AstSenGate is normal logic
|
// The gating term of a AstSenGate is normal logic
|
||||||
m_inSenItem = true;
|
m_inSenItem = true;
|
||||||
|
|
@ -456,33 +456,33 @@ private:
|
||||||
}
|
}
|
||||||
m_inSenItem = false;
|
m_inSenItem = false;
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenGate* nodep, AstNUser*) {
|
virtual void visit(AstSenGate* nodep) {
|
||||||
// First handle the clock part will be handled in a minute by visit AstSenItem
|
// First handle the clock part will be handled in a minute by visit AstSenItem
|
||||||
// The logic gating term is delt with as logic
|
// The logic gating term is delt with as logic
|
||||||
iterateNewStmt(nodep, "Clock gater", "Clock gater");
|
iterateNewStmt(nodep, "Clock gater", "Clock gater");
|
||||||
}
|
}
|
||||||
virtual void visit(AstInitial* nodep, AstNUser*) {
|
virtual void visit(AstInitial* nodep) {
|
||||||
bool lastslow = m_inSlow;
|
bool lastslow = m_inSlow;
|
||||||
m_inSlow = true;
|
m_inSlow = true;
|
||||||
iterateNewStmt(nodep, (nodep->isJustOneBodyStmt()?NULL:"Multiple Stmts"), NULL);
|
iterateNewStmt(nodep, (nodep->isJustOneBodyStmt()?NULL:"Multiple Stmts"), NULL);
|
||||||
m_inSlow = lastslow;
|
m_inSlow = lastslow;
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignAlias* nodep, AstNUser*) {
|
virtual void visit(AstAssignAlias* nodep) {
|
||||||
iterateNewStmt(nodep, NULL, NULL);
|
iterateNewStmt(nodep, NULL, NULL);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignW* nodep, AstNUser*) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
iterateNewStmt(nodep, NULL, NULL);
|
iterateNewStmt(nodep, NULL, NULL);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCoverToggle* nodep, AstNUser*) {
|
virtual void visit(AstCoverToggle* nodep) {
|
||||||
iterateNewStmt(nodep, "CoverToggle", "CoverToggle");
|
iterateNewStmt(nodep, "CoverToggle", "CoverToggle");
|
||||||
}
|
}
|
||||||
virtual void visit(AstTraceInc* nodep, AstNUser*) {
|
virtual void visit(AstTraceInc* nodep) {
|
||||||
bool lastslow = m_inSlow;
|
bool lastslow = m_inSlow;
|
||||||
m_inSlow = true;
|
m_inSlow = true;
|
||||||
iterateNewStmt(nodep, "Tracing", "Tracing");
|
iterateNewStmt(nodep, "Tracing", "Tracing");
|
||||||
m_inSlow = lastslow;
|
m_inSlow = lastslow;
|
||||||
}
|
}
|
||||||
virtual void visit(AstConcat* nodep, AstNUser*) {
|
virtual void visit(AstConcat* nodep) {
|
||||||
if (nodep->backp()->castNodeAssign() && nodep->backp()->castNodeAssign()->lhsp()==nodep) {
|
if (nodep->backp()->castNodeAssign() && nodep->backp()->castNodeAssign()->lhsp()==nodep) {
|
||||||
nodep->v3fatalSrc("Concat on LHS of assignment; V3Const should have deleted it\n");
|
nodep->v3fatalSrc("Concat on LHS of assignment; V3Const should have deleted it\n");
|
||||||
}
|
}
|
||||||
|
|
@ -491,7 +491,7 @@ private:
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default
|
// Default
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->isOutputter() && m_logicVertexp) m_logicVertexp->setConsumed("outputter");
|
if (nodep->isOutputter() && m_logicVertexp) m_logicVertexp->setConsumed("outputter");
|
||||||
}
|
}
|
||||||
|
|
@ -796,7 +796,7 @@ private:
|
||||||
AstNode* m_replaceTreep; // What to replace the variable with
|
AstNode* m_replaceTreep; // What to replace the variable with
|
||||||
bool m_didReplace; // Did we do any replacements
|
bool m_didReplace; // Did we do any replacements
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeVarRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeVarRef* nodep) {
|
||||||
if (nodep->varScopep() == m_elimVarScp) {
|
if (nodep->varScopep() == m_elimVarScp) {
|
||||||
// Substitute in the new tree
|
// Substitute in the new tree
|
||||||
// It's possible we substitute into something that will be reduced more later
|
// It's possible we substitute into something that will be reduced more later
|
||||||
|
|
@ -822,7 +822,7 @@ private:
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -929,7 +929,7 @@ private:
|
||||||
bool m_dedupable; // Determined the assign to be dedupable
|
bool m_dedupable; // Determined the assign to be dedupable
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeAssign* assignp, AstNUser*) {
|
virtual void visit(AstNodeAssign* assignp) {
|
||||||
if (m_dedupable) {
|
if (m_dedupable) {
|
||||||
// I think we could safely dedupe an always block with multiple non-blocking statements, but erring on side of caution here
|
// I think we could safely dedupe an always block with multiple non-blocking statements, but erring on side of caution here
|
||||||
if (!m_assignp) {
|
if (!m_assignp) {
|
||||||
|
|
@ -939,7 +939,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlways* alwaysp, AstNUser*) {
|
virtual void visit(AstAlways* alwaysp) {
|
||||||
if (m_dedupable) {
|
if (m_dedupable) {
|
||||||
if (!m_always) {
|
if (!m_always) {
|
||||||
m_always = true;
|
m_always = true;
|
||||||
|
|
@ -953,7 +953,7 @@ private:
|
||||||
// always @(...)
|
// always @(...)
|
||||||
// if (...)
|
// if (...)
|
||||||
// foo = ...; // or foo <= ...;
|
// foo = ...; // or foo <= ...;
|
||||||
virtual void visit(AstNodeIf* ifp, AstNUser*) {
|
virtual void visit(AstNodeIf* ifp) {
|
||||||
if (m_dedupable) {
|
if (m_dedupable) {
|
||||||
if (m_always && !m_ifCondp && !ifp->elsesp()) { //we're under an always, this is the first IF, and there's no else
|
if (m_always && !m_ifCondp && !ifp->elsesp()) { //we're under an always, this is the first IF, and there's no else
|
||||||
m_ifCondp = ifp->condp();
|
m_ifCondp = ifp->condp();
|
||||||
|
|
@ -964,10 +964,10 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstComment*, AstNUser*) {} // NOP
|
virtual void visit(AstComment*) {} // NOP
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default
|
// Default
|
||||||
virtual void visit(AstNode*, AstNUser*) {
|
virtual void visit(AstNode*) {
|
||||||
m_dedupable = false;
|
m_dedupable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1245,7 +1245,7 @@ void GateVisitor::mergeAssigns() {
|
||||||
class GateDeassignVisitor : public GateBaseVisitor {
|
class GateDeassignVisitor : public GateBaseVisitor {
|
||||||
private:
|
private:
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstVarScope* nodep, AstNUser*) {
|
virtual void visit(AstVarScope* nodep) {
|
||||||
if (AstNodeAssign* assp = nodep->valuep()->castNodeAssign()) {
|
if (AstNodeAssign* assp = nodep->valuep()->castNodeAssign()) {
|
||||||
UINFO(5," Removeassign "<<assp<<endl);
|
UINFO(5," Removeassign "<<assp<<endl);
|
||||||
AstNode* valuep = assp->rhsp();
|
AstNode* valuep = assp->rhsp();
|
||||||
|
|
@ -1255,9 +1255,9 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Speedups
|
// Speedups
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {}
|
virtual void visit(AstVar* nodep) {}
|
||||||
virtual void visit(AstActive* nodep, AstNUser*) {}
|
virtual void visit(AstActive* nodep) {}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstTopScope* nodep, AstNUser*) {
|
virtual void visit(AstTopScope* nodep) {
|
||||||
AstNode::user2ClearTree(); // user2p() used on entire tree
|
AstNode::user2ClearTree(); // user2p() used on entire tree
|
||||||
|
|
||||||
AstScope* scopep = nodep->scopep();
|
AstScope* scopep = nodep->scopep();
|
||||||
|
|
@ -97,7 +97,7 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
//----
|
//----
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
// Consumption/generation of a variable,
|
// Consumption/generation of a variable,
|
||||||
AstVarScope* vscp = nodep->varScopep();
|
AstVarScope* vscp = nodep->varScopep();
|
||||||
if (!vscp) nodep->v3fatalSrc("Scope not assigned");
|
if (!vscp) nodep->v3fatalSrc("Scope not assigned");
|
||||||
|
|
@ -113,18 +113,18 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstActive* nodep, AstNUser*) {
|
virtual void visit(AstActive* nodep) {
|
||||||
m_activep = nodep;
|
m_activep = nodep;
|
||||||
nodep->sensesp()->iterateChildren(*this); // iterateAndNext?
|
nodep->sensesp()->iterateChildren(*this); // iterateAndNext?
|
||||||
m_activep = NULL;
|
m_activep = NULL;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----
|
//-----
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -154,7 +154,7 @@ private:
|
||||||
AstNodeModule* m_topModp; // Top module
|
AstNodeModule* m_topModp; // Top module
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstTopScope* nodep, AstNUser*) {
|
virtual void visit(AstTopScope* nodep) {
|
||||||
AstNode::user1ClearTree(); // user1p() used on entire tree
|
AstNode::user1ClearTree(); // user1p() used on entire tree
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
{
|
{
|
||||||
|
|
@ -163,21 +163,21 @@ private:
|
||||||
GenClkRenameVisitor visitor (nodep, m_topModp);
|
GenClkRenameVisitor visitor (nodep, m_topModp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
// Only track the top scopes, not lower level functions
|
// Only track the top scopes, not lower level functions
|
||||||
if (nodep->isTop()) {
|
if (nodep->isTop()) {
|
||||||
m_topModp = nodep;
|
m_topModp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstCCall* nodep, AstNUser*) {
|
virtual void visit(AstCCall* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Enter the function and trace it
|
// Enter the function and trace it
|
||||||
nodep->funcp()->accept(*this);
|
nodep->funcp()->accept(*this);
|
||||||
}
|
}
|
||||||
//----
|
//----
|
||||||
|
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
// Consumption/generation of a variable,
|
// Consumption/generation of a variable,
|
||||||
AstVarScope* vscp = nodep->varScopep();
|
AstVarScope* vscp = nodep->varScopep();
|
||||||
if (!vscp) nodep->v3fatalSrc("Scope not assigned");
|
if (!vscp) nodep->v3fatalSrc("Scope not assigned");
|
||||||
|
|
@ -192,13 +192,13 @@ private:
|
||||||
vscp->circular(true);
|
vscp->circular(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
//UINFO(8,"ASS "<<nodep<<endl);
|
//UINFO(8,"ASS "<<nodep<<endl);
|
||||||
m_assignp = nodep;
|
m_assignp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_assignp = NULL;
|
m_assignp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstActive* nodep, AstNUser*) {
|
virtual void visit(AstActive* nodep) {
|
||||||
UINFO(8,"ACTIVE "<<nodep<<endl);
|
UINFO(8,"ACTIVE "<<nodep<<endl);
|
||||||
m_activep = nodep;
|
m_activep = nodep;
|
||||||
nodep->sensesp()->iterateChildren(*this); // iterateAndNext?
|
nodep->sensesp()->iterateChildren(*this); // iterateAndNext?
|
||||||
|
|
@ -207,8 +207,8 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----
|
//-----
|
||||||
virtual void visit(AstVar*, AstNUser*) {} // Don't want varrefs under it
|
virtual void visit(AstVar*) {} // Don't want varrefs under it
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -88,10 +88,10 @@ private:
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstVar*, AstNUser*) {}
|
virtual void visit(AstVar*) {}
|
||||||
virtual void visit(AstTypedef*, AstNUser*) {}
|
virtual void visit(AstTypedef*) {}
|
||||||
virtual void visit(AstParamTypeDType*, AstNUser*) {}
|
virtual void visit(AstParamTypeDType*) {}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodeHashIterate(nodep);
|
nodeHashIterate(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
m_stmtCnt = 0;
|
m_stmtCnt = 0;
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
m_modp->user2(CIL_MAYBE);
|
m_modp->user2(CIL_MAYBE);
|
||||||
|
|
@ -123,11 +123,11 @@ private:
|
||||||
nodep->user1(doit);
|
nodep->user1(doit);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
nodep->modp()->user3Inc();
|
nodep->modp()->user3Inc();
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstPragma* nodep, AstNUser*) {
|
virtual void visit(AstPragma* nodep) {
|
||||||
if (nodep->pragType() == AstPragmaType::INLINE_MODULE) {
|
if (nodep->pragType() == AstPragmaType::INLINE_MODULE) {
|
||||||
//UINFO(0,"PRAG MARK "<<m_modp<<endl);
|
//UINFO(0,"PRAG MARK "<<m_modp<<endl);
|
||||||
if (!m_modp) {
|
if (!m_modp) {
|
||||||
|
|
@ -147,21 +147,21 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarXRef* nodep, AstNUser*) {
|
virtual void visit(AstVarXRef* nodep) {
|
||||||
// Cleanup link until V3LinkDot can correct it
|
// Cleanup link until V3LinkDot can correct it
|
||||||
nodep->varp(NULL);
|
nodep->varp(NULL);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||||
// Cleanup link until V3LinkDot can correct it
|
// Cleanup link until V3LinkDot can correct it
|
||||||
if (!nodep->packagep()) nodep->taskp(NULL);
|
if (!nodep->packagep()) nodep->taskp(NULL);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
// Nop's to speed up the loop
|
// Nop's to speed up the loop
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_stmtCnt++;
|
m_stmtCnt++;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
// Don't count assignments, as they'll likely flatten out
|
// Don't count assignments, as they'll likely flatten out
|
||||||
// Still need to iterate though to nullify VarXRefs
|
// Still need to iterate though to nullify VarXRefs
|
||||||
int oldcnt = m_stmtCnt;
|
int oldcnt = m_stmtCnt;
|
||||||
|
|
@ -170,7 +170,7 @@ private:
|
||||||
}
|
}
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_stmtCnt++;
|
m_stmtCnt++;
|
||||||
}
|
}
|
||||||
|
|
@ -207,13 +207,13 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
nodep->user4p(nodep->clonep());
|
nodep->user4p(nodep->clonep());
|
||||||
}
|
}
|
||||||
// Accelerate
|
// Accelerate
|
||||||
virtual void visit(AstNodeStmt* nodep, AstNUser*) {}
|
virtual void visit(AstNodeStmt* nodep) {}
|
||||||
virtual void visit(AstNodeMath* nodep, AstNUser*) {}
|
virtual void visit(AstNodeMath* nodep) {}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -248,7 +248,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstCellInline* nodep, AstNUser*) {
|
virtual void visit(AstCellInline* nodep) {
|
||||||
// Inlined cell under the inline cell, need to move to avoid conflicts
|
// Inlined cell under the inline cell, need to move to avoid conflicts
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
m_modp->addInlinesp(nodep);
|
m_modp->addInlinesp(nodep);
|
||||||
|
|
@ -259,17 +259,17 @@ private:
|
||||||
// Do CellInlines under this, but don't move them
|
// Do CellInlines under this, but don't move them
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
// Cell under the inline cell, need to rename to avoid conflicts
|
// Cell under the inline cell, need to rename to avoid conflicts
|
||||||
string name = m_cellp->name() + "__DOT__" + nodep->name();
|
string name = m_cellp->name() + "__DOT__" + nodep->name();
|
||||||
nodep->name(name);
|
nodep->name(name);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
virtual void visit(AstModule* nodep) {
|
||||||
m_renamedInterfaces.clear();
|
m_renamedInterfaces.clear();
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
if (nodep->user2p()) {
|
if (nodep->user2p()) {
|
||||||
// Make an assignment, so we'll trace it properly
|
// Make an assignment, so we'll trace it properly
|
||||||
// user2p is either a const or a var.
|
// user2p is either a const or a var.
|
||||||
|
|
@ -337,17 +337,17 @@ private:
|
||||||
if (debug()>=9 && nodep->valuep()) { nodep->valuep()->dumpTree(cout,"varchangei:"); }
|
if (debug()>=9 && nodep->valuep()) { nodep->valuep()->dumpTree(cout,"varchangei:"); }
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
// Function under the inline cell, need to rename to avoid conflicts
|
// Function under the inline cell, need to rename to avoid conflicts
|
||||||
nodep->name(m_cellp->name() + "__DOT__" + nodep->name());
|
nodep->name(m_cellp->name() + "__DOT__" + nodep->name());
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstTypedef* nodep, AstNUser*) {
|
virtual void visit(AstTypedef* nodep) {
|
||||||
// Typedef under the inline cell, need to rename to avoid conflicts
|
// Typedef under the inline cell, need to rename to avoid conflicts
|
||||||
nodep->name(m_cellp->name() + "__DOT__" + nodep->name());
|
nodep->name(m_cellp->name() + "__DOT__" + nodep->name());
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (nodep->varp()->user2p() // It's being converted to an alias.
|
if (nodep->varp()->user2p() // It's being converted to an alias.
|
||||||
&& !nodep->varp()->user3()
|
&& !nodep->varp()->user3()
|
||||||
&& !nodep->backp()->castAssignAlias()) { // Don't constant propagate aliases (we just made)
|
&& !nodep->backp()->castAssignAlias()) { // Don't constant propagate aliases (we just made)
|
||||||
|
|
@ -368,7 +368,7 @@ private:
|
||||||
nodep->name(nodep->varp()->name());
|
nodep->name(nodep->varp()->name());
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarXRef* nodep, AstNUser*) {
|
virtual void visit(AstVarXRef* nodep) {
|
||||||
// Track what scope it was originally under so V3LinkDot can resolve it
|
// Track what scope it was originally under so V3LinkDot can resolve it
|
||||||
string newname = m_cellp->name();
|
string newname = m_cellp->name();
|
||||||
if (nodep->inlinedDots() != "") { newname += "." + nodep->inlinedDots(); }
|
if (nodep->inlinedDots() != "") { newname += "." + nodep->inlinedDots(); }
|
||||||
|
|
@ -378,7 +378,7 @@ private:
|
||||||
}
|
}
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||||
// Track what scope it was originally under so V3LinkDot can resolve it
|
// Track what scope it was originally under so V3LinkDot can resolve it
|
||||||
string newname = m_cellp->name();
|
string newname = m_cellp->name();
|
||||||
if (nodep->inlinedDots() != "") { newname += "." + nodep->inlinedDots(); }
|
if (nodep->inlinedDots() != "") { newname += "." + nodep->inlinedDots(); }
|
||||||
|
|
@ -391,9 +391,9 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not needed, as V3LinkDot doesn't care about typedefs
|
// Not needed, as V3LinkDot doesn't care about typedefs
|
||||||
//virtual void visit(AstRefDType* nodep, AstNUser*) {}
|
//virtual void visit(AstRefDType* nodep) {}
|
||||||
|
|
||||||
virtual void visit(AstScopeName* nodep, AstNUser*) {
|
virtual void visit(AstScopeName* nodep) {
|
||||||
// If there's a %m in the display text, we add a special node that will contain the name()
|
// If there's a %m in the display text, we add a special node that will contain the name()
|
||||||
// Similar code in V3Begin
|
// Similar code in V3Begin
|
||||||
// To keep correct visual order, must add before other Text's
|
// To keep correct visual order, must add before other Text's
|
||||||
|
|
@ -407,14 +407,14 @@ private:
|
||||||
if (afterp) nodep->scopeEntrp(afterp);
|
if (afterp) nodep->scopeEntrp(afterp);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCoverDecl* nodep, AstNUser*) {
|
virtual void visit(AstCoverDecl* nodep) {
|
||||||
// Fix path in coverage statements
|
// Fix path in coverage statements
|
||||||
nodep->hier(m_cellp->prettyName()
|
nodep->hier(m_cellp->prettyName()
|
||||||
+ (nodep->hier()!="" ? ".":"")
|
+ (nodep->hier()!="" ? ".":"")
|
||||||
+ nodep->hier());
|
+ nodep->hier());
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -457,11 +457,11 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
// Iterate modules backwards, in bottom-up order. Required!
|
// Iterate modules backwards, in bottom-up order. Required!
|
||||||
nodep->iterateChildrenBackwards(*this);
|
nodep->iterateChildrenBackwards(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstIfaceRefDType* nodep, AstNUser*) {
|
virtual void visit(AstIfaceRefDType* nodep) {
|
||||||
if (nodep->user5()) {
|
if (nodep->user5()) {
|
||||||
// The cell has been removed so let's make sure we don't leave a reference to it
|
// The cell has been removed so let's make sure we don't leave a reference to it
|
||||||
// This dtype may still be in use by the AstAssignVarScope created earlier
|
// This dtype may still be in use by the AstAssignVarScope created earlier
|
||||||
|
|
@ -469,11 +469,11 @@ private:
|
||||||
nodep->cellp(NULL);
|
nodep->cellp(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
if (nodep->modp()->user1()) { // Marked with inline request
|
if (nodep->modp()->user1()) { // Marked with inline request
|
||||||
UINFO(5," Inline CELL "<<nodep<<endl);
|
UINFO(5," Inline CELL "<<nodep<<endl);
|
||||||
UINFO(5," To MOD "<<m_modp<<endl);
|
UINFO(5," To MOD "<<m_modp<<endl);
|
||||||
|
|
@ -552,9 +552,9 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
virtual void visit(AstNodeMath* nodep, AstNUser*) {} // Accelerate
|
virtual void visit(AstNodeMath* nodep) {} // Accelerate
|
||||||
virtual void visit(AstNodeStmt* nodep, AstNUser*) {} // Accelerate
|
virtual void visit(AstNodeStmt* nodep) {} // Accelerate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,14 +60,14 @@ private:
|
||||||
//int m_debug; int debug() { return m_debug; }
|
//int m_debug; int debug() { return m_debug; }
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
UINFO(4," MOD "<<nodep<<endl);
|
UINFO(4," MOD "<<nodep<<endl);
|
||||||
//if (nodep->name() == "t_chg") m_debug = 9; else m_debug=0;
|
//if (nodep->name() == "t_chg") m_debug = 9; else m_debug=0;
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
UINFO(4," CELL "<<nodep<<endl);
|
UINFO(4," CELL "<<nodep<<endl);
|
||||||
m_cellp = nodep;
|
m_cellp = nodep;
|
||||||
//VV***** We reset user1p() on each cell!!!
|
//VV***** We reset user1p() on each cell!!!
|
||||||
|
|
@ -75,7 +75,7 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_cellp = NULL;
|
m_cellp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstPin* nodep, AstNUser*) {
|
virtual void visit(AstPin* nodep) {
|
||||||
// PIN(p,expr) -> ASSIGNW(VARXREF(p),expr) (if sub's input)
|
// PIN(p,expr) -> ASSIGNW(VARXREF(p),expr) (if sub's input)
|
||||||
// or ASSIGNW(expr,VARXREF(p)) (if sub's output)
|
// or ASSIGNW(expr,VARXREF(p)) (if sub's output)
|
||||||
UINFO(4," PIN "<<nodep<<endl);
|
UINFO(4," PIN "<<nodep<<endl);
|
||||||
|
|
@ -125,7 +125,7 @@ private:
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstUdpTable* nodep, AstNUser*) {
|
virtual void visit(AstUdpTable* nodep) {
|
||||||
if (!v3Global.opt.bboxUnsup()) {
|
if (!v3Global.opt.bboxUnsup()) {
|
||||||
// If we support primitives, update V3Undriven to remove special case
|
// If we support primitives, update V3Undriven to remove special case
|
||||||
nodep->v3error("Unsupported: Verilog 1995 UDP Tables. Use --bbox-unsup to ignore tables.");
|
nodep->v3error("Unsupported: Verilog 1995 UDP Tables. Use --bbox-unsup to ignore tables.");
|
||||||
|
|
@ -133,12 +133,12 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save some time
|
// Save some time
|
||||||
virtual void visit(AstNodeAssign*, AstNUser*) {}
|
virtual void visit(AstNodeAssign*) {}
|
||||||
virtual void visit(AstAlways*, AstNUser*) {}
|
virtual void visit(AstAlways*) {}
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -169,7 +169,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
if (nodep->rangep()) {
|
if (nodep->rangep()) {
|
||||||
m_cellRangep = nodep->rangep();
|
m_cellRangep = nodep->rangep();
|
||||||
UINFO(4," CELL "<<nodep<<endl);
|
UINFO(4," CELL "<<nodep<<endl);
|
||||||
|
|
@ -225,7 +225,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
bool isIface = nodep->dtypep()->castUnpackArrayDType()
|
bool isIface = nodep->dtypep()->castUnpackArrayDType()
|
||||||
&& nodep->dtypep()->castUnpackArrayDType()->subDTypep()->castIfaceRefDType();
|
&& nodep->dtypep()->castUnpackArrayDType()->subDTypep()->castIfaceRefDType();
|
||||||
if (isIface) {
|
if (isIface) {
|
||||||
|
|
@ -251,7 +251,7 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstPin* nodep, AstNUser*) {
|
virtual void visit(AstPin* nodep) {
|
||||||
// Any non-direct pins need reconnection with a part-select
|
// Any non-direct pins need reconnection with a part-select
|
||||||
if (!nodep->exprp()) return; // No-connect
|
if (!nodep->exprp()) return; // No-connect
|
||||||
if (m_cellRangep) {
|
if (m_cellRangep) {
|
||||||
|
|
@ -357,10 +357,10 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save some time
|
// Save some time
|
||||||
virtual void visit(AstNodeMath*, AstNUser*) {}
|
virtual void visit(AstNodeMath*) {}
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -303,7 +303,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
// Consumption/generation of a variable,
|
// Consumption/generation of a variable,
|
||||||
// it's used so can't elim assignment before this use.
|
// it's used so can't elim assignment before this use.
|
||||||
if (!nodep->varScopep()) nodep->v3fatalSrc("NULL");
|
if (!nodep->varScopep()) nodep->v3fatalSrc("NULL");
|
||||||
|
|
@ -316,7 +316,7 @@ private:
|
||||||
m_lifep->varUsageReplace(vscp, nodep); VL_DANGLING(nodep);
|
m_lifep->varUsageReplace(vscp, nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
// Collect any used variables first, as lhs may also be on rhs
|
// Collect any used variables first, as lhs may also be on rhs
|
||||||
// Similar code in V3Dead
|
// Similar code in V3Dead
|
||||||
vluint64_t lastEdit = AstNode::editCountGbl(); // When it was last edited
|
vluint64_t lastEdit = AstNode::editCountGbl(); // When it was last edited
|
||||||
|
|
@ -336,13 +336,13 @@ private:
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignDly* nodep, AstNUser*) {
|
virtual void visit(AstAssignDly* nodep) {
|
||||||
// Don't treat as normal assign; V3Life doesn't understand time sense
|
// Don't treat as normal assign; V3Life doesn't understand time sense
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---- Track control flow changes
|
//---- Track control flow changes
|
||||||
virtual void visit(AstNodeIf* nodep, AstNUser*) {
|
virtual void visit(AstNodeIf* nodep) {
|
||||||
UINFO(4," IF "<<nodep<<endl);
|
UINFO(4," IF "<<nodep<<endl);
|
||||||
// Condition is part of PREVIOUS block
|
// Condition is part of PREVIOUS block
|
||||||
nodep->condp()->iterateAndNext(*this);
|
nodep->condp()->iterateAndNext(*this);
|
||||||
|
|
@ -369,7 +369,7 @@ private:
|
||||||
delete elseLifep;
|
delete elseLifep;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstWhile* nodep, AstNUser*) {
|
virtual void visit(AstWhile* nodep) {
|
||||||
// While's are a problem, as we don't allow loops in the graph. We
|
// While's are a problem, as we don't allow loops in the graph. We
|
||||||
// may go around the cond/body multiple times. Thus a
|
// may go around the cond/body multiple times. Thus a
|
||||||
// lifelication just in the body is ok, but we can't delete an
|
// lifelication just in the body is ok, but we can't delete an
|
||||||
|
|
@ -399,7 +399,7 @@ private:
|
||||||
delete condLifep;
|
delete condLifep;
|
||||||
delete bodyLifep;
|
delete bodyLifep;
|
||||||
}
|
}
|
||||||
virtual void visit(AstJumpLabel* nodep, AstNUser*) {
|
virtual void visit(AstJumpLabel* nodep) {
|
||||||
// As with While's we can't predict if a JumpGo will kill us or not
|
// As with While's we can't predict if a JumpGo will kill us or not
|
||||||
// It's worse though as an IF(..., JUMPGO) may change the control flow.
|
// It's worse though as an IF(..., JUMPGO) may change the control flow.
|
||||||
// Just don't optimize blocks with labels; they're rare - so far.
|
// Just don't optimize blocks with labels; they're rare - so far.
|
||||||
|
|
@ -418,7 +418,7 @@ private:
|
||||||
bodyLifep->lifeToAbove();
|
bodyLifep->lifeToAbove();
|
||||||
delete bodyLifep;
|
delete bodyLifep;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCCall* nodep, AstNUser*) {
|
virtual void visit(AstCCall* nodep) {
|
||||||
//UINFO(4," CCALL "<<nodep<<endl);
|
//UINFO(4," CCALL "<<nodep<<endl);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Enter the function and trace it
|
// Enter the function and trace it
|
||||||
|
|
@ -426,24 +426,24 @@ private:
|
||||||
nodep->funcp()->accept(*this);
|
nodep->funcp()->accept(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
//UINFO(4," CCALL "<<nodep<<endl);
|
//UINFO(4," CCALL "<<nodep<<endl);
|
||||||
if (nodep->dpiImport() && !nodep->pure()) {
|
if (nodep->dpiImport() && !nodep->pure()) {
|
||||||
m_sideEffect = true; // If appears on assign RHS, don't ever delete the assignment
|
m_sideEffect = true; // If appears on assign RHS, don't ever delete the assignment
|
||||||
}
|
}
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstUCFunc* nodep, AstNUser*) {
|
virtual void visit(AstUCFunc* nodep) {
|
||||||
m_sideEffect = true; // If appears on assign RHS, don't ever delete the assignment
|
m_sideEffect = true; // If appears on assign RHS, don't ever delete the assignment
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCMath* nodep, AstNUser*) {
|
virtual void visit(AstCMath* nodep) {
|
||||||
m_sideEffect = true; // If appears on assign RHS, don't ever delete the assignment
|
m_sideEffect = true; // If appears on assign RHS, don't ever delete the assignment
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstVar*, AstNUser*) {} // Don't want varrefs under it
|
virtual void visit(AstVar*) {} // Don't want varrefs under it
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -475,28 +475,28 @@ private:
|
||||||
LifeState* m_statep; // Current state
|
LifeState* m_statep; // Current state
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
if (nodep->entryPoint()) {
|
if (nodep->entryPoint()) {
|
||||||
// Usage model 1: Simulate all C code, doing lifetime analysis
|
// Usage model 1: Simulate all C code, doing lifetime analysis
|
||||||
LifeVisitor visitor (nodep, m_statep);
|
LifeVisitor visitor (nodep, m_statep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
// Usage model 2: Cleanup basic blocks
|
// Usage model 2: Cleanup basic blocks
|
||||||
LifeVisitor visitor (nodep, m_statep);
|
LifeVisitor visitor (nodep, m_statep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstInitial* nodep, AstNUser*) {
|
virtual void visit(AstInitial* nodep) {
|
||||||
// Usage model 2: Cleanup basic blocks
|
// Usage model 2: Cleanup basic blocks
|
||||||
LifeVisitor visitor (nodep, m_statep);
|
LifeVisitor visitor (nodep, m_statep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstFinal* nodep, AstNUser*) {
|
virtual void visit(AstFinal* nodep) {
|
||||||
// Usage model 2: Cleanup basic blocks
|
// Usage model 2: Cleanup basic blocks
|
||||||
LifeVisitor visitor (nodep, m_statep);
|
LifeVisitor visitor (nodep, m_statep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar*, AstNUser*) {} // Accelerate
|
virtual void visit(AstVar*) {} // Accelerate
|
||||||
virtual void visit(AstNodeStmt*, AstNUser*) {} // Accelerate
|
virtual void visit(AstNodeStmt*) {} // Accelerate
|
||||||
virtual void visit(AstNodeMath*, AstNUser*) {} // Accelerate
|
virtual void visit(AstNodeMath*) {} // Accelerate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ private:
|
||||||
// AstVarScope::user4p() -> AstVarScope*, If set, replace this varscope with specified new one
|
// AstVarScope::user4p() -> AstVarScope*, If set, replace this varscope with specified new one
|
||||||
// STATE
|
// STATE
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
AstVarScope* vscp = nodep->varScopep();
|
AstVarScope* vscp = nodep->varScopep();
|
||||||
if (!vscp) nodep->v3fatalSrc("Scope not assigned");
|
if (!vscp) nodep->v3fatalSrc("Scope not assigned");
|
||||||
if (AstVarScope* newvscp = (AstVarScope*)vscp->user4p()) {
|
if (AstVarScope* newvscp = (AstVarScope*)vscp->user4p()) {
|
||||||
|
|
@ -71,17 +71,17 @@ private:
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
// Only track the top scopes, not lower level functions
|
// Only track the top scopes, not lower level functions
|
||||||
if (nodep->isTop()) nodep->iterateChildren(*this);
|
if (nodep->isTop()) nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCCall* nodep, AstNUser*) {
|
virtual void visit(AstCCall* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Enter the function and trace it
|
// Enter the function and trace it
|
||||||
nodep->funcp()->accept(*this);
|
nodep->funcp()->accept(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar*, AstNUser*) {} // Don't want varrefs under it
|
virtual void visit(AstVar*) {} // Don't want varrefs under it
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -111,7 +111,7 @@ private:
|
||||||
V3Double0 m_statAssnDel; // Statistic tracking
|
V3Double0 m_statAssnDel; // Statistic tracking
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstTopScope* nodep, AstNUser*) {
|
virtual void visit(AstTopScope* nodep) {
|
||||||
AstNode::user1ClearTree(); // user1p() used on entire tree
|
AstNode::user1ClearTree(); // user1p() used on entire tree
|
||||||
AstNode::user2ClearTree(); // user2p() used on entire tree
|
AstNode::user2ClearTree(); // user2p() used on entire tree
|
||||||
AstNode::user4ClearTree(); // user4p() used on entire tree
|
AstNode::user4ClearTree(); // user4p() used on entire tree
|
||||||
|
|
@ -122,7 +122,7 @@ private:
|
||||||
LifePostElimVisitor visitor (nodep);
|
LifePostElimVisitor visitor (nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
// Consumption/generation of a variable,
|
// Consumption/generation of a variable,
|
||||||
AstVarScope* vscp = nodep->varScopep();
|
AstVarScope* vscp = nodep->varScopep();
|
||||||
if (!vscp) nodep->v3fatalSrc("Scope not assigned");
|
if (!vscp) nodep->v3fatalSrc("Scope not assigned");
|
||||||
|
|
@ -135,7 +135,7 @@ private:
|
||||||
vscp->user2(m_sequence);
|
vscp->user2(m_sequence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignPost* nodep, AstNUser*) {
|
virtual void visit(AstAssignPost* nodep) {
|
||||||
if (AstVarRef* lhsp = nodep->lhsp()->castVarRef()) {
|
if (AstVarRef* lhsp = nodep->lhsp()->castVarRef()) {
|
||||||
if (AstVarRef* rhsp = nodep->rhsp()->castVarRef()) {
|
if (AstVarRef* rhsp = nodep->rhsp()->castVarRef()) {
|
||||||
// Scrunch these:
|
// Scrunch these:
|
||||||
|
|
@ -161,19 +161,19 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
// Only track the top scopes, not lower level functions
|
// Only track the top scopes, not lower level functions
|
||||||
if (nodep->isTop()) nodep->iterateChildren(*this);
|
if (nodep->isTop()) nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCCall* nodep, AstNUser*) {
|
virtual void visit(AstCCall* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Enter the function and trace it
|
// Enter the function and trace it
|
||||||
nodep->funcp()->accept(*this);
|
nodep->funcp()->accept(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----
|
//-----
|
||||||
virtual void visit(AstVar*, AstNUser*) {} // Don't want varrefs under it
|
virtual void visit(AstVar*) {} // Don't want varrefs under it
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITs
|
// VISITs
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
AstNode::user1ClearTree();
|
AstNode::user1ClearTree();
|
||||||
readModNames();
|
readModNames();
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -182,7 +182,7 @@ private:
|
||||||
v3error("Specified --top-module '"<<v3Global.opt.topModule()<<"' was not found in design.");
|
v3error("Specified --top-module '"<<v3Global.opt.topModule()<<"' was not found in design.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
// Module: Pick up modnames, so we can resolve cells later
|
// Module: Pick up modnames, so we can resolve cells later
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
UINFO(2,"Link Module: "<<nodep<<endl);
|
UINFO(2,"Link Module: "<<nodep<<endl);
|
||||||
|
|
@ -217,7 +217,7 @@ private:
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstIfaceRefDType* nodep, AstNUser*) {
|
virtual void visit(AstIfaceRefDType* nodep) {
|
||||||
// Cell: Resolve its filename. If necessary, parse it.
|
// Cell: Resolve its filename. If necessary, parse it.
|
||||||
UINFO(4,"Link IfaceRef: "<<nodep<<endl);
|
UINFO(4,"Link IfaceRef: "<<nodep<<endl);
|
||||||
// Use findIdUpward instead of findIdFlat; it doesn't matter for now
|
// Use findIdUpward instead of findIdFlat; it doesn't matter for now
|
||||||
|
|
@ -236,14 +236,14 @@ private:
|
||||||
// Note cannot do modport resolution here; modports are allowed underneath generates
|
// Note cannot do modport resolution here; modports are allowed underneath generates
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstPackageImport* nodep, AstNUser*) {
|
virtual void visit(AstPackageImport* nodep) {
|
||||||
// Package Import: We need to do the package before the use of a package
|
// Package Import: We need to do the package before the use of a package
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (!nodep->packagep()) nodep->v3fatalSrc("Unlinked package"); // Parser should set packagep
|
if (!nodep->packagep()) nodep->v3fatalSrc("Unlinked package"); // Parser should set packagep
|
||||||
new V3GraphEdge(&m_graph, vertex(m_modp), vertex(nodep->packagep()), 1, false);
|
new V3GraphEdge(&m_graph, vertex(m_modp), vertex(nodep->packagep()), 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstBind* nodep, AstNUser*) {
|
virtual void visit(AstBind* nodep) {
|
||||||
// Bind: Has cells underneath that need to be put into the new module, and cells which need resolution
|
// Bind: Has cells underneath that need to be put into the new module, and cells which need resolution
|
||||||
// TODO this doesn't allow bind to dotted hier names, that would require
|
// TODO this doesn't allow bind to dotted hier names, that would require
|
||||||
// this move to post param, which would mean we do not auto-read modules
|
// this move to post param, which would mean we do not auto-read modules
|
||||||
|
|
@ -264,7 +264,7 @@ private:
|
||||||
pushDeletep(nodep->unlinkFrBack());
|
pushDeletep(nodep->unlinkFrBack());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
// Cell: Resolve its filename. If necessary, parse it.
|
// Cell: Resolve its filename. If necessary, parse it.
|
||||||
if (nodep->user1SetOnce()) return; // AstBind and AstNodeModule may call a cell twice
|
if (nodep->user1SetOnce()) return; // AstBind and AstNodeModule may call a cell twice
|
||||||
if (!nodep->modp()) {
|
if (!nodep->modp()) {
|
||||||
|
|
@ -382,8 +382,8 @@ private:
|
||||||
|
|
||||||
// Accelerate the recursion
|
// Accelerate the recursion
|
||||||
// Must do statements to support Generates, math though...
|
// Must do statements to support Generates, math though...
|
||||||
virtual void visit(AstNodeMath* nodep, AstNUser*) {}
|
virtual void visit(AstNodeMath* nodep) {}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -635,7 +635,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITs
|
// VISITs
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
// Process $unit or other packages
|
// Process $unit or other packages
|
||||||
// Not needed - dotted references not allowed from inside packages
|
// Not needed - dotted references not allowed from inside packages
|
||||||
//for (AstNodeModule* nodep = v3Global.rootp()->modulesp(); nodep; nodep=nodep->nextp()->castNodeModule()) {
|
//for (AstNodeModule* nodep = v3Global.rootp()->modulesp(); nodep; nodep=nodep->nextp()->castNodeModule()) {
|
||||||
|
|
@ -663,8 +663,8 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||||
m_curSymp = m_modSymp = NULL;
|
m_curSymp = m_modSymp = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstTypeTable* nodep, AstNUser*) {}
|
virtual void visit(AstTypeTable* nodep) {}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
// Called on top module from Netlist, other modules from the cell creating them,
|
// Called on top module from Netlist, other modules from the cell creating them,
|
||||||
// and packages
|
// and packages
|
||||||
UINFO(8," "<<nodep<<endl);
|
UINFO(8," "<<nodep<<endl);
|
||||||
|
|
@ -719,11 +719,11 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||||
// Prep for next
|
// Prep for next
|
||||||
m_packagep = NULL;
|
m_packagep = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
if (!m_statep->forScopeCreation()) v3fatalSrc("Scopes should only exist right after V3Scope");
|
if (!m_statep->forScopeCreation()) v3fatalSrc("Scopes should only exist right after V3Scope");
|
||||||
// Ignored. Processed in next step
|
// Ignored. Processed in next step
|
||||||
}
|
}
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
UINFO(5," CELL under "<<m_scope<<" is "<<nodep<<endl);
|
UINFO(5," CELL under "<<m_scope<<" is "<<nodep<<endl);
|
||||||
// Process XREFs/etc inside pins
|
// Process XREFs/etc inside pins
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -760,7 +760,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||||
m_curSymp = oldCurSymp;
|
m_curSymp = oldCurSymp;
|
||||||
m_paramNum = oldParamNum;
|
m_paramNum = oldParamNum;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCellInline* nodep, AstNUser*) {
|
virtual void visit(AstCellInline* nodep) {
|
||||||
UINFO(5," CELLINLINE under "<<m_scope<<" is "<<nodep<<endl);
|
UINFO(5," CELLINLINE under "<<m_scope<<" is "<<nodep<<endl);
|
||||||
VSymEnt* aboveSymp = m_curSymp;
|
VSymEnt* aboveSymp = m_curSymp;
|
||||||
// If baz__DOT__foo__DOT__bar, we need to find baz__DOT__foo and add bar to it.
|
// If baz__DOT__foo__DOT__bar, we need to find baz__DOT__foo and add bar to it.
|
||||||
|
|
@ -780,11 +780,11 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||||
m_statep->insertInline(aboveSymp, m_modSymp, nodep, nodep->name());
|
m_statep->insertInline(aboveSymp, m_modSymp, nodep, nodep->name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstDefParam* nodep, AstNUser*) {
|
virtual void visit(AstDefParam* nodep) {
|
||||||
nodep->user1p(m_curSymp);
|
nodep->user1p(m_curSymp);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstGenerate* nodep, AstNUser*) {
|
virtual void visit(AstGenerate* nodep) {
|
||||||
// Begin: ... blocks often replicate under genif/genfor, so simply suppress duplicate checks
|
// Begin: ... blocks often replicate under genif/genfor, so simply suppress duplicate checks
|
||||||
// See t_gen_forif.v for an example.
|
// See t_gen_forif.v for an example.
|
||||||
bool lastInGen = m_inGenerate;
|
bool lastInGen = m_inGenerate;
|
||||||
|
|
@ -794,7 +794,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||||
}
|
}
|
||||||
m_inGenerate = lastInGen;
|
m_inGenerate = lastInGen;
|
||||||
}
|
}
|
||||||
virtual void visit(AstBegin* nodep, AstNUser*) {
|
virtual void visit(AstBegin* nodep) {
|
||||||
UINFO(5," "<<nodep<<endl);
|
UINFO(5," "<<nodep<<endl);
|
||||||
// Rename "genblk"s to include a number
|
// Rename "genblk"s to include a number
|
||||||
if (m_statep->forPrimary() && !nodep->user4SetOnce()) {
|
if (m_statep->forPrimary() && !nodep->user4SetOnce()) {
|
||||||
|
|
@ -836,7 +836,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||||
m_beginp = oldbegin;
|
m_beginp = oldbegin;
|
||||||
m_beginNum = oldNum;
|
m_beginNum = oldNum;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
// NodeTask: Remember its name for later resolution
|
// NodeTask: Remember its name for later resolution
|
||||||
UINFO(5," "<<nodep<<endl);
|
UINFO(5," "<<nodep<<endl);
|
||||||
if (!m_curSymp || !m_modSymp) nodep->v3fatalSrc("Function/Task not under module??\n");
|
if (!m_curSymp || !m_modSymp) nodep->v3fatalSrc("Function/Task not under module??\n");
|
||||||
|
|
@ -871,7 +871,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||||
}
|
}
|
||||||
m_curSymp = oldCurSymp;
|
m_curSymp = oldCurSymp;
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
// Var: Remember its name for later resolution
|
// Var: Remember its name for later resolution
|
||||||
if (!m_curSymp || !m_modSymp) nodep->v3fatalSrc("Var not under module??\n");
|
if (!m_curSymp || !m_modSymp) nodep->v3fatalSrc("Var not under module??\n");
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -955,22 +955,22 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstTypedef* nodep, AstNUser*) {
|
virtual void visit(AstTypedef* nodep) {
|
||||||
// Remember its name for later resolution
|
// Remember its name for later resolution
|
||||||
if (!m_curSymp) nodep->v3fatalSrc("Typedef not under module??\n");
|
if (!m_curSymp) nodep->v3fatalSrc("Typedef not under module??\n");
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_statep->insertSym(m_curSymp, nodep->name(), nodep, m_packagep);
|
m_statep->insertSym(m_curSymp, nodep->name(), nodep, m_packagep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstParamTypeDType* nodep, AstNUser*) {
|
virtual void visit(AstParamTypeDType* nodep) {
|
||||||
if (!m_curSymp) nodep->v3fatalSrc("Parameter type not under module??\n");
|
if (!m_curSymp) nodep->v3fatalSrc("Parameter type not under module??\n");
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_statep->insertSym(m_curSymp, nodep->name(), nodep, m_packagep);
|
m_statep->insertSym(m_curSymp, nodep->name(), nodep, m_packagep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
// For dotted resolution, ignore all AstVars under functions, otherwise shouldn't exist
|
// For dotted resolution, ignore all AstVars under functions, otherwise shouldn't exist
|
||||||
if (m_statep->forScopeCreation()) nodep->v3fatalSrc("No CFuncs expected in tree yet");
|
if (m_statep->forScopeCreation()) nodep->v3fatalSrc("No CFuncs expected in tree yet");
|
||||||
}
|
}
|
||||||
virtual void visit(AstEnumItem* nodep, AstNUser*) {
|
virtual void visit(AstEnumItem* nodep) {
|
||||||
// EnumItem: Remember its name for later resolution
|
// EnumItem: Remember its name for later resolution
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Find under either a task or the module's vars
|
// Find under either a task or the module's vars
|
||||||
|
|
@ -1000,7 +1000,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||||
m_statep->insertSym(m_curSymp, nodep->name(), nodep, m_packagep);
|
m_statep->insertSym(m_curSymp, nodep->name(), nodep, m_packagep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstPackageImport* nodep, AstNUser*) {
|
virtual void visit(AstPackageImport* nodep) {
|
||||||
UINFO(2," Link: "<<nodep<<endl);
|
UINFO(2," Link: "<<nodep<<endl);
|
||||||
VSymEnt* srcp = m_statep->getNodeSym(nodep->packagep());
|
VSymEnt* srcp = m_statep->getNodeSym(nodep->packagep());
|
||||||
if (nodep->name()!="*") {
|
if (nodep->name()!="*") {
|
||||||
|
|
@ -1014,7 +1014,7 @@ class LinkDotFindVisitor : public AstNVisitor {
|
||||||
// No longer needed, but can't delete until any multi-instantiated modules are expanded
|
// No longer needed, but can't delete until any multi-instantiated modules are expanded
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
@ -1078,8 +1078,8 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITs
|
// VISITs
|
||||||
virtual void visit(AstTypeTable* nodep, AstNUser*) {}
|
virtual void visit(AstTypeTable* nodep) {}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
UINFO(5," "<<nodep<<endl);
|
UINFO(5," "<<nodep<<endl);
|
||||||
if (nodep->dead() || !nodep->user4()) {
|
if (nodep->dead() || !nodep->user4()) {
|
||||||
UINFO(4,"Mark dead module "<<nodep<<endl);
|
UINFO(4,"Mark dead module "<<nodep<<endl);
|
||||||
|
|
@ -1094,7 +1094,7 @@ private:
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstPin* nodep, AstNUser*) {
|
virtual void visit(AstPin* nodep) {
|
||||||
// Pin: Link to submodule's port
|
// Pin: Link to submodule's port
|
||||||
// Deal with implicit definitions - do before Resolve visitor as may be referenced above declaration
|
// Deal with implicit definitions - do before Resolve visitor as may be referenced above declaration
|
||||||
if (nodep->exprp() // Else specifically unconnected pin
|
if (nodep->exprp() // Else specifically unconnected pin
|
||||||
|
|
@ -1102,7 +1102,7 @@ private:
|
||||||
pinImplicitExprRecurse(nodep->exprp());
|
pinImplicitExprRecurse(nodep->exprp());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstDefParam* nodep, AstNUser*) {
|
virtual void visit(AstDefParam* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
nodep->v3warn(DEFPARAM,"Suggest replace defparam with Verilog 2001 #(."<<nodep->prettyName()<<"(...etc...))");
|
nodep->v3warn(DEFPARAM,"Suggest replace defparam with Verilog 2001 #(."<<nodep->prettyName()<<"(...etc...))");
|
||||||
VSymEnt* foundp = m_statep->getNodeSym(nodep)->findIdFallback(nodep->path());
|
VSymEnt* foundp = m_statep->getNodeSym(nodep)->findIdFallback(nodep->path());
|
||||||
|
|
@ -1123,7 +1123,7 @@ private:
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstPort* nodep, AstNUser*) {
|
virtual void visit(AstPort* nodep) {
|
||||||
// Port: Stash the pin number
|
// Port: Stash the pin number
|
||||||
// Need to set pin numbers after varnames are created
|
// Need to set pin numbers after varnames are created
|
||||||
// But before we do the final resolution based on names
|
// But before we do the final resolution based on names
|
||||||
|
|
@ -1142,14 +1142,14 @@ private:
|
||||||
// Ports not needed any more
|
// Ports not needed any more
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignW* nodep, AstNUser*) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
// Deal with implicit definitions
|
// Deal with implicit definitions
|
||||||
// We used to nodep->allowImplicit() here, but it turns out
|
// We used to nodep->allowImplicit() here, but it turns out
|
||||||
// normal "assigns" can also make implicit wires. Yuk.
|
// normal "assigns" can also make implicit wires. Yuk.
|
||||||
pinImplicitExprRecurse(nodep->lhsp());
|
pinImplicitExprRecurse(nodep->lhsp());
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignAlias* nodep, AstNUser*) {
|
virtual void visit(AstAssignAlias* nodep) {
|
||||||
// tran gates need implicit creation
|
// tran gates need implicit creation
|
||||||
// As VarRefs don't exist in forPrimary, sanity check
|
// As VarRefs don't exist in forPrimary, sanity check
|
||||||
if (m_statep->forPrimary()) nodep->v3fatalSrc("Assign aliases unexpected pre-dot");
|
if (m_statep->forPrimary()) nodep->v3fatalSrc("Assign aliases unexpected pre-dot");
|
||||||
|
|
@ -1161,13 +1161,13 @@ private:
|
||||||
}
|
}
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstImplicit* nodep, AstNUser*) {
|
virtual void visit(AstImplicit* nodep) {
|
||||||
// Unsupported gates need implicit creation
|
// Unsupported gates need implicit creation
|
||||||
pinImplicitExprRecurse(nodep);
|
pinImplicitExprRecurse(nodep);
|
||||||
// We're done with implicit gates
|
// We're done with implicit gates
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
@ -1197,11 +1197,11 @@ class LinkDotScopeVisitor : public AstNVisitor {
|
||||||
int debug() { return LinkDotState::debug(); }
|
int debug() { return LinkDotState::debug(); }
|
||||||
|
|
||||||
// VISITs
|
// VISITs
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser* vup) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
// Recurse..., backward as must do packages before using packages
|
// Recurse..., backward as must do packages before using packages
|
||||||
nodep->iterateChildrenBackwards(*this);
|
nodep->iterateChildrenBackwards(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
UINFO(8," SCOPE "<<nodep<<endl);
|
UINFO(8," SCOPE "<<nodep<<endl);
|
||||||
if (!m_statep->forScopeCreation()) v3fatalSrc("Scopes should only exist right after V3Scope");
|
if (!m_statep->forScopeCreation()) v3fatalSrc("Scopes should only exist right after V3Scope");
|
||||||
// Using the CELL names, we created all hierarchy. We now need to match this Scope
|
// Using the CELL names, we created all hierarchy. We now need to match this Scope
|
||||||
|
|
@ -1212,7 +1212,7 @@ class LinkDotScopeVisitor : public AstNVisitor {
|
||||||
m_modSymp = NULL;
|
m_modSymp = NULL;
|
||||||
m_scopep = NULL;
|
m_scopep = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarScope* nodep, AstNUser*) {
|
virtual void visit(AstVarScope* nodep) {
|
||||||
if (!nodep->varp()->isFuncLocal()) {
|
if (!nodep->varp()->isFuncLocal()) {
|
||||||
VSymEnt* varSymp = m_statep->insertSym(m_modSymp, nodep->varp()->name(), nodep, NULL);
|
VSymEnt* varSymp = m_statep->insertSym(m_modSymp, nodep->varp()->name(), nodep, NULL);
|
||||||
if (nodep->varp()->isIfaceRef()
|
if (nodep->varp()->isIfaceRef()
|
||||||
|
|
@ -1239,12 +1239,12 @@ class LinkDotScopeVisitor : public AstNVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
VSymEnt* symp = m_statep->insertBlock(m_modSymp, nodep->name(), nodep, NULL);
|
VSymEnt* symp = m_statep->insertBlock(m_modSymp, nodep->name(), nodep, NULL);
|
||||||
symp->fallbackp(m_modSymp);
|
symp->fallbackp(m_modSymp);
|
||||||
// No recursion, we don't want to pick up variables
|
// No recursion, we don't want to pick up variables
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignAlias* nodep, AstNUser*) {
|
virtual void visit(AstAssignAlias* nodep) {
|
||||||
// Track aliases created by V3Inline; if we get a VARXREF(aliased_from)
|
// Track aliases created by V3Inline; if we get a VARXREF(aliased_from)
|
||||||
// we'll need to replace it with a VARXREF(aliased_to)
|
// we'll need to replace it with a VARXREF(aliased_to)
|
||||||
if (debug()>=9) nodep->dumpTree(cout,"-\t\t\t\talias: ");
|
if (debug()>=9) nodep->dumpTree(cout,"-\t\t\t\talias: ");
|
||||||
|
|
@ -1254,7 +1254,7 @@ class LinkDotScopeVisitor : public AstNVisitor {
|
||||||
fromVscp->user2p(toVscp);
|
fromVscp->user2p(toVscp);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignVarScope* nodep, AstNUser*) {
|
virtual void visit(AstAssignVarScope* nodep) {
|
||||||
UINFO(5,"ASSIGNVARSCOPE "<<nodep<<endl);
|
UINFO(5,"ASSIGNVARSCOPE "<<nodep<<endl);
|
||||||
if (debug()>=9) nodep->dumpTree(cout,"-\t\t\t\tavs: ");
|
if (debug()>=9) nodep->dumpTree(cout,"-\t\t\t\tavs: ");
|
||||||
VSymEnt* rhsSymp;
|
VSymEnt* rhsSymp;
|
||||||
|
|
@ -1299,10 +1299,10 @@ class LinkDotScopeVisitor : public AstNVisitor {
|
||||||
}
|
}
|
||||||
// For speed, don't recurse things that can't have scope
|
// For speed, don't recurse things that can't have scope
|
||||||
// Note we allow AstNodeStmt's as generates may be under them
|
// Note we allow AstNodeStmt's as generates may be under them
|
||||||
virtual void visit(AstCell*, AstNUser*) {}
|
virtual void visit(AstCell*) {}
|
||||||
virtual void visit(AstVar*, AstNUser*) {}
|
virtual void visit(AstVar*) {}
|
||||||
virtual void visit(AstNodeMath*, AstNUser*) {}
|
virtual void visit(AstNodeMath*) {}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
@ -1332,7 +1332,7 @@ class LinkDotIfaceVisitor : public AstNVisitor {
|
||||||
int debug() { return LinkDotState::debug(); }
|
int debug() { return LinkDotState::debug(); }
|
||||||
|
|
||||||
// VISITs
|
// VISITs
|
||||||
virtual void visit(AstModport* nodep, AstNUser*) {
|
virtual void visit(AstModport* nodep) {
|
||||||
// Modport: Remember its name for later resolution
|
// Modport: Remember its name for later resolution
|
||||||
UINFO(5," fiv: "<<nodep<<endl);
|
UINFO(5," fiv: "<<nodep<<endl);
|
||||||
VSymEnt* oldCurSymp = m_curSymp;
|
VSymEnt* oldCurSymp = m_curSymp;
|
||||||
|
|
@ -1344,7 +1344,7 @@ class LinkDotIfaceVisitor : public AstNVisitor {
|
||||||
}
|
}
|
||||||
m_curSymp = oldCurSymp;
|
m_curSymp = oldCurSymp;
|
||||||
}
|
}
|
||||||
virtual void visit(AstModportFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstModportFTaskRef* nodep) {
|
||||||
UINFO(5," fif: "<<nodep<<endl);
|
UINFO(5," fif: "<<nodep<<endl);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->isExport()) nodep->v3error("Unsupported: modport export");
|
if (nodep->isExport()) nodep->v3error("Unsupported: modport export");
|
||||||
|
|
@ -1365,7 +1365,7 @@ class LinkDotIfaceVisitor : public AstNVisitor {
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstModportVarRef* nodep, AstNUser*) {
|
virtual void visit(AstModportVarRef* nodep) {
|
||||||
UINFO(5," fiv: "<<nodep<<endl);
|
UINFO(5," fiv: "<<nodep<<endl);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
VSymEnt* symp = m_curSymp->findIdFallback(nodep->name());
|
VSymEnt* symp = m_curSymp->findIdFallback(nodep->name());
|
||||||
|
|
@ -1388,7 +1388,7 @@ class LinkDotIfaceVisitor : public AstNVisitor {
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
@ -1524,12 +1524,12 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITs
|
// VISITs
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser* vup) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
// Recurse..., backward as must do packages before using packages
|
// Recurse..., backward as must do packages before using packages
|
||||||
nodep->iterateChildrenBackwards(*this);
|
nodep->iterateChildrenBackwards(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstTypeTable* nodep, AstNUser*) {}
|
virtual void visit(AstTypeTable* nodep) {}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
if (nodep->dead()) return;
|
if (nodep->dead()) return;
|
||||||
checkNoDot(nodep);
|
checkNoDot(nodep);
|
||||||
UINFO(8," "<<nodep<<endl);
|
UINFO(8," "<<nodep<<endl);
|
||||||
|
|
@ -1542,7 +1542,7 @@ private:
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
m_ds.m_dotSymp = m_curSymp = m_modSymp = NULL;
|
m_ds.m_dotSymp = m_curSymp = m_modSymp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
UINFO(8," "<<nodep<<endl);
|
UINFO(8," "<<nodep<<endl);
|
||||||
VSymEnt* oldModSymp = m_modSymp;
|
VSymEnt* oldModSymp = m_modSymp;
|
||||||
VSymEnt* oldCurSymp = m_curSymp;
|
VSymEnt* oldCurSymp = m_curSymp;
|
||||||
|
|
@ -1553,13 +1553,13 @@ private:
|
||||||
m_modSymp = oldModSymp;
|
m_modSymp = oldModSymp;
|
||||||
m_curSymp = oldCurSymp;
|
m_curSymp = oldCurSymp;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCellInline* nodep, AstNUser*) {
|
virtual void visit(AstCellInline* nodep) {
|
||||||
checkNoDot(nodep);
|
checkNoDot(nodep);
|
||||||
if (m_statep->forScopeCreation()) {
|
if (m_statep->forScopeCreation()) {
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
// Cell: Recurse inside or cleanup not founds
|
// Cell: Recurse inside or cleanup not founds
|
||||||
checkNoDot(nodep);
|
checkNoDot(nodep);
|
||||||
m_cellp = nodep;
|
m_cellp = nodep;
|
||||||
|
|
@ -1588,7 +1588,7 @@ private:
|
||||||
// Parent module inherits child's publicity
|
// Parent module inherits child's publicity
|
||||||
// This is done bottom up in the LinkBotupVisitor stage
|
// This is done bottom up in the LinkBotupVisitor stage
|
||||||
}
|
}
|
||||||
virtual void visit(AstPin* nodep, AstNUser*) {
|
virtual void visit(AstPin* nodep) {
|
||||||
// Pin: Link to submodule's port
|
// Pin: Link to submodule's port
|
||||||
checkNoDot(nodep);
|
checkNoDot(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -1622,7 +1622,7 @@ private:
|
||||||
}
|
}
|
||||||
// Early return() above when deleted
|
// Early return() above when deleted
|
||||||
}
|
}
|
||||||
virtual void visit(AstDot* nodep, AstNUser*) {
|
virtual void visit(AstDot* nodep) {
|
||||||
// Legal under a DOT: AstDot, AstParseRef, AstPackageRef, AstNodeSel
|
// Legal under a DOT: AstDot, AstParseRef, AstPackageRef, AstNodeSel
|
||||||
// also a DOT can be part of an expression, but only above plus AstFTaskRef are legal children
|
// also a DOT can be part of an expression, but only above plus AstFTaskRef are legal children
|
||||||
// DOT(PACKAGEREF, PARSEREF(text))
|
// DOT(PACKAGEREF, PARSEREF(text))
|
||||||
|
|
@ -1683,7 +1683,7 @@ private:
|
||||||
m_ds.m_dotp = lastStates.m_dotp;
|
m_ds.m_dotp = lastStates.m_dotp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstParseRef* nodep, AstNUser*) {
|
virtual void visit(AstParseRef* nodep) {
|
||||||
if (nodep->user3SetOnce()) return;
|
if (nodep->user3SetOnce()) return;
|
||||||
UINFO(9," linkPARSEREF "<<m_ds.ascii()<<" n="<<nodep<<endl);
|
UINFO(9," linkPARSEREF "<<m_ds.ascii()<<" n="<<nodep<<endl);
|
||||||
// m_curSymp is symbol table of outer expression
|
// m_curSymp is symbol table of outer expression
|
||||||
|
|
@ -1889,7 +1889,7 @@ private:
|
||||||
m_ds = lastStates;
|
m_ds = lastStates;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
// VarRef: Resolve its reference
|
// VarRef: Resolve its reference
|
||||||
// ParseRefs are used the first pass (forPrimary) so we shouldn't get can't find
|
// ParseRefs are used the first pass (forPrimary) so we shouldn't get can't find
|
||||||
// errors here now that we have a VarRef.
|
// errors here now that we have a VarRef.
|
||||||
|
|
@ -1908,7 +1908,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarXRef* nodep, AstNUser*) {
|
virtual void visit(AstVarXRef* nodep) {
|
||||||
// VarRef: Resolve its reference
|
// VarRef: Resolve its reference
|
||||||
// We always link even if varp() is set, because the module we choose may change
|
// We always link even if varp() is set, because the module we choose may change
|
||||||
// due to creating new modules, flattening, etc.
|
// due to creating new modules, flattening, etc.
|
||||||
|
|
@ -1973,11 +1973,11 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstEnumItemRef* nodep, AstNUser*) {
|
virtual void visit(AstEnumItemRef* nodep) {
|
||||||
// EnumItemRef may be under a dot. Should already be resolved.
|
// EnumItemRef may be under a dot. Should already be resolved.
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstMethodSel* nodep, AstNUser*) {
|
virtual void visit(AstMethodSel* nodep) {
|
||||||
// Created here so should already be resolved.
|
// Created here so should already be resolved.
|
||||||
DotStates lastStates = m_ds;
|
DotStates lastStates = m_ds;
|
||||||
{
|
{
|
||||||
|
|
@ -1986,14 +1986,14 @@ private:
|
||||||
}
|
}
|
||||||
m_ds = lastStates;
|
m_ds = lastStates;
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
checkNoDot(nodep);
|
checkNoDot(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_statep->forPrimary() && nodep->isIO() && !m_ftaskp && !nodep->user4()) {
|
if (m_statep->forPrimary() && nodep->isIO() && !m_ftaskp && !nodep->user4()) {
|
||||||
nodep->v3error("Input/output/inout does not appear in port list: "<<nodep->prettyName());
|
nodep->v3error("Input/output/inout does not appear in port list: "<<nodep->prettyName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||||
if (nodep->user3SetOnce()) return;
|
if (nodep->user3SetOnce()) return;
|
||||||
UINFO(8," "<<nodep<<endl);
|
UINFO(8," "<<nodep<<endl);
|
||||||
if (m_ds.m_dotp && m_ds.m_dotPos == DP_PACKAGE) {
|
if (m_ds.m_dotp && m_ds.m_dotPos == DP_PACKAGE) {
|
||||||
|
|
@ -2084,7 +2084,7 @@ private:
|
||||||
}
|
}
|
||||||
m_ds = lastStates;
|
m_ds = lastStates;
|
||||||
}
|
}
|
||||||
virtual void visit(AstSelBit* nodep, AstNUser*) {
|
virtual void visit(AstSelBit* nodep) {
|
||||||
if (nodep->user3SetOnce()) return;
|
if (nodep->user3SetOnce()) return;
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
if (m_ds.m_dotPos == DP_SCOPE) { // Already under dot, so this is {modulepart} DOT {modulepart}
|
if (m_ds.m_dotPos == DP_SCOPE) { // Already under dot, so this is {modulepart} DOT {modulepart}
|
||||||
|
|
@ -2108,7 +2108,7 @@ private:
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodePreSel* nodep, AstNUser*) {
|
virtual void visit(AstNodePreSel* nodep) {
|
||||||
// Excludes simple AstSelBit, see above
|
// Excludes simple AstSelBit, see above
|
||||||
if (nodep->user3SetOnce()) return;
|
if (nodep->user3SetOnce()) return;
|
||||||
if (m_ds.m_dotPos == DP_SCOPE) { // Already under dot, so this is {modulepart} DOT {modulepart}
|
if (m_ds.m_dotPos == DP_SCOPE) { // Already under dot, so this is {modulepart} DOT {modulepart}
|
||||||
|
|
@ -2126,11 +2126,11 @@ private:
|
||||||
}
|
}
|
||||||
m_ds = lastStates;
|
m_ds = lastStates;
|
||||||
}
|
}
|
||||||
virtual void visit(AstMemberSel* nodep, AstNUser*) {
|
virtual void visit(AstMemberSel* nodep) {
|
||||||
// checkNoDot not appropriate, can be under a dot
|
// checkNoDot not appropriate, can be under a dot
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstBegin* nodep, AstNUser*) {
|
virtual void visit(AstBegin* nodep) {
|
||||||
UINFO(5," "<<nodep<<endl);
|
UINFO(5," "<<nodep<<endl);
|
||||||
checkNoDot(nodep);
|
checkNoDot(nodep);
|
||||||
VSymEnt* oldCurSymp = m_curSymp;
|
VSymEnt* oldCurSymp = m_curSymp;
|
||||||
|
|
@ -2142,7 +2142,7 @@ private:
|
||||||
m_ds.m_dotSymp = m_curSymp = oldCurSymp;
|
m_ds.m_dotSymp = m_curSymp = oldCurSymp;
|
||||||
UINFO(5," cur=se"<<(void*)m_curSymp<<endl);
|
UINFO(5," cur=se"<<(void*)m_curSymp<<endl);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
UINFO(5," "<<nodep<<endl);
|
UINFO(5," "<<nodep<<endl);
|
||||||
checkNoDot(nodep);
|
checkNoDot(nodep);
|
||||||
VSymEnt* oldCurSymp = m_curSymp;
|
VSymEnt* oldCurSymp = m_curSymp;
|
||||||
|
|
@ -2154,7 +2154,7 @@ private:
|
||||||
m_ds.m_dotSymp = m_curSymp = oldCurSymp;
|
m_ds.m_dotSymp = m_curSymp = oldCurSymp;
|
||||||
m_ftaskp = NULL;
|
m_ftaskp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstRefDType* nodep, AstNUser*) {
|
virtual void visit(AstRefDType* nodep) {
|
||||||
// Resolve its reference
|
// Resolve its reference
|
||||||
if (nodep->user3SetOnce()) return;
|
if (nodep->user3SetOnce()) return;
|
||||||
if (m_ds.m_dotp && m_ds.m_dotPos == DP_PACKAGE) {
|
if (m_ds.m_dotp && m_ds.m_dotPos == DP_PACKAGE) {
|
||||||
|
|
@ -2187,7 +2187,7 @@ private:
|
||||||
}
|
}
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstDpiExport* nodep, AstNUser*) {
|
virtual void visit(AstDpiExport* nodep) {
|
||||||
// AstDpiExport: Make sure the function referenced exists, then dump it
|
// AstDpiExport: Make sure the function referenced exists, then dump it
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
checkNoDot(nodep);
|
checkNoDot(nodep);
|
||||||
|
|
@ -2202,25 +2202,25 @@ private:
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstPackageImport* nodep, AstNUser*) {
|
virtual void visit(AstPackageImport* nodep) {
|
||||||
// No longer needed
|
// No longer needed
|
||||||
checkNoDot(nodep);
|
checkNoDot(nodep);
|
||||||
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCellRef* nodep, AstNUser*) {
|
virtual void visit(AstCellRef* nodep) {
|
||||||
UINFO(5," AstCellRef: "<<nodep<<" "<<m_ds.ascii()<<endl);
|
UINFO(5," AstCellRef: "<<nodep<<" "<<m_ds.ascii()<<endl);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCellArrayRef* nodep, AstNUser*) {
|
virtual void visit(AstCellArrayRef* nodep) {
|
||||||
UINFO(5," AstCellArrayRef: "<<nodep<<" "<<m_ds.ascii()<<endl);
|
UINFO(5," AstCellArrayRef: "<<nodep<<" "<<m_ds.ascii()<<endl);
|
||||||
// Expression already iterated
|
// Expression already iterated
|
||||||
}
|
}
|
||||||
virtual void visit(AstUnlinkedRef* nodep, AstNUser*) {
|
virtual void visit(AstUnlinkedRef* nodep) {
|
||||||
UINFO(5," AstCellArrayRef: "<<nodep<<" "<<m_ds.ascii()<<endl);
|
UINFO(5," AstCellArrayRef: "<<nodep<<" "<<m_ds.ascii()<<endl);
|
||||||
// No need to iterate, if we have a UnlinkedVarXRef, we're already done
|
// No need to iterate, if we have a UnlinkedVarXRef, we're already done
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
checkNoDot(nodep);
|
checkNoDot(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
|
||||||
|
|
@ -113,25 +113,25 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
if (nodep->dead()) return;
|
if (nodep->dead()) return;
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
m_repeatNum = 0;
|
m_repeatNum = 0;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
m_ftaskp = nodep;
|
m_ftaskp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_ftaskp = NULL;
|
m_ftaskp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstBegin* nodep, AstNUser*) {
|
virtual void visit(AstBegin* nodep) {
|
||||||
UINFO(8," "<<nodep<<endl);
|
UINFO(8," "<<nodep<<endl);
|
||||||
m_beginStack.push_back(nodep);
|
m_beginStack.push_back(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_beginStack.pop_back();
|
m_beginStack.pop_back();
|
||||||
}
|
}
|
||||||
virtual void visit(AstRepeat* nodep, AstNUser*) {
|
virtual void visit(AstRepeat* nodep) {
|
||||||
// So later optimizations don't need to deal with them,
|
// So later optimizations don't need to deal with them,
|
||||||
// REPEAT(count,body) -> loop=count,WHILE(loop>0) { body, loop-- }
|
// REPEAT(count,body) -> loop=count,WHILE(loop>0) { body, loop-- }
|
||||||
// Note var can be signed or unsigned based on original number.
|
// Note var can be signed or unsigned based on original number.
|
||||||
|
|
@ -161,7 +161,7 @@ private:
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstWhile* nodep, AstNUser*) {
|
virtual void visit(AstWhile* nodep) {
|
||||||
// Don't need to track AstRepeat/AstFor as they have already been converted
|
// Don't need to track AstRepeat/AstFor as they have already been converted
|
||||||
AstWhile* lastLoopp = m_loopp;
|
AstWhile* lastLoopp = m_loopp;
|
||||||
bool lastInc = m_loopInc;
|
bool lastInc = m_loopInc;
|
||||||
|
|
@ -175,7 +175,7 @@ private:
|
||||||
m_loopInc = lastInc;
|
m_loopInc = lastInc;
|
||||||
m_loopp = lastLoopp;
|
m_loopp = lastLoopp;
|
||||||
}
|
}
|
||||||
virtual void visit(AstReturn* nodep, AstNUser*) {
|
virtual void visit(AstReturn* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
AstFunc* funcp = m_ftaskp->castFunc();
|
AstFunc* funcp = m_ftaskp->castFunc();
|
||||||
if (!m_ftaskp) { nodep->v3error("Return isn't underneath a task or function"); }
|
if (!m_ftaskp) { nodep->v3error("Return isn't underneath a task or function"); }
|
||||||
|
|
@ -194,7 +194,7 @@ private:
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstBreak* nodep, AstNUser*) {
|
virtual void visit(AstBreak* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (!m_loopp) { nodep->v3error("break isn't underneath a loop"); }
|
if (!m_loopp) { nodep->v3error("break isn't underneath a loop"); }
|
||||||
else {
|
else {
|
||||||
|
|
@ -204,7 +204,7 @@ private:
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstContinue* nodep, AstNUser*) {
|
virtual void visit(AstContinue* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (!m_loopp) { nodep->v3error("continue isn't underneath a loop"); }
|
if (!m_loopp) { nodep->v3error("continue isn't underneath a loop"); }
|
||||||
else {
|
else {
|
||||||
|
|
@ -215,7 +215,7 @@ private:
|
||||||
}
|
}
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstDisable* nodep, AstNUser*) {
|
virtual void visit(AstDisable* nodep) {
|
||||||
UINFO(8," DISABLE "<<nodep<<endl);
|
UINFO(8," DISABLE "<<nodep<<endl);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
AstBegin* beginp = NULL;
|
AstBegin* beginp = NULL;
|
||||||
|
|
@ -236,12 +236,12 @@ private:
|
||||||
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->unlinkFrBack(); pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
//if (debug()>=9) { UINFO(0,"\n"); beginp->dumpTree(cout," labelo: "); }
|
//if (debug()>=9) { UINFO(0,"\n"); beginp->dumpTree(cout," labelo: "); }
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (m_loopInc && nodep->varp()) nodep->varp()->usedLoopIdx(true);
|
if (m_loopInc && nodep->varp()) nodep->varp()->usedLoopIdx(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) {}
|
virtual void visit(AstConst* nodep) {}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ private:
|
||||||
|
|
||||||
// VISITs
|
// VISITs
|
||||||
// Result handing
|
// Result handing
|
||||||
virtual void visit(AstNodeVarRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeVarRef* nodep) {
|
||||||
// VarRef: LValue its reference
|
// VarRef: LValue its reference
|
||||||
if (m_setRefLvalue) {
|
if (m_setRefLvalue) {
|
||||||
nodep->lvalue(true);
|
nodep->lvalue(true);
|
||||||
|
|
@ -71,7 +71,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nodes that start propagating down lvalues
|
// Nodes that start propagating down lvalues
|
||||||
virtual void visit(AstPin* nodep, AstNUser*) {
|
virtual void visit(AstPin* nodep) {
|
||||||
if (nodep->modVarp() && nodep->modVarp()->isOutput()) {
|
if (nodep->modVarp() && nodep->modVarp()->isOutput()) {
|
||||||
// When the varref's were created, we didn't know the I/O state
|
// When the varref's were created, we didn't know the I/O state
|
||||||
// Now that we do, and it's from a output, we know it's a lvalue
|
// Now that we do, and it's from a output, we know it's a lvalue
|
||||||
|
|
@ -82,7 +82,7 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
bool last_setRefLvalue = m_setRefLvalue;
|
bool last_setRefLvalue = m_setRefLvalue;
|
||||||
{
|
{
|
||||||
m_setRefLvalue = true;
|
m_setRefLvalue = true;
|
||||||
|
|
@ -92,7 +92,7 @@ private:
|
||||||
}
|
}
|
||||||
m_setRefLvalue = last_setRefLvalue;
|
m_setRefLvalue = last_setRefLvalue;
|
||||||
}
|
}
|
||||||
virtual void visit(AstFOpen* nodep, AstNUser*) {
|
virtual void visit(AstFOpen* nodep) {
|
||||||
bool last_setRefLvalue = m_setRefLvalue;
|
bool last_setRefLvalue = m_setRefLvalue;
|
||||||
{
|
{
|
||||||
m_setRefLvalue = true;
|
m_setRefLvalue = true;
|
||||||
|
|
@ -103,7 +103,7 @@ private:
|
||||||
}
|
}
|
||||||
m_setRefLvalue = last_setRefLvalue;
|
m_setRefLvalue = last_setRefLvalue;
|
||||||
}
|
}
|
||||||
virtual void visit(AstFClose* nodep, AstNUser*) {
|
virtual void visit(AstFClose* nodep) {
|
||||||
bool last_setRefLvalue = m_setRefLvalue;
|
bool last_setRefLvalue = m_setRefLvalue;
|
||||||
{
|
{
|
||||||
m_setRefLvalue = true;
|
m_setRefLvalue = true;
|
||||||
|
|
@ -111,7 +111,7 @@ private:
|
||||||
}
|
}
|
||||||
m_setRefLvalue = last_setRefLvalue;
|
m_setRefLvalue = last_setRefLvalue;
|
||||||
}
|
}
|
||||||
virtual void visit(AstFFlush* nodep, AstNUser*) {
|
virtual void visit(AstFFlush* nodep) {
|
||||||
bool last_setRefLvalue = m_setRefLvalue;
|
bool last_setRefLvalue = m_setRefLvalue;
|
||||||
{
|
{
|
||||||
m_setRefLvalue = true;
|
m_setRefLvalue = true;
|
||||||
|
|
@ -119,7 +119,7 @@ private:
|
||||||
}
|
}
|
||||||
m_setRefLvalue = last_setRefLvalue;
|
m_setRefLvalue = last_setRefLvalue;
|
||||||
}
|
}
|
||||||
virtual void visit(AstFGetC* nodep, AstNUser*) {
|
virtual void visit(AstFGetC* nodep) {
|
||||||
bool last_setRefLvalue = m_setRefLvalue;
|
bool last_setRefLvalue = m_setRefLvalue;
|
||||||
{
|
{
|
||||||
m_setRefLvalue = true;
|
m_setRefLvalue = true;
|
||||||
|
|
@ -127,7 +127,7 @@ private:
|
||||||
}
|
}
|
||||||
m_setRefLvalue = last_setRefLvalue;
|
m_setRefLvalue = last_setRefLvalue;
|
||||||
}
|
}
|
||||||
virtual void visit(AstFGetS* nodep, AstNUser*) {
|
virtual void visit(AstFGetS* nodep) {
|
||||||
bool last_setRefLvalue = m_setRefLvalue;
|
bool last_setRefLvalue = m_setRefLvalue;
|
||||||
{
|
{
|
||||||
m_setRefLvalue = true;
|
m_setRefLvalue = true;
|
||||||
|
|
@ -136,7 +136,7 @@ private:
|
||||||
}
|
}
|
||||||
m_setRefLvalue = last_setRefLvalue;
|
m_setRefLvalue = last_setRefLvalue;
|
||||||
}
|
}
|
||||||
virtual void visit(AstFScanF* nodep, AstNUser*) {
|
virtual void visit(AstFScanF* nodep) {
|
||||||
bool last_setRefLvalue = m_setRefLvalue;
|
bool last_setRefLvalue = m_setRefLvalue;
|
||||||
{
|
{
|
||||||
m_setRefLvalue = true;
|
m_setRefLvalue = true;
|
||||||
|
|
@ -145,7 +145,7 @@ private:
|
||||||
}
|
}
|
||||||
m_setRefLvalue = last_setRefLvalue;
|
m_setRefLvalue = last_setRefLvalue;
|
||||||
}
|
}
|
||||||
virtual void visit(AstSScanF* nodep, AstNUser*) {
|
virtual void visit(AstSScanF* nodep) {
|
||||||
bool last_setRefLvalue = m_setRefLvalue;
|
bool last_setRefLvalue = m_setRefLvalue;
|
||||||
{
|
{
|
||||||
m_setRefLvalue = true;
|
m_setRefLvalue = true;
|
||||||
|
|
@ -153,13 +153,13 @@ private:
|
||||||
}
|
}
|
||||||
m_setRefLvalue = last_setRefLvalue;
|
m_setRefLvalue = last_setRefLvalue;
|
||||||
}
|
}
|
||||||
virtual void visit(AstSysIgnore* nodep, AstNUser*) {
|
virtual void visit(AstSysIgnore* nodep) {
|
||||||
// Can't know if lvalue or not; presume so as stricter
|
// Can't know if lvalue or not; presume so as stricter
|
||||||
bool last_setRefLvalue = m_setRefLvalue;
|
bool last_setRefLvalue = m_setRefLvalue;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_setRefLvalue = last_setRefLvalue;
|
m_setRefLvalue = last_setRefLvalue;
|
||||||
}
|
}
|
||||||
virtual void visit(AstReadMem* nodep, AstNUser*) {
|
virtual void visit(AstReadMem* nodep) {
|
||||||
bool last_setRefLvalue = m_setRefLvalue;
|
bool last_setRefLvalue = m_setRefLvalue;
|
||||||
{
|
{
|
||||||
m_setRefLvalue = true;
|
m_setRefLvalue = true;
|
||||||
|
|
@ -171,7 +171,7 @@ private:
|
||||||
}
|
}
|
||||||
m_setRefLvalue = last_setRefLvalue;
|
m_setRefLvalue = last_setRefLvalue;
|
||||||
}
|
}
|
||||||
virtual void visit(AstValuePlusArgs* nodep, AstNUser*) {
|
virtual void visit(AstValuePlusArgs* nodep) {
|
||||||
bool last_setRefLvalue = m_setRefLvalue;
|
bool last_setRefLvalue = m_setRefLvalue;
|
||||||
{
|
{
|
||||||
m_setRefLvalue = true;
|
m_setRefLvalue = true;
|
||||||
|
|
@ -179,7 +179,7 @@ private:
|
||||||
}
|
}
|
||||||
m_setRefLvalue = last_setRefLvalue;
|
m_setRefLvalue = last_setRefLvalue;
|
||||||
}
|
}
|
||||||
virtual void visit(AstSFormat* nodep, AstNUser*) {
|
virtual void visit(AstSFormat* nodep) {
|
||||||
bool last_setRefLvalue = m_setRefLvalue;
|
bool last_setRefLvalue = m_setRefLvalue;
|
||||||
{
|
{
|
||||||
m_setRefLvalue = true;
|
m_setRefLvalue = true;
|
||||||
|
|
@ -191,7 +191,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nodes that change LValue state
|
// Nodes that change LValue state
|
||||||
virtual void visit(AstSel* nodep, AstNUser*) {
|
virtual void visit(AstSel* nodep) {
|
||||||
bool last_setRefLvalue = m_setRefLvalue;
|
bool last_setRefLvalue = m_setRefLvalue;
|
||||||
{
|
{
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
|
|
@ -202,7 +202,7 @@ private:
|
||||||
}
|
}
|
||||||
m_setRefLvalue = last_setRefLvalue;
|
m_setRefLvalue = last_setRefLvalue;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeSel* nodep, AstNUser*) {
|
virtual void visit(AstNodeSel* nodep) {
|
||||||
bool last_setRefLvalue = m_setRefLvalue;
|
bool last_setRefLvalue = m_setRefLvalue;
|
||||||
{ // Only set lvalues on the from
|
{ // Only set lvalues on the from
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
|
|
@ -211,7 +211,7 @@ private:
|
||||||
}
|
}
|
||||||
m_setRefLvalue = last_setRefLvalue;
|
m_setRefLvalue = last_setRefLvalue;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCellArrayRef* nodep, AstNUser*) {
|
virtual void visit(AstCellArrayRef* nodep) {
|
||||||
bool last_setRefLvalue = m_setRefLvalue;
|
bool last_setRefLvalue = m_setRefLvalue;
|
||||||
{ // selp is not an lvalue
|
{ // selp is not an lvalue
|
||||||
m_setRefLvalue = false;
|
m_setRefLvalue = false;
|
||||||
|
|
@ -219,7 +219,7 @@ private:
|
||||||
}
|
}
|
||||||
m_setRefLvalue = last_setRefLvalue;
|
m_setRefLvalue = last_setRefLvalue;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodePreSel* nodep, AstNUser*) {
|
virtual void visit(AstNodePreSel* nodep) {
|
||||||
bool last_setRefLvalue = m_setRefLvalue;
|
bool last_setRefLvalue = m_setRefLvalue;
|
||||||
{ // Only set lvalues on the from
|
{ // Only set lvalues on the from
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
|
|
@ -229,12 +229,12 @@ private:
|
||||||
}
|
}
|
||||||
m_setRefLvalue = last_setRefLvalue;
|
m_setRefLvalue = last_setRefLvalue;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
m_ftaskp = nodep;
|
m_ftaskp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_ftaskp = NULL;
|
m_ftaskp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||||
AstNode* pinp = nodep->pinsp();
|
AstNode* pinp = nodep->pinsp();
|
||||||
AstNodeFTask* taskp = nodep->taskp();
|
AstNodeFTask* taskp = nodep->taskp();
|
||||||
// We'll deal with mismatching pins later
|
// We'll deal with mismatching pins later
|
||||||
|
|
@ -256,7 +256,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITs
|
// VISITs
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
if (!nodep->user1SetOnce()) { // Process only once.
|
if (!nodep->user1SetOnce()) { // Process only once.
|
||||||
cleanFileline(nodep);
|
cleanFileline(nodep);
|
||||||
m_ftaskp = nodep;
|
m_ftaskp = nodep;
|
||||||
|
|
@ -95,7 +95,7 @@ private:
|
||||||
m_ftaskp = NULL;
|
m_ftaskp = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||||
if (!nodep->user1SetOnce()) { // Process only once.
|
if (!nodep->user1SetOnce()) { // Process only once.
|
||||||
cleanFileline(nodep);
|
cleanFileline(nodep);
|
||||||
UINFO(5," "<<nodep<<endl);
|
UINFO(5," "<<nodep<<endl);
|
||||||
|
|
@ -105,7 +105,7 @@ private:
|
||||||
m_valueModp = upperValueModp;
|
m_valueModp = upperValueModp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeDType* nodep, AstNUser*) {
|
virtual void visit(AstNodeDType* nodep) {
|
||||||
if (!nodep->user1SetOnce()) { // Process only once.
|
if (!nodep->user1SetOnce()) { // Process only once.
|
||||||
cleanFileline(nodep);
|
cleanFileline(nodep);
|
||||||
AstNodeDType* upperDtypep = m_dtypep;
|
AstNodeDType* upperDtypep = m_dtypep;
|
||||||
|
|
@ -114,7 +114,7 @@ private:
|
||||||
m_dtypep = upperDtypep;
|
m_dtypep = upperDtypep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstEnumItem* nodep, AstNUser*) {
|
virtual void visit(AstEnumItem* nodep) {
|
||||||
// Expand ranges
|
// Expand ranges
|
||||||
cleanFileline(nodep);
|
cleanFileline(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -138,7 +138,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
cleanFileline(nodep);
|
cleanFileline(nodep);
|
||||||
if (nodep->subDTypep()->castParseTypeDType()) {
|
if (nodep->subDTypep()->castParseTypeDType()) {
|
||||||
// It's a parameter type. Use a different node type for this.
|
// It's a parameter type. Use a different node type for this.
|
||||||
|
|
@ -198,7 +198,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstAttrOf* nodep, AstNUser*) {
|
virtual void visit(AstAttrOf* nodep) {
|
||||||
cleanFileline(nodep);
|
cleanFileline(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->attrType() == AstAttrType::DT_PUBLIC) {
|
if (nodep->attrType() == AstAttrType::DT_PUBLIC) {
|
||||||
|
|
@ -264,7 +264,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstAlwaysPublic* nodep, AstNUser*) {
|
virtual void visit(AstAlwaysPublic* nodep) {
|
||||||
// AlwaysPublic was attached under a var, but it's a statement that should be
|
// AlwaysPublic was attached under a var, but it's a statement that should be
|
||||||
// at the same level as the var
|
// at the same level as the var
|
||||||
cleanFileline(nodep);
|
cleanFileline(nodep);
|
||||||
|
|
@ -279,7 +279,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstDefImplicitDType* nodep, AstNUser*) {
|
virtual void visit(AstDefImplicitDType* nodep) {
|
||||||
cleanFileline(nodep);
|
cleanFileline(nodep);
|
||||||
UINFO(8," DEFIMPLICIT "<<nodep<<endl);
|
UINFO(8," DEFIMPLICIT "<<nodep<<endl);
|
||||||
// Must remember what names we've already created, and combine duplicates
|
// Must remember what names we've already created, and combine duplicates
|
||||||
|
|
@ -315,14 +315,14 @@ private:
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstTypedefFwd* nodep, AstNUser*) {
|
virtual void visit(AstTypedefFwd* nodep) {
|
||||||
// We only needed the forward declaration in order to parse correctly.
|
// We only needed the forward declaration in order to parse correctly.
|
||||||
// We won't even check it was ever really defined, as it might have been in a header
|
// We won't even check it was ever really defined, as it might have been in a header
|
||||||
// file referring to a module we never needed
|
// file referring to a module we never needed
|
||||||
nodep->unlinkFrBack()->deleteTree();
|
nodep->unlinkFrBack()->deleteTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstForeach* nodep, AstNUser*) {
|
virtual void visit(AstForeach* nodep) {
|
||||||
// FOREACH(array,loopvars,body)
|
// FOREACH(array,loopvars,body)
|
||||||
// -> BEGIN(declare vars, loopa=lowest; WHILE(loopa<=highest, ... body))
|
// -> BEGIN(declare vars, loopa=lowest; WHILE(loopa<=highest, ... body))
|
||||||
//nodep->dumpTree(cout, "-foreach-old:");
|
//nodep->dumpTree(cout, "-foreach-old:");
|
||||||
|
|
@ -367,7 +367,7 @@ private:
|
||||||
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); nodep->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
// Module: Create sim table for entire module and iterate
|
// Module: Create sim table for entire module and iterate
|
||||||
cleanFileline(nodep);
|
cleanFileline(nodep);
|
||||||
//
|
//
|
||||||
|
|
@ -386,22 +386,22 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_valueModp = upperValueModp;
|
m_valueModp = upperValueModp;
|
||||||
}
|
}
|
||||||
virtual void visit(AstInitial* nodep, AstNUser*) {
|
virtual void visit(AstInitial* nodep) {
|
||||||
visitIterateNoValueMod(nodep);
|
visitIterateNoValueMod(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstFinal* nodep, AstNUser*) {
|
virtual void visit(AstFinal* nodep) {
|
||||||
visitIterateNoValueMod(nodep);
|
visitIterateNoValueMod(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
m_inAlways = true;
|
m_inAlways = true;
|
||||||
visitIterateNoValueMod(nodep);
|
visitIterateNoValueMod(nodep);
|
||||||
m_inAlways = false;
|
m_inAlways = false;
|
||||||
}
|
}
|
||||||
virtual void visit(AstPslCover* nodep, AstNUser*) {
|
virtual void visit(AstPslCover* nodep) {
|
||||||
visitIterateNoValueMod(nodep);
|
visitIterateNoValueMod(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
cleanFileline(nodep);
|
cleanFileline(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ private:
|
||||||
// TODO: Most of these visitors are here for historical reasons.
|
// TODO: Most of these visitors are here for historical reasons.
|
||||||
// TODO: ExpectDecriptor can move to data type resolution, and the rest
|
// TODO: ExpectDecriptor can move to data type resolution, and the rest
|
||||||
// TODO: could move to V3LinkParse to get them out of the way of elaboration
|
// TODO: could move to V3LinkParse to get them out of the way of elaboration
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
// Module: Create sim table for entire module and iterate
|
// Module: Create sim table for entire module and iterate
|
||||||
UINFO(8,"MODULE "<<nodep<<endl);
|
UINFO(8,"MODULE "<<nodep<<endl);
|
||||||
if (nodep->dead()) return;
|
if (nodep->dead()) return;
|
||||||
|
|
@ -79,21 +79,21 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstInitial* nodep, AstNUser*) {
|
virtual void visit(AstInitial* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Initial assignments under function/tasks can just be simple assignments without the initial
|
// Initial assignments under function/tasks can just be simple assignments without the initial
|
||||||
if (m_ftaskp) {
|
if (m_ftaskp) {
|
||||||
nodep->replaceWith(nodep->bodysp()->unlinkFrBackWithNext()); VL_DANGLING(nodep);
|
nodep->replaceWith(nodep->bodysp()->unlinkFrBackWithNext()); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVAssert* nodep, AstNUser*) {
|
virtual void visit(AstVAssert* nodep) {
|
||||||
if (m_assertp) nodep->v3error("Assert not allowed under another assert");
|
if (m_assertp) nodep->v3error("Assert not allowed under another assert");
|
||||||
m_assertp = nodep;
|
m_assertp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_assertp = NULL;
|
m_assertp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_ftaskp) nodep->funcLocal(true);
|
if (m_ftaskp) nodep->funcLocal(true);
|
||||||
if (nodep->isSigModPublic()) {
|
if (nodep->isSigModPublic()) {
|
||||||
|
|
@ -102,7 +102,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeVarRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeVarRef* nodep) {
|
||||||
// VarRef: Resolve its reference
|
// VarRef: Resolve its reference
|
||||||
if (nodep->varp()) {
|
if (nodep->varp()) {
|
||||||
nodep->varp()->usedParam(true);
|
nodep->varp()->usedParam(true);
|
||||||
|
|
@ -110,7 +110,7 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
// NodeTask: Remember its name for later resolution
|
// NodeTask: Remember its name for later resolution
|
||||||
// Remember the existing symbol table scope
|
// Remember the existing symbol table scope
|
||||||
m_ftaskp = nodep;
|
m_ftaskp = nodep;
|
||||||
|
|
@ -120,14 +120,14 @@ private:
|
||||||
nodep->scopeNamep(new AstScopeName(nodep->fileline()));
|
nodep->scopeNamep(new AstScopeName(nodep->fileline()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->taskp() && (nodep->taskp()->dpiContext() || nodep->taskp()->dpiExport())) {
|
if (nodep->taskp() && (nodep->taskp()->dpiContext() || nodep->taskp()->dpiExport())) {
|
||||||
nodep->scopeNamep(new AstScopeName(nodep->fileline()));
|
nodep->scopeNamep(new AstScopeName(nodep->fileline()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstSenItem* nodep, AstNUser*) {
|
virtual void visit(AstSenItem* nodep) {
|
||||||
// Remove bit selects, and bark if it's not a simple variable
|
// Remove bit selects, and bark if it's not a simple variable
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->isClocked()) {
|
if (nodep->isClocked()) {
|
||||||
|
|
@ -190,11 +190,11 @@ private:
|
||||||
nodep->v3error("Unsupported: Complex statement in sensitivity list");
|
nodep->v3error("Unsupported: Complex statement in sensitivity list");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenGate* nodep, AstNUser*) {
|
virtual void visit(AstSenGate* nodep) {
|
||||||
nodep->v3fatalSrc("SenGates shouldn't be in tree yet");
|
nodep->v3fatalSrc("SenGates shouldn't be in tree yet");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodePreSel* nodep, AstNUser*) {
|
virtual void visit(AstNodePreSel* nodep) {
|
||||||
if (!nodep->attrp()) {
|
if (!nodep->attrp()) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Constification may change the fromp() to a constant, which will lose the
|
// Constification may change the fromp() to a constant, which will lose the
|
||||||
|
|
@ -221,7 +221,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstCaseItem* nodep, AstNUser*) {
|
virtual void visit(AstCaseItem* nodep) {
|
||||||
// Move default caseItems to the bottom of the list
|
// Move default caseItems to the bottom of the list
|
||||||
// That saves us from having to search each case list twice, for non-defaults and defaults
|
// That saves us from having to search each case list twice, for non-defaults and defaults
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -233,7 +233,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstPragma* nodep, AstNUser*) {
|
virtual void visit(AstPragma* nodep) {
|
||||||
if (nodep->pragType() == AstPragmaType::PUBLIC_MODULE) {
|
if (nodep->pragType() == AstPragmaType::PUBLIC_MODULE) {
|
||||||
if (!m_modp) nodep->v3fatalSrc("PUBLIC_MODULE not under a module\n");
|
if (!m_modp) nodep->v3fatalSrc("PUBLIC_MODULE not under a module\n");
|
||||||
m_modp->modPublic(true);
|
m_modp->modPublic(true);
|
||||||
|
|
@ -354,27 +354,27 @@ private:
|
||||||
if (filep && filep->varp()) filep->varp()->attrFileDescr(true);
|
if (filep && filep->varp()) filep->varp()->attrFileDescr(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstFOpen* nodep, AstNUser*) {
|
virtual void visit(AstFOpen* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
expectDescriptor(nodep, nodep->filep()->castNodeVarRef());
|
expectDescriptor(nodep, nodep->filep()->castNodeVarRef());
|
||||||
}
|
}
|
||||||
virtual void visit(AstFClose* nodep, AstNUser*) {
|
virtual void visit(AstFClose* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
expectDescriptor(nodep, nodep->filep()->castNodeVarRef());
|
expectDescriptor(nodep, nodep->filep()->castNodeVarRef());
|
||||||
}
|
}
|
||||||
virtual void visit(AstFEof* nodep, AstNUser*) {
|
virtual void visit(AstFEof* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
expectDescriptor(nodep, nodep->filep()->castNodeVarRef());
|
expectDescriptor(nodep, nodep->filep()->castNodeVarRef());
|
||||||
}
|
}
|
||||||
virtual void visit(AstFScanF* nodep, AstNUser*) {
|
virtual void visit(AstFScanF* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
expectFormat(nodep, nodep->text(), nodep->exprsp(), true);
|
expectFormat(nodep, nodep->text(), nodep->exprsp(), true);
|
||||||
}
|
}
|
||||||
virtual void visit(AstSScanF* nodep, AstNUser*) {
|
virtual void visit(AstSScanF* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
expectFormat(nodep, nodep->text(), nodep->exprsp(), true);
|
expectFormat(nodep, nodep->text(), nodep->exprsp(), true);
|
||||||
}
|
}
|
||||||
virtual void visit(AstSFormatF* nodep, AstNUser*) {
|
virtual void visit(AstSFormatF* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
string newFormat = expectFormat(nodep, nodep->text(), nodep->exprsp(), false);
|
string newFormat = expectFormat(nodep, nodep->text(), nodep->exprsp(), false);
|
||||||
nodep->text(newFormat);
|
nodep->text(newFormat);
|
||||||
|
|
@ -383,11 +383,11 @@ private:
|
||||||
nodep->scopeNamep(new AstScopeName(nodep->fileline()));
|
nodep->scopeNamep(new AstScopeName(nodep->fileline()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstDisplay* nodep, AstNUser* vup) {
|
virtual void visit(AstDisplay* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstUdpTable* nodep, AstNUser*) {
|
virtual void visit(AstUdpTable* nodep) {
|
||||||
UINFO(5,"UDPTABLE "<<nodep<<endl);
|
UINFO(5,"UDPTABLE "<<nodep<<endl);
|
||||||
if (!v3Global.opt.bboxUnsup()) {
|
if (!v3Global.opt.bboxUnsup()) {
|
||||||
// We don't warn until V3Inst, so that UDPs that are in libraries and
|
// We don't warn until V3Inst, so that UDPs that are in libraries and
|
||||||
|
|
@ -414,23 +414,23 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstScCtor* nodep, AstNUser*) {
|
virtual void visit(AstScCtor* nodep) {
|
||||||
// Constructor info means the module must remain public
|
// Constructor info means the module must remain public
|
||||||
m_modp->modPublic(true);
|
m_modp->modPublic(true);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstScDtor* nodep, AstNUser*) {
|
virtual void visit(AstScDtor* nodep) {
|
||||||
// Destructor info means the module must remain public
|
// Destructor info means the module must remain public
|
||||||
m_modp->modPublic(true);
|
m_modp->modPublic(true);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstScInt* nodep, AstNUser*) {
|
virtual void visit(AstScInt* nodep) {
|
||||||
// Special class info means the module must remain public
|
// Special class info means the module must remain public
|
||||||
m_modp->modPublic(true);
|
m_modp->modPublic(true);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
@ -466,24 +466,24 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITs
|
// VISITs
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
// Iterate modules backwards, in bottom-up order.
|
// Iterate modules backwards, in bottom-up order.
|
||||||
nodep->iterateChildrenBackwards(*this);
|
nodep->iterateChildrenBackwards(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
// Parent module inherits child's publicity
|
// Parent module inherits child's publicity
|
||||||
if (nodep->modp()->modPublic()) m_modp->modPublic(true);
|
if (nodep->modp()->modPublic()) m_modp->modPublic(true);
|
||||||
//** No iteration for speed
|
//** No iteration for speed
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeMath* nodep, AstNUser*) {
|
virtual void visit(AstNodeMath* nodep) {
|
||||||
// Speedup
|
// Speedup
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,14 +81,14 @@ private:
|
||||||
// See above
|
// See above
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
VarFlags flags (nodep->varp());
|
VarFlags flags (nodep->varp());
|
||||||
if (flags.m_done) {
|
if (flags.m_done) {
|
||||||
nodep->hiername(""); // Remove thisp->
|
nodep->hiername(""); // Remove thisp->
|
||||||
nodep->hierThis(true);
|
nodep->hierThis(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -155,11 +155,11 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
moveVars();
|
moveVars();
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
UINFO(4," CFUNC "<<nodep<<endl);
|
UINFO(4," CFUNC "<<nodep<<endl);
|
||||||
m_cfuncp = nodep;
|
m_cfuncp = nodep;
|
||||||
searchFuncStmts(nodep->argsp());
|
searchFuncStmts(nodep->argsp());
|
||||||
|
|
@ -190,7 +190,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
if (!nodep->isSigPublic()
|
if (!nodep->isSigPublic()
|
||||||
&& !nodep->isPrimaryIO()
|
&& !nodep->isPrimaryIO()
|
||||||
&& !m_cfuncp) { // Not already inside a function
|
&& !m_cfuncp) { // Not already inside a function
|
||||||
|
|
@ -199,7 +199,7 @@ private:
|
||||||
}
|
}
|
||||||
// No iterate; Don't want varrefs under it
|
// No iterate; Don't want varrefs under it
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (!VarFlags(nodep->varp()).m_notOpt) {
|
if (!VarFlags(nodep->varp()).m_notOpt) {
|
||||||
if (!m_cfuncp) { // Not in function, can't optimize
|
if (!m_cfuncp) { // Not in function, can't optimize
|
||||||
clearOptimizable(nodep->varp(), "BVnofunc");
|
clearOptimizable(nodep->varp(), "BVnofunc");
|
||||||
|
|
@ -228,7 +228,7 @@ private:
|
||||||
}
|
}
|
||||||
// No iterate; Don't want varrefs under it
|
// No iterate; Don't want varrefs under it
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -76,50 +76,50 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
// Add __PVT__ to names of local signals
|
// Add __PVT__ to names of local signals
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
// Don't iterate... Don't need temps for RANGES under the Var.
|
// Don't iterate... Don't need temps for RANGES under the Var.
|
||||||
rename(nodep, (!m_modp->isTop()
|
rename(nodep, (!m_modp->isTop()
|
||||||
&& !nodep->isSigPublic()
|
&& !nodep->isSigPublic()
|
||||||
&& !nodep->isFuncLocal() // Isn't exposed, and would mess up dpi import wrappers
|
&& !nodep->isFuncLocal() // Isn't exposed, and would mess up dpi import wrappers
|
||||||
&& !nodep->isTemp())); // Don't bother to rename internal signals
|
&& !nodep->isTemp())); // Don't bother to rename internal signals
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
if (!nodep->user1()) {
|
if (!nodep->user1()) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
rename(nodep, false);
|
rename(nodep, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (nodep->varp()) {
|
if (nodep->varp()) {
|
||||||
nodep->varp()->iterate(*this);
|
nodep->varp()->iterate(*this);
|
||||||
nodep->name(nodep->varp()->name());
|
nodep->name(nodep->varp()->name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
if (!nodep->user1()) {
|
if (!nodep->user1()) {
|
||||||
rename(nodep, !nodep->modp()->modPublic());
|
rename(nodep, !nodep->modp()->modPublic());
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstMemberDType* nodep, AstNUser*) {
|
virtual void visit(AstMemberDType* nodep) {
|
||||||
if (!nodep->user1()) {
|
if (!nodep->user1()) {
|
||||||
rename(nodep, false);
|
rename(nodep, false);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstMemberSel* nodep, AstNUser*) {
|
virtual void visit(AstMemberSel* nodep) {
|
||||||
if (!nodep->user1()) {
|
if (!nodep->user1()) {
|
||||||
rename(nodep, false);
|
rename(nodep, false);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
if (!nodep->user1SetOnce()) {
|
if (!nodep->user1SetOnce()) {
|
||||||
if (nodep->aboveScopep()) nodep->aboveScopep()->iterate(*this);
|
if (nodep->aboveScopep()) nodep->aboveScopep()->iterate(*this);
|
||||||
if (nodep->aboveCellp()) nodep->aboveCellp()->iterate(*this);
|
if (nodep->aboveCellp()) nodep->aboveCellp()->iterate(*this);
|
||||||
|
|
@ -132,7 +132,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -270,10 +270,10 @@ private:
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
m_hasClk = false;
|
m_hasClk = false;
|
||||||
if (AstVarRef* varrefp = nodep->rhsp()->castVarRef()) {
|
if (AstVarRef* varrefp = nodep->rhsp()->castVarRef()) {
|
||||||
this->visit(varrefp, NULL);
|
this->visit(varrefp);
|
||||||
m_rightClkWidth = varrefp->width();
|
m_rightClkWidth = varrefp->width();
|
||||||
if (varrefp->varp()->attrClocker() == AstVarAttrClocker::CLOCKER_YES) {
|
if (varrefp->varp()->attrClocker() == AstVarAttrClocker::CLOCKER_YES) {
|
||||||
if (m_inClocked) {
|
if (m_inClocked) {
|
||||||
|
|
@ -309,7 +309,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (m_inAss && nodep->varp()->attrClocker() == AstVarAttrClocker::CLOCKER_YES) {
|
if (m_inAss && nodep->varp()->attrClocker() == AstVarAttrClocker::CLOCKER_YES) {
|
||||||
if (m_inClocked) {
|
if (m_inClocked) {
|
||||||
nodep->v3warn(CLKDATA, "Clock used as data (on rhs of assignment) in sequential block "<<nodep->prettyName());
|
nodep->v3warn(CLKDATA, "Clock used as data (on rhs of assignment) in sequential block "<<nodep->prettyName());
|
||||||
|
|
@ -320,7 +320,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstConcat* nodep, AstNUser*) {
|
virtual void visit(AstConcat* nodep) {
|
||||||
if (m_inAss) {
|
if (m_inAss) {
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
int lw = m_childClkWidth;
|
int lw = m_childClkWidth;
|
||||||
|
|
@ -329,20 +329,20 @@ private:
|
||||||
m_childClkWidth = lw + rw; // Pass up
|
m_childClkWidth = lw + rw; // Pass up
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeSel* nodep, AstNUser*) {
|
virtual void visit(AstNodeSel* nodep) {
|
||||||
if (m_inAss) {
|
if (m_inAss) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Pass up result width
|
// Pass up result width
|
||||||
if (m_childClkWidth > nodep->width()) m_childClkWidth = nodep->width();
|
if (m_childClkWidth > nodep->width()) m_childClkWidth = nodep->width();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstSel* nodep, AstNUser*) {
|
virtual void visit(AstSel* nodep) {
|
||||||
if (m_inAss) {
|
if (m_inAss) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_childClkWidth > nodep->width()) m_childClkWidth = nodep->width();
|
if (m_childClkWidth > nodep->width()) m_childClkWidth = nodep->width();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstReplicate* nodep, AstNUser*) {
|
virtual void visit(AstReplicate* nodep) {
|
||||||
if (m_inAss) {
|
if (m_inAss) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->rhsp()->castConst()) {
|
if (nodep->rhsp()->castConst()) {
|
||||||
|
|
@ -352,12 +352,12 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstActive* nodep, AstNUser*) {
|
virtual void visit(AstActive* nodep) {
|
||||||
m_inClocked = nodep->hasClocked();
|
m_inClocked = nodep->hasClocked();
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_inClocked = false;
|
m_inClocked = false;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -390,7 +390,7 @@ private:
|
||||||
if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__);
|
if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__);
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
if (AstVarRef* varrefp = nodep->lhsp()->castVarRef() )
|
if (AstVarRef* varrefp = nodep->lhsp()->castVarRef() )
|
||||||
if (varrefp->varp()->attrClocker() == AstVarAttrClocker::CLOCKER_YES) {
|
if (varrefp->varp()->attrClocker() == AstVarAttrClocker::CLOCKER_YES) {
|
||||||
m_clkAss = true;
|
m_clkAss = true;
|
||||||
|
|
@ -398,13 +398,13 @@ private:
|
||||||
}
|
}
|
||||||
nodep->rhsp()->iterateChildren(*this);
|
nodep->rhsp()->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (nodep->varp()->attrClocker() == AstVarAttrClocker::CLOCKER_YES) {
|
if (nodep->varp()->attrClocker() == AstVarAttrClocker::CLOCKER_YES) {
|
||||||
m_clkAss = true;
|
m_clkAss = true;
|
||||||
UINFO(6, "node was marked as clocker "<<nodep<<endl);
|
UINFO(6, "node was marked as clocker "<<nodep<<endl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -722,7 +722,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
{
|
{
|
||||||
AstUser4InUse m_inuser4; // Used only when building tree, so below
|
AstUser4InUse m_inuser4; // Used only when building tree, so below
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -730,7 +730,7 @@ private:
|
||||||
// We're finished, complete the topscopes
|
// We're finished, complete the topscopes
|
||||||
if (m_topScopep) { process(); m_topScopep=NULL; }
|
if (m_topScopep) { process(); m_topScopep=NULL; }
|
||||||
}
|
}
|
||||||
virtual void visit(AstTopScope* nodep, AstNUser*) {
|
virtual void visit(AstTopScope* nodep) {
|
||||||
// Process the last thing we're finishing
|
// Process the last thing we're finishing
|
||||||
if (m_topScopep) nodep->v3fatalSrc("Only one topscope should ever be created");
|
if (m_topScopep) nodep->v3fatalSrc("Only one topscope should ever be created");
|
||||||
UINFO(2," Loading tree...\n");
|
UINFO(2," Loading tree...\n");
|
||||||
|
|
@ -768,12 +768,12 @@ private:
|
||||||
AstNode::user3ClearTree();
|
AstNode::user3ClearTree();
|
||||||
AstNode::user4ClearTree();
|
AstNode::user4ClearTree();
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
UINFO(4," SCOPE "<<nodep<<endl);
|
UINFO(4," SCOPE "<<nodep<<endl);
|
||||||
m_scopep = nodep;
|
m_scopep = nodep;
|
||||||
m_logicVxp = NULL;
|
m_logicVxp = NULL;
|
||||||
|
|
@ -783,7 +783,7 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_scopep = NULL;
|
m_scopep = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstActive* nodep, AstNUser*) {
|
virtual void visit(AstActive* nodep) {
|
||||||
// Create required activation blocks and add to module
|
// Create required activation blocks and add to module
|
||||||
UINFO(4," ACTIVE "<<nodep<<endl);
|
UINFO(4," ACTIVE "<<nodep<<endl);
|
||||||
m_activep = nodep;
|
m_activep = nodep;
|
||||||
|
|
@ -796,14 +796,14 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_activep = NULL;
|
m_activep = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarScope* nodep, AstNUser*) {
|
virtual void visit(AstVarScope* nodep) {
|
||||||
// Create links to all input signals
|
// Create links to all input signals
|
||||||
if (m_modp->isTop() && nodep->varp()->isInput()) {
|
if (m_modp->isTop() && nodep->varp()->isInput()) {
|
||||||
OrderVarVertex* varVxp = newVarUserVertex(nodep, WV_STD);
|
OrderVarVertex* varVxp = newVarUserVertex(nodep, WV_STD);
|
||||||
new OrderEdge(&m_graph, m_inputsVxp, varVxp, WEIGHT_INPUT);
|
new OrderEdge(&m_graph, m_inputsVxp, varVxp, WEIGHT_INPUT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeVarRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeVarRef* nodep) {
|
||||||
if (m_scopep) {
|
if (m_scopep) {
|
||||||
AstVarScope* varscp = nodep->varScopep();
|
AstVarScope* varscp = nodep->varScopep();
|
||||||
if (!varscp) nodep->v3fatalSrc("Var didn't get varscoped in V3Scope.cpp\n");
|
if (!varscp) nodep->v3fatalSrc("Var didn't get varscoped in V3Scope.cpp\n");
|
||||||
|
|
@ -926,7 +926,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenTree* nodep, AstNUser*) {
|
virtual void visit(AstSenTree* nodep) {
|
||||||
// Having a node derived from the sentree isn't required for
|
// Having a node derived from the sentree isn't required for
|
||||||
// correctness, it mearly makes the graph better connected
|
// correctness, it mearly makes the graph better connected
|
||||||
// and improves graph algorithmic performance
|
// and improves graph algorithmic performance
|
||||||
|
|
@ -941,27 +941,27 @@ private:
|
||||||
m_inSenTree = false;
|
m_inSenTree = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
iterateNewStmt(nodep);
|
iterateNewStmt(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlwaysPost* nodep, AstNUser*) {
|
virtual void visit(AstAlwaysPost* nodep) {
|
||||||
m_inPost = true;
|
m_inPost = true;
|
||||||
iterateNewStmt(nodep);
|
iterateNewStmt(nodep);
|
||||||
m_inPost = false;
|
m_inPost = false;
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlwaysPublic* nodep, AstNUser*) {
|
virtual void visit(AstAlwaysPublic* nodep) {
|
||||||
iterateNewStmt(nodep);
|
iterateNewStmt(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignAlias* nodep, AstNUser*) {
|
virtual void visit(AstAssignAlias* nodep) {
|
||||||
iterateNewStmt(nodep);
|
iterateNewStmt(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignW* nodep, AstNUser*) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
OrderClkAssVisitor visitor(nodep);
|
OrderClkAssVisitor visitor(nodep);
|
||||||
m_inClkAss = visitor.isClkAss();
|
m_inClkAss = visitor.isClkAss();
|
||||||
iterateNewStmt(nodep);
|
iterateNewStmt(nodep);
|
||||||
m_inClkAss = false;
|
m_inClkAss = false;
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignPre* nodep, AstNUser*) {
|
virtual void visit(AstAssignPre* nodep) {
|
||||||
OrderClkAssVisitor visitor(nodep);
|
OrderClkAssVisitor visitor(nodep);
|
||||||
m_inClkAss = visitor.isClkAss();
|
m_inClkAss = visitor.isClkAss();
|
||||||
m_inPre = true;
|
m_inPre = true;
|
||||||
|
|
@ -969,7 +969,7 @@ private:
|
||||||
m_inPre = false;
|
m_inPre = false;
|
||||||
m_inClkAss = false;
|
m_inClkAss = false;
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignPost* nodep, AstNUser*) {
|
virtual void visit(AstAssignPost* nodep) {
|
||||||
OrderClkAssVisitor visitor(nodep);
|
OrderClkAssVisitor visitor(nodep);
|
||||||
m_inClkAss = visitor.isClkAss();
|
m_inClkAss = visitor.isClkAss();
|
||||||
m_inPost = true;
|
m_inPost = true;
|
||||||
|
|
@ -977,15 +977,15 @@ private:
|
||||||
m_inPost = false;
|
m_inPost = false;
|
||||||
m_inClkAss = false;
|
m_inClkAss = false;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCoverToggle* nodep, AstNUser*) {
|
virtual void visit(AstCoverToggle* nodep) {
|
||||||
iterateNewStmt(nodep);
|
iterateNewStmt(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstInitial* nodep, AstNUser*) {
|
virtual void visit(AstInitial* nodep) {
|
||||||
// We use initials to setup parameters and static consts's which may be referenced
|
// We use initials to setup parameters and static consts's which may be referenced
|
||||||
// in user initial blocks. So use ordering to sort them all out.
|
// in user initial blocks. So use ordering to sort them all out.
|
||||||
iterateNewStmt(nodep);
|
iterateNewStmt(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc*, AstNUser*) {
|
virtual void visit(AstCFunc*) {
|
||||||
// Ignore for now
|
// Ignore for now
|
||||||
// We should detect what variables are set in the function, and make
|
// We should detect what variables are set in the function, and make
|
||||||
// settlement code for them, then set a global flag, so we call "settle"
|
// settlement code for them, then set a global flag, so we call "settle"
|
||||||
|
|
@ -993,7 +993,7 @@ private:
|
||||||
}
|
}
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default
|
// Default
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -238,11 +238,11 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
// Modules must be done in top-down-order
|
// Modules must be done in top-down-order
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
if (nodep->dead()) {
|
if (nodep->dead()) {
|
||||||
UINFO(4," MOD-dead. "<<nodep<<endl); // Marked by LinkDot
|
UINFO(4," MOD-dead. "<<nodep<<endl); // Marked by LinkDot
|
||||||
} else if (nodep->level() <= 2 // Haven't added top yet, so level 2 is the top
|
} else if (nodep->level() <= 2 // Haven't added top yet, so level 2 is the top
|
||||||
|
|
@ -256,13 +256,13 @@ private:
|
||||||
UINFO(4," MOD-dead? "<<nodep<<endl); // Should have been done by now, if not dead
|
UINFO(4," MOD-dead? "<<nodep<<endl); // Should have been done by now, if not dead
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
// Must do ifaces first, so push to list and do in proper order
|
// Must do ifaces first, so push to list and do in proper order
|
||||||
m_cellps.push_back(nodep);
|
m_cellps.push_back(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure all parameters are constantified
|
// Make sure all parameters are constantified
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
if (!nodep->user5SetOnce()) { // Process once
|
if (!nodep->user5SetOnce()) { // Process once
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->isParam()) {
|
if (nodep->isParam()) {
|
||||||
|
|
@ -280,14 +280,14 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Make sure varrefs cause vars to constify before things above
|
// Make sure varrefs cause vars to constify before things above
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (nodep->varp()) nodep->varp()->iterate(*this);
|
if (nodep->varp()) nodep->varp()->iterate(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarXRef* nodep, AstNUser*) {
|
virtual void visit(AstVarXRef* nodep) {
|
||||||
nodep->varp(NULL); // Needs relink, as may remove pointed-to var
|
nodep->varp(NULL); // Needs relink, as may remove pointed-to var
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstUnlinkedRef* nodep, AstNUser*) {
|
virtual void visit(AstUnlinkedRef* nodep) {
|
||||||
AstVarXRef* varxrefp = nodep->op1p()->castVarXRef();
|
AstVarXRef* varxrefp = nodep->op1p()->castVarXRef();
|
||||||
AstNodeFTaskRef* taskrefp = nodep->op1p()->castNodeFTaskRef();
|
AstNodeFTaskRef* taskrefp = nodep->op1p()->castNodeFTaskRef();
|
||||||
if (varxrefp) {
|
if (varxrefp) {
|
||||||
|
|
@ -308,7 +308,7 @@ private:
|
||||||
nodep->replaceWith(nodep->op1p()->unlinkFrBack());
|
nodep->replaceWith(nodep->op1p()->unlinkFrBack());
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCellArrayRef* nodep, AstNUser*) {
|
virtual void visit(AstCellArrayRef* nodep) {
|
||||||
V3Const::constifyParamsEdit(nodep->selp());
|
V3Const::constifyParamsEdit(nodep->selp());
|
||||||
if (AstConst* constp = nodep->selp()->castConst()) {
|
if (AstConst* constp = nodep->selp()->castConst()) {
|
||||||
string index = AstNode::encodeNumber(constp->toSInt());
|
string index = AstNode::encodeNumber(constp->toSInt());
|
||||||
|
|
@ -326,7 +326,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate Statements
|
// Generate Statements
|
||||||
virtual void visit(AstGenerate* nodep, AstNUser*) {
|
virtual void visit(AstGenerate* nodep) {
|
||||||
if (debug()>=9) nodep->dumpTree(cout,"-genin: ");
|
if (debug()>=9) nodep->dumpTree(cout,"-genin: ");
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// After expanding the generate, all statements under it can be moved
|
// After expanding the generate, all statements under it can be moved
|
||||||
|
|
@ -340,7 +340,7 @@ private:
|
||||||
}
|
}
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstGenIf* nodep, AstNUser*) {
|
virtual void visit(AstGenIf* nodep) {
|
||||||
UINFO(9," GENIF "<<nodep<<endl);
|
UINFO(9," GENIF "<<nodep<<endl);
|
||||||
nodep->condp()->iterateAndNext(*this);
|
nodep->condp()->iterateAndNext(*this);
|
||||||
// We suppress errors when widthing params since short-circuiting in
|
// We suppress errors when widthing params since short-circuiting in
|
||||||
|
|
@ -370,7 +370,7 @@ private:
|
||||||
//! @todo Unlike generated IF, we don't have to worry about short-circuiting the conditional
|
//! @todo Unlike generated IF, we don't have to worry about short-circuiting the conditional
|
||||||
//! expression, since this is currently restricted to simple comparisons. If we ever do
|
//! expression, since this is currently restricted to simple comparisons. If we ever do
|
||||||
//! move to more generic constant expressions, such code will be needed here.
|
//! move to more generic constant expressions, such code will be needed here.
|
||||||
virtual void visit(AstBegin* nodep, AstNUser*) {
|
virtual void visit(AstBegin* nodep) {
|
||||||
if (nodep->genforp()) {
|
if (nodep->genforp()) {
|
||||||
AstGenFor* forp = nodep->genforp()->castGenFor();
|
AstGenFor* forp = nodep->genforp()->castGenFor();
|
||||||
if (!forp) nodep->v3fatalSrc("Non-GENFOR under generate-for BEGIN");
|
if (!forp) nodep->v3fatalSrc("Non-GENFOR under generate-for BEGIN");
|
||||||
|
|
@ -398,10 +398,10 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstGenFor* nodep, AstNUser*) {
|
virtual void visit(AstGenFor* nodep) {
|
||||||
nodep->v3fatalSrc("GENFOR should have been wrapped in BEGIN");
|
nodep->v3fatalSrc("GENFOR should have been wrapped in BEGIN");
|
||||||
}
|
}
|
||||||
virtual void visit(AstGenCase* nodep, AstNUser*) {
|
virtual void visit(AstGenCase* nodep) {
|
||||||
UINFO(9," GENCASE "<<nodep<<endl);
|
UINFO(9," GENCASE "<<nodep<<endl);
|
||||||
AstNode* keepp = NULL;
|
AstNode* keepp = NULL;
|
||||||
nodep->exprp()->iterateAndNext(*this);
|
nodep->exprp()->iterateAndNext(*this);
|
||||||
|
|
@ -451,7 +451,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,14 +61,14 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
//AstNode::user4ClearTree(); // Implied by AstUser4InUse
|
//AstNode::user4ClearTree(); // Implied by AstUser4InUse
|
||||||
// LHS first as fewer varrefs
|
// LHS first as fewer varrefs
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
// Now find vars marked as lhs
|
// Now find vars marked as lhs
|
||||||
nodep->rhsp()->iterateAndNext(*this);
|
nodep->rhsp()->iterateAndNext(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
// it's LHS var is used so need a deep temporary
|
// it's LHS var is used so need a deep temporary
|
||||||
if (nodep->lvalue()) {
|
if (nodep->lvalue()) {
|
||||||
nodep->varp()->user4(true);
|
nodep->varp()->user4(true);
|
||||||
|
|
@ -79,7 +79,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -205,14 +205,14 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
UINFO(4," MOD "<<nodep<<endl);
|
UINFO(4," MOD "<<nodep<<endl);
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
m_funcp = NULL;
|
m_funcp = NULL;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
m_funcp = nodep;
|
m_funcp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_funcp = NULL;
|
m_funcp = NULL;
|
||||||
|
|
@ -221,7 +221,7 @@ private:
|
||||||
m_assignLhs = false;
|
m_assignLhs = false;
|
||||||
if (m_funcp) m_stmtp = nodep;
|
if (m_funcp) m_stmtp = nodep;
|
||||||
}
|
}
|
||||||
virtual void visit(AstWhile* nodep, AstNUser*) {
|
virtual void visit(AstWhile* nodep) {
|
||||||
UINFO(4," WHILE "<<nodep<<endl);
|
UINFO(4," WHILE "<<nodep<<endl);
|
||||||
startStatement(nodep);
|
startStatement(nodep);
|
||||||
nodep->precondsp()->iterateAndNext(*this);
|
nodep->precondsp()->iterateAndNext(*this);
|
||||||
|
|
@ -234,7 +234,7 @@ private:
|
||||||
nodep->incsp()->iterateAndNext(*this);
|
nodep->incsp()->iterateAndNext(*this);
|
||||||
m_stmtp = NULL;
|
m_stmtp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
startStatement(nodep);
|
startStatement(nodep);
|
||||||
{
|
{
|
||||||
bool noopt = PremitAssignVisitor(nodep).noOpt();
|
bool noopt = PremitAssignVisitor(nodep).noOpt();
|
||||||
|
|
@ -250,13 +250,13 @@ private:
|
||||||
m_assignLhs = false;
|
m_assignLhs = false;
|
||||||
m_stmtp = NULL;
|
m_stmtp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeStmt* nodep, AstNUser*) {
|
virtual void visit(AstNodeStmt* nodep) {
|
||||||
UINFO(4," STMT "<<nodep<<endl);
|
UINFO(4," STMT "<<nodep<<endl);
|
||||||
startStatement(nodep);
|
startStatement(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_stmtp = NULL;
|
m_stmtp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstTraceInc* nodep, AstNUser*) {
|
virtual void visit(AstTraceInc* nodep) {
|
||||||
startStatement(nodep);
|
startStatement(nodep);
|
||||||
m_inTracep = nodep;
|
m_inTracep = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -310,25 +310,25 @@ private:
|
||||||
}
|
}
|
||||||
nodep->iterateChildren(*this); checkNode(nodep);
|
nodep->iterateChildren(*this); checkNode(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstShiftL* nodep, AstNUser*) {
|
virtual void visit(AstShiftL* nodep) {
|
||||||
visitShift(nodep);
|
visitShift(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstShiftR* nodep, AstNUser*) {
|
virtual void visit(AstShiftR* nodep) {
|
||||||
visitShift(nodep);
|
visitShift(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstShiftRS* nodep, AstNUser*) {
|
virtual void visit(AstShiftRS* nodep) {
|
||||||
visitShift(nodep);
|
visitShift(nodep);
|
||||||
}
|
}
|
||||||
// Operators
|
// Operators
|
||||||
virtual void visit(AstNodeTermop* nodep, AstNUser*) {
|
virtual void visit(AstNodeTermop* nodep) {
|
||||||
nodep->iterateChildren(*this); checkNode(nodep); }
|
nodep->iterateChildren(*this); checkNode(nodep); }
|
||||||
virtual void visit(AstNodeUniop* nodep, AstNUser*) {
|
virtual void visit(AstNodeUniop* nodep) {
|
||||||
nodep->iterateChildren(*this); checkNode(nodep); }
|
nodep->iterateChildren(*this); checkNode(nodep); }
|
||||||
virtual void visit(AstNodeBiop* nodep, AstNUser*) {
|
virtual void visit(AstNodeBiop* nodep) {
|
||||||
nodep->iterateChildren(*this); checkNode(nodep); }
|
nodep->iterateChildren(*this); checkNode(nodep); }
|
||||||
virtual void visit(AstUCFunc* nodep, AstNUser*) {
|
virtual void visit(AstUCFunc* nodep) {
|
||||||
nodep->iterateChildren(*this); checkNode(nodep); }
|
nodep->iterateChildren(*this); checkNode(nodep); }
|
||||||
virtual void visit(AstSel* nodep, AstNUser*) {
|
virtual void visit(AstSel* nodep) {
|
||||||
nodep->fromp()->iterateAndNext(*this);
|
nodep->fromp()->iterateAndNext(*this);
|
||||||
{ // Only the 'from' is part of the assignment LHS
|
{ // Only the 'from' is part of the assignment LHS
|
||||||
bool prevAssign = m_assignLhs;
|
bool prevAssign = m_assignLhs;
|
||||||
|
|
@ -338,9 +338,9 @@ private:
|
||||||
m_assignLhs = prevAssign;
|
m_assignLhs = prevAssign;
|
||||||
}
|
}
|
||||||
checkNode(nodep); }
|
checkNode(nodep); }
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) {
|
virtual void visit(AstConst* nodep) {
|
||||||
nodep->iterateChildren(*this); checkNode(nodep); }
|
nodep->iterateChildren(*this); checkNode(nodep); }
|
||||||
virtual void visit(AstNodeCond* nodep, AstNUser*) {
|
virtual void visit(AstNodeCond* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->expr1p()->isWide()
|
if (nodep->expr1p()->isWide()
|
||||||
&& !nodep->condp()->castConst()
|
&& !nodep->condp()->castConst()
|
||||||
|
|
@ -353,7 +353,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Autoflush
|
// Autoflush
|
||||||
virtual void visit(AstDisplay* nodep, AstNUser*) {
|
virtual void visit(AstDisplay* nodep) {
|
||||||
startStatement(nodep);
|
startStatement(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_stmtp = NULL;
|
m_stmtp = NULL;
|
||||||
|
|
@ -371,7 +371,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstSFormatF* nodep, AstNUser*) {
|
virtual void visit(AstSFormatF* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Any strings sent to a display must be var of string data type,
|
// Any strings sent to a display must be var of string data type,
|
||||||
// to avoid passing a pointer to a temporary.
|
// to avoid passing a pointer to a temporary.
|
||||||
|
|
@ -385,8 +385,8 @@ private:
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {} // Don't hit varrefs under vars
|
virtual void visit(AstVar* nodep) {} // Don't hit varrefs under vars
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
AstNodeModule* modp = nodep->topModulep();
|
AstNodeModule* modp = nodep->topModulep();
|
||||||
if (!modp) { nodep->v3error("No root module specified"); return; }
|
if (!modp) { nodep->v3error("No root module specified"); return; }
|
||||||
// Operate starting at the top of the hierarchy
|
// Operate starting at the top of the hierarchy
|
||||||
|
|
@ -99,7 +99,7 @@ private:
|
||||||
modp->accept(*this);
|
modp->accept(*this);
|
||||||
cleanupVarRefs();
|
cleanupVarRefs();
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
// Create required blocks and add to module
|
// Create required blocks and add to module
|
||||||
string scopename;
|
string scopename;
|
||||||
if (!m_aboveScopep) scopename = "TOP";
|
if (!m_aboveScopep) scopename = "TOP";
|
||||||
|
|
@ -149,10 +149,10 @@ private:
|
||||||
|
|
||||||
// ***Note m_scopep is passed back to the caller of the routine (above)
|
// ***Note m_scopep is passed back to the caller of the routine (above)
|
||||||
}
|
}
|
||||||
virtual void visit(AstActive* nodep, AstNUser*) {
|
virtual void visit(AstActive* nodep) {
|
||||||
nodep->v3fatalSrc("Actives now made after scoping");
|
nodep->v3fatalSrc("Actives now made after scoping");
|
||||||
}
|
}
|
||||||
virtual void visit(AstInitial* nodep, AstNUser*) {
|
virtual void visit(AstInitial* nodep) {
|
||||||
// Add to list of blocks under this scope
|
// Add to list of blocks under this scope
|
||||||
UINFO(4," Move "<<nodep<<endl);
|
UINFO(4," Move "<<nodep<<endl);
|
||||||
AstInitial* clonep = nodep->cloneTree(false);
|
AstInitial* clonep = nodep->cloneTree(false);
|
||||||
|
|
@ -160,7 +160,7 @@ private:
|
||||||
m_scopep->addActivep(clonep);
|
m_scopep->addActivep(clonep);
|
||||||
clonep->iterateChildren(*this); // We iterate under the *clone*
|
clonep->iterateChildren(*this); // We iterate under the *clone*
|
||||||
}
|
}
|
||||||
virtual void visit(AstFinal* nodep, AstNUser*) {
|
virtual void visit(AstFinal* nodep) {
|
||||||
// Add to list of blocks under this scope
|
// Add to list of blocks under this scope
|
||||||
UINFO(4," Move "<<nodep<<endl);
|
UINFO(4," Move "<<nodep<<endl);
|
||||||
AstFinal* clonep = nodep->cloneTree(false);
|
AstFinal* clonep = nodep->cloneTree(false);
|
||||||
|
|
@ -168,7 +168,7 @@ private:
|
||||||
m_scopep->addActivep(clonep);
|
m_scopep->addActivep(clonep);
|
||||||
clonep->iterateChildren(*this); // We iterate under the *clone*
|
clonep->iterateChildren(*this); // We iterate under the *clone*
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignAlias* nodep, AstNUser*) {
|
virtual void visit(AstAssignAlias* nodep) {
|
||||||
// Add to list of blocks under this scope
|
// Add to list of blocks under this scope
|
||||||
UINFO(4," Move "<<nodep<<endl);
|
UINFO(4," Move "<<nodep<<endl);
|
||||||
AstNode* clonep = nodep->cloneTree(false);
|
AstNode* clonep = nodep->cloneTree(false);
|
||||||
|
|
@ -176,7 +176,7 @@ private:
|
||||||
m_scopep->addActivep(clonep);
|
m_scopep->addActivep(clonep);
|
||||||
clonep->iterateChildren(*this); // We iterate under the *clone*
|
clonep->iterateChildren(*this); // We iterate under the *clone*
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignVarScope* nodep, AstNUser*) {
|
virtual void visit(AstAssignVarScope* nodep) {
|
||||||
// Copy under the scope but don't recurse
|
// Copy under the scope but don't recurse
|
||||||
UINFO(4," Move "<<nodep<<endl);
|
UINFO(4," Move "<<nodep<<endl);
|
||||||
AstNode* clonep = nodep->cloneTree(false);
|
AstNode* clonep = nodep->cloneTree(false);
|
||||||
|
|
@ -184,7 +184,7 @@ private:
|
||||||
m_scopep->addActivep(clonep);
|
m_scopep->addActivep(clonep);
|
||||||
clonep->iterateChildren(*this); // We iterate under the *clone*
|
clonep->iterateChildren(*this); // We iterate under the *clone*
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignW* nodep, AstNUser*) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
// Add to list of blocks under this scope
|
// Add to list of blocks under this scope
|
||||||
UINFO(4," Move "<<nodep<<endl);
|
UINFO(4," Move "<<nodep<<endl);
|
||||||
AstNode* clonep = nodep->cloneTree(false);
|
AstNode* clonep = nodep->cloneTree(false);
|
||||||
|
|
@ -192,7 +192,7 @@ private:
|
||||||
m_scopep->addActivep(clonep);
|
m_scopep->addActivep(clonep);
|
||||||
clonep->iterateChildren(*this); // We iterate under the *clone*
|
clonep->iterateChildren(*this); // We iterate under the *clone*
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
// Add to list of blocks under this scope
|
// Add to list of blocks under this scope
|
||||||
UINFO(4," Move "<<nodep<<endl);
|
UINFO(4," Move "<<nodep<<endl);
|
||||||
AstNode* clonep = nodep->cloneTree(false);
|
AstNode* clonep = nodep->cloneTree(false);
|
||||||
|
|
@ -200,7 +200,7 @@ private:
|
||||||
m_scopep->addActivep(clonep);
|
m_scopep->addActivep(clonep);
|
||||||
clonep->iterateChildren(*this); // We iterate under the *clone*
|
clonep->iterateChildren(*this); // We iterate under the *clone*
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlwaysPublic* nodep, AstNUser*) {
|
virtual void visit(AstAlwaysPublic* nodep) {
|
||||||
// Add to list of blocks under this scope
|
// Add to list of blocks under this scope
|
||||||
UINFO(4," Move "<<nodep<<endl);
|
UINFO(4," Move "<<nodep<<endl);
|
||||||
AstNode* clonep = nodep->cloneTree(false);
|
AstNode* clonep = nodep->cloneTree(false);
|
||||||
|
|
@ -208,7 +208,7 @@ private:
|
||||||
m_scopep->addActivep(clonep);
|
m_scopep->addActivep(clonep);
|
||||||
clonep->iterateChildren(*this); // We iterate under the *clone*
|
clonep->iterateChildren(*this); // We iterate under the *clone*
|
||||||
}
|
}
|
||||||
virtual void visit(AstCoverToggle* nodep, AstNUser*) {
|
virtual void visit(AstCoverToggle* nodep) {
|
||||||
// Add to list of blocks under this scope
|
// Add to list of blocks under this scope
|
||||||
UINFO(4," Move "<<nodep<<endl);
|
UINFO(4," Move "<<nodep<<endl);
|
||||||
AstNode* clonep = nodep->cloneTree(false);
|
AstNode* clonep = nodep->cloneTree(false);
|
||||||
|
|
@ -216,7 +216,7 @@ private:
|
||||||
m_scopep->addActivep(clonep);
|
m_scopep->addActivep(clonep);
|
||||||
clonep->iterateChildren(*this); // We iterate under the *clone*
|
clonep->iterateChildren(*this); // We iterate under the *clone*
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
// Add to list of blocks under this scope
|
// Add to list of blocks under this scope
|
||||||
UINFO(4," CFUNC "<<nodep<<endl);
|
UINFO(4," CFUNC "<<nodep<<endl);
|
||||||
AstCFunc* clonep = nodep->cloneTree(false);
|
AstCFunc* clonep = nodep->cloneTree(false);
|
||||||
|
|
@ -226,7 +226,7 @@ private:
|
||||||
// We iterate under the *clone*
|
// We iterate under the *clone*
|
||||||
clonep->iterateChildren(*this);
|
clonep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
// Add to list of blocks under this scope
|
// Add to list of blocks under this scope
|
||||||
UINFO(4," FTASK "<<nodep<<endl);
|
UINFO(4," FTASK "<<nodep<<endl);
|
||||||
AstNodeFTask* clonep = nodep->cloneTree(false);
|
AstNodeFTask* clonep = nodep->cloneTree(false);
|
||||||
|
|
@ -235,7 +235,7 @@ private:
|
||||||
// We iterate under the *clone*
|
// We iterate under the *clone*
|
||||||
clonep->iterateChildren(*this);
|
clonep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
// Make new scope variable
|
// Make new scope variable
|
||||||
// This is called cross-module by AstVar, so we cannot trust any m_ variables
|
// This is called cross-module by AstVar, so we cannot trust any m_ variables
|
||||||
if (!nodep->user1p()) {
|
if (!nodep->user1p()) {
|
||||||
|
|
@ -254,7 +254,7 @@ private:
|
||||||
m_scopep->addVarp(varscp);
|
m_scopep->addVarp(varscp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
// VarRef needs to point to VarScope
|
// VarRef needs to point to VarScope
|
||||||
// Make sure variable has made user1p.
|
// Make sure variable has made user1p.
|
||||||
if (!nodep->varp()) nodep->v3fatalSrc("Unlinked");
|
if (!nodep->varp()) nodep->v3fatalSrc("Unlinked");
|
||||||
|
|
@ -267,7 +267,7 @@ private:
|
||||||
m_varRefScopes.insert(make_pair(nodep, m_scopep));
|
m_varRefScopes.insert(make_pair(nodep, m_scopep));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstScopeName* nodep, AstNUser*) {
|
virtual void visit(AstScopeName* nodep) {
|
||||||
// If there's a %m in the display text, we add a special node that will contain the name()
|
// If there's a %m in the display text, we add a special node that will contain the name()
|
||||||
string prefix = (string)("__DOT__")+m_scopep->name();
|
string prefix = (string)("__DOT__")+m_scopep->name();
|
||||||
// TOP and above will be the user's name().
|
// TOP and above will be the user's name().
|
||||||
|
|
@ -283,13 +283,13 @@ private:
|
||||||
if (afterp) nodep->scopeEntrp(afterp);
|
if (afterp) nodep->scopeEntrp(afterp);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
// Scope that was made by this module for different cell;
|
// Scope that was made by this module for different cell;
|
||||||
// Want to ignore blocks under it, so just do nothing
|
// Want to ignore blocks under it, so just do nothing
|
||||||
}
|
}
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default
|
// Default
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -321,7 +321,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
// Want to ignore blocks under it
|
// Want to ignore blocks under it
|
||||||
m_scopep = nodep;
|
m_scopep = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -340,42 +340,42 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstInitial* nodep, AstNUser*) {
|
virtual void visit(AstInitial* nodep) {
|
||||||
movedDeleteOrIterate(nodep);
|
movedDeleteOrIterate(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstFinal* nodep, AstNUser*) {
|
virtual void visit(AstFinal* nodep) {
|
||||||
movedDeleteOrIterate(nodep);
|
movedDeleteOrIterate(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignAlias* nodep, AstNUser*) {
|
virtual void visit(AstAssignAlias* nodep) {
|
||||||
movedDeleteOrIterate(nodep);
|
movedDeleteOrIterate(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignVarScope* nodep, AstNUser*) {
|
virtual void visit(AstAssignVarScope* nodep) {
|
||||||
movedDeleteOrIterate(nodep);
|
movedDeleteOrIterate(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignW* nodep, AstNUser*) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
movedDeleteOrIterate(nodep);
|
movedDeleteOrIterate(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
movedDeleteOrIterate(nodep);
|
movedDeleteOrIterate(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlwaysPublic* nodep, AstNUser*) {
|
virtual void visit(AstAlwaysPublic* nodep) {
|
||||||
movedDeleteOrIterate(nodep);
|
movedDeleteOrIterate(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCoverToggle* nodep, AstNUser*) {
|
virtual void visit(AstCoverToggle* nodep) {
|
||||||
movedDeleteOrIterate(nodep);
|
movedDeleteOrIterate(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
movedDeleteOrIterate(nodep);
|
movedDeleteOrIterate(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
movedDeleteOrIterate(nodep);
|
movedDeleteOrIterate(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstVarXRef* nodep, AstNUser*) {
|
virtual void visit(AstVarXRef* nodep) {
|
||||||
// The crossrefs are dealt with in V3LinkDot
|
// The crossrefs are dealt with in V3LinkDot
|
||||||
nodep->varp(NULL);
|
nodep->varp(NULL);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||||
// The crossrefs are dealt with in V3LinkDot
|
// The crossrefs are dealt with in V3LinkDot
|
||||||
UINFO(9," Old pkg-taskref "<<nodep<<endl);
|
UINFO(9," Old pkg-taskref "<<nodep<<endl);
|
||||||
if (nodep->packagep()) {
|
if (nodep->packagep()) {
|
||||||
|
|
@ -391,7 +391,7 @@ private:
|
||||||
}
|
}
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstModportFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstModportFTaskRef* nodep) {
|
||||||
// The crossrefs are dealt with in V3LinkDot
|
// The crossrefs are dealt with in V3LinkDot
|
||||||
nodep->ftaskp(NULL);
|
nodep->ftaskp(NULL);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -399,7 +399,7 @@ private:
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default
|
// Default
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -62,31 +62,31 @@ private:
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
// Only do the top
|
// Only do the top
|
||||||
if (nodep->isTop()) {
|
if (nodep->isTop()) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstTopScope* nodep, AstNUser*) {
|
virtual void visit(AstTopScope* nodep) {
|
||||||
m_topscopep = nodep;
|
m_topscopep = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Don't clear topscopep, the namer persists beyond this visit
|
// Don't clear topscopep, the namer persists beyond this visit
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
// But no SenTrees under TopScope's scope
|
// But no SenTrees under TopScope's scope
|
||||||
}
|
}
|
||||||
// Memorize existing block names
|
// Memorize existing block names
|
||||||
virtual void visit(AstActive* nodep, AstNUser*) {
|
virtual void visit(AstActive* nodep) {
|
||||||
// Don't grab SenTrees under Actives, only those that are global (under Scope directly)
|
// Don't grab SenTrees under Actives, only those that are global (under Scope directly)
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenTree* nodep, AstNUser*) {
|
virtual void visit(AstSenTree* nodep) {
|
||||||
m_treesp.push_back(nodep);
|
m_treesp.push_back(nodep);
|
||||||
}
|
}
|
||||||
// Empty visitors, speed things up
|
// Empty visitors, speed things up
|
||||||
virtual void visit(AstNodeStmt* nodep, AstNUser*) { }
|
virtual void visit(AstNodeStmt* nodep) { }
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
// METHODS
|
// METHODS
|
||||||
|
|
|
||||||
|
|
@ -244,15 +244,15 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
if (jumpingOver(nodep)) return;
|
if (jumpingOver(nodep)) return;
|
||||||
checkNodeInfo(nodep);
|
checkNodeInfo(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstSenTree* nodep, AstNUser*) {
|
virtual void visit(AstSenTree* nodep) {
|
||||||
// Sensitivities aren't inputs per se; we'll keep our tree under the same sens.
|
// Sensitivities aren't inputs per se; we'll keep our tree under the same sens.
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (jumpingOver(nodep)) return;
|
if (jumpingOver(nodep)) return;
|
||||||
if (!optimizable()) return; // Accelerate
|
if (!optimizable()) return; // Accelerate
|
||||||
nodep->varp()->iterateChildren(*this);
|
nodep->varp()->iterateChildren(*this);
|
||||||
|
|
@ -311,19 +311,19 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarXRef* nodep, AstNUser*) {
|
virtual void visit(AstVarXRef* nodep) {
|
||||||
if (jumpingOver(nodep)) return;
|
if (jumpingOver(nodep)) return;
|
||||||
if (m_scoped) { badNodeType(nodep); return; }
|
if (m_scoped) { badNodeType(nodep); return; }
|
||||||
else { clearOptimizable(nodep,"Language violation: Dotted hierarchical references not allowed in constant functions"); }
|
else { clearOptimizable(nodep,"Language violation: Dotted hierarchical references not allowed in constant functions"); }
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
if (jumpingOver(nodep)) return;
|
if (jumpingOver(nodep)) return;
|
||||||
if (!m_params) { badNodeType(nodep); return; }
|
if (!m_params) { badNodeType(nodep); return; }
|
||||||
if (nodep->dpiImport()) { clearOptimizable(nodep,"DPI import functions aren't simulatable"); }
|
if (nodep->dpiImport()) { clearOptimizable(nodep,"DPI import functions aren't simulatable"); }
|
||||||
checkNodeInfo(nodep);
|
checkNodeInfo(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeIf* nodep, AstNUser*) {
|
virtual void visit(AstNodeIf* nodep) {
|
||||||
if (jumpingOver(nodep)) return;
|
if (jumpingOver(nodep)) return;
|
||||||
UINFO(5," IF "<<nodep<<endl);
|
UINFO(5," IF "<<nodep<<endl);
|
||||||
checkNodeInfo(nodep);
|
checkNodeInfo(nodep);
|
||||||
|
|
@ -340,13 +340,13 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) {
|
virtual void visit(AstConst* nodep) {
|
||||||
checkNodeInfo(nodep);
|
checkNodeInfo(nodep);
|
||||||
if (!m_checkOnly && optimizable()) {
|
if (!m_checkOnly && optimizable()) {
|
||||||
setNumber(nodep, &(nodep->num()));
|
setNumber(nodep, &(nodep->num()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstEnumItemRef* nodep, AstNUser*) {
|
virtual void visit(AstEnumItemRef* nodep) {
|
||||||
checkNodeInfo(nodep);
|
checkNodeInfo(nodep);
|
||||||
if (!nodep->itemp()) nodep->v3fatalSrc("Not linked");
|
if (!nodep->itemp()) nodep->v3fatalSrc("Not linked");
|
||||||
if (!m_checkOnly && optimizable()) {
|
if (!m_checkOnly && optimizable()) {
|
||||||
|
|
@ -359,7 +359,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeUniop* nodep, AstNUser*) {
|
virtual void visit(AstNodeUniop* nodep) {
|
||||||
if (!optimizable()) return; // Accelerate
|
if (!optimizable()) return; // Accelerate
|
||||||
checkNodeInfo(nodep);
|
checkNodeInfo(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -367,7 +367,7 @@ private:
|
||||||
nodep->numberOperate(*newNumber(nodep), *fetchNumber(nodep->lhsp()));
|
nodep->numberOperate(*newNumber(nodep), *fetchNumber(nodep->lhsp()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeBiop* nodep, AstNUser*) {
|
virtual void visit(AstNodeBiop* nodep) {
|
||||||
if (!optimizable()) return; // Accelerate
|
if (!optimizable()) return; // Accelerate
|
||||||
checkNodeInfo(nodep);
|
checkNodeInfo(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -375,7 +375,7 @@ private:
|
||||||
nodep->numberOperate(*newNumber(nodep), *fetchNumber(nodep->lhsp()), *fetchNumber(nodep->rhsp()));
|
nodep->numberOperate(*newNumber(nodep), *fetchNumber(nodep->lhsp()), *fetchNumber(nodep->rhsp()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeTriop* nodep, AstNUser*) {
|
virtual void visit(AstNodeTriop* nodep) {
|
||||||
if (!optimizable()) return; // Accelerate
|
if (!optimizable()) return; // Accelerate
|
||||||
checkNodeInfo(nodep);
|
checkNodeInfo(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -386,7 +386,7 @@ private:
|
||||||
*fetchNumber(nodep->thsp()));
|
*fetchNumber(nodep->thsp()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstLogAnd* nodep, AstNUser*) {
|
virtual void visit(AstLogAnd* nodep) {
|
||||||
// Need to short circuit
|
// Need to short circuit
|
||||||
if (!optimizable()) return; // Accelerate
|
if (!optimizable()) return; // Accelerate
|
||||||
checkNodeInfo(nodep);
|
checkNodeInfo(nodep);
|
||||||
|
|
@ -402,7 +402,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstLogOr* nodep, AstNUser*) {
|
virtual void visit(AstLogOr* nodep) {
|
||||||
// Need to short circuit
|
// Need to short circuit
|
||||||
if (!optimizable()) return; // Accelerate
|
if (!optimizable()) return; // Accelerate
|
||||||
checkNodeInfo(nodep);
|
checkNodeInfo(nodep);
|
||||||
|
|
@ -418,7 +418,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstLogIf* nodep, AstNUser*) {
|
virtual void visit(AstLogIf* nodep) {
|
||||||
// Need to short circuit, same as (!A || B)
|
// Need to short circuit, same as (!A || B)
|
||||||
if (!optimizable()) return; // Accelerate
|
if (!optimizable()) return; // Accelerate
|
||||||
checkNodeInfo(nodep);
|
checkNodeInfo(nodep);
|
||||||
|
|
@ -434,7 +434,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeCond* nodep, AstNUser*) {
|
virtual void visit(AstNodeCond* nodep) {
|
||||||
// We could use above visit(AstNodeTriop), but need to do short circuiting.
|
// We could use above visit(AstNodeTriop), but need to do short circuiting.
|
||||||
// It's also slower even O(n^2) to evaluate both sides when we really only need to evaluate one side.
|
// It's also slower even O(n^2) to evaluate both sides when we really only need to evaluate one side.
|
||||||
if (!optimizable()) return; // Accelerate
|
if (!optimizable()) return; // Accelerate
|
||||||
|
|
@ -501,7 +501,7 @@ private:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
if (jumpingOver(nodep)) return;
|
if (jumpingOver(nodep)) return;
|
||||||
if (!optimizable()) return; // Accelerate
|
if (!optimizable()) return; // Accelerate
|
||||||
if (nodep->castAssignDly()) {
|
if (nodep->castAssignDly()) {
|
||||||
|
|
@ -532,11 +532,11 @@ private:
|
||||||
}
|
}
|
||||||
m_inDlyAssign = false;
|
m_inDlyAssign = false;
|
||||||
}
|
}
|
||||||
virtual void visit(AstBegin* nodep, AstNUser*) {
|
virtual void visit(AstBegin* nodep) {
|
||||||
checkNodeInfo(nodep);
|
checkNodeInfo(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeCase* nodep, AstNUser*) {
|
virtual void visit(AstNodeCase* nodep) {
|
||||||
if (jumpingOver(nodep)) return;
|
if (jumpingOver(nodep)) return;
|
||||||
UINFO(5," CASE "<<nodep<<endl);
|
UINFO(5," CASE "<<nodep<<endl);
|
||||||
checkNodeInfo(nodep);
|
checkNodeInfo(nodep);
|
||||||
|
|
@ -572,16 +572,16 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstCaseItem* nodep, AstNUser*) {
|
virtual void visit(AstCaseItem* nodep) {
|
||||||
// Real handling is in AstNodeCase
|
// Real handling is in AstNodeCase
|
||||||
if (jumpingOver(nodep)) return;
|
if (jumpingOver(nodep)) return;
|
||||||
checkNodeInfo(nodep);
|
checkNodeInfo(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstComment*, AstNUser*) {}
|
virtual void visit(AstComment*) {}
|
||||||
|
|
||||||
virtual void visit(AstJumpGo* nodep, AstNUser*) {
|
virtual void visit(AstJumpGo* nodep) {
|
||||||
if (jumpingOver(nodep)) return;
|
if (jumpingOver(nodep)) return;
|
||||||
checkNodeInfo(nodep);
|
checkNodeInfo(nodep);
|
||||||
if (!m_checkOnly) {
|
if (!m_checkOnly) {
|
||||||
|
|
@ -589,7 +589,7 @@ private:
|
||||||
m_jumpp = nodep;
|
m_jumpp = nodep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstJumpLabel* nodep, AstNUser*) {
|
virtual void visit(AstJumpLabel* nodep) {
|
||||||
if (jumpingOver(nodep)) return;
|
if (jumpingOver(nodep)) return;
|
||||||
checkNodeInfo(nodep);
|
checkNodeInfo(nodep);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -598,7 +598,7 @@ private:
|
||||||
m_jumpp = NULL;
|
m_jumpp = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstStop* nodep, AstNUser*) {
|
virtual void visit(AstStop* nodep) {
|
||||||
if (jumpingOver(nodep)) return;
|
if (jumpingOver(nodep)) return;
|
||||||
if (m_params) { // This message seems better than an obscure $stop
|
if (m_params) { // This message seems better than an obscure $stop
|
||||||
// The spec says $stop is just ignored, it seems evil to ignore assertions
|
// The spec says $stop is just ignored, it seems evil to ignore assertions
|
||||||
|
|
@ -607,7 +607,7 @@ private:
|
||||||
checkNodeInfo(nodep);
|
checkNodeInfo(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeFor* nodep, AstNUser*) {
|
virtual void visit(AstNodeFor* nodep) {
|
||||||
// Doing lots of Whiles is slow, so only for parameters
|
// Doing lots of Whiles is slow, so only for parameters
|
||||||
UINFO(5," FOR "<<nodep<<endl);
|
UINFO(5," FOR "<<nodep<<endl);
|
||||||
if (!m_params) { badNodeType(nodep); return; }
|
if (!m_params) { badNodeType(nodep); return; }
|
||||||
|
|
@ -634,7 +634,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstWhile* nodep, AstNUser*) {
|
virtual void visit(AstWhile* nodep) {
|
||||||
// Doing lots of Whiles is slow, so only for parameters
|
// Doing lots of Whiles is slow, so only for parameters
|
||||||
if (jumpingOver(nodep)) return;
|
if (jumpingOver(nodep)) return;
|
||||||
UINFO(5," WHILE "<<nodep<<endl);
|
UINFO(5," WHILE "<<nodep<<endl);
|
||||||
|
|
@ -668,7 +668,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstFuncRef* nodep, AstNUser*) {
|
virtual void visit(AstFuncRef* nodep) {
|
||||||
if (jumpingOver(nodep)) return;
|
if (jumpingOver(nodep)) return;
|
||||||
UINFO(5," FUNCREF "<<nodep<<endl);
|
UINFO(5," FUNCREF "<<nodep<<endl);
|
||||||
if (!m_params) { badNodeType(nodep); return; }
|
if (!m_params) { badNodeType(nodep); return; }
|
||||||
|
|
@ -710,12 +710,12 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
if (jumpingOver(nodep)) return;
|
if (jumpingOver(nodep)) return;
|
||||||
if (!m_params) { badNodeType(nodep); return; }
|
if (!m_params) { badNodeType(nodep); return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstSFormatF *nodep, AstNUser*) {
|
virtual void visit(AstSFormatF *nodep) {
|
||||||
if (jumpingOver(nodep)) return;
|
if (jumpingOver(nodep)) return;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_params) {
|
if (m_params) {
|
||||||
|
|
@ -759,7 +759,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstDisplay *nodep, AstNUser*) {
|
virtual void visit(AstDisplay *nodep) {
|
||||||
if (jumpingOver(nodep)) return;
|
if (jumpingOver(nodep)) return;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_params) {
|
if (m_params) {
|
||||||
|
|
@ -788,7 +788,7 @@ private:
|
||||||
// These types are definately not reducable
|
// These types are definately not reducable
|
||||||
// AstCoverInc, AstArraySel, AstFinish,
|
// AstCoverInc, AstArraySel, AstFinish,
|
||||||
// AstRand, AstTime, AstUCFunc, AstCCall, AstCStmt, AstUCStmt
|
// AstRand, AstTime, AstUCFunc, AstCCall, AstCStmt, AstUCStmt
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
if (jumpingOver(nodep)) return;
|
if (jumpingOver(nodep)) return;
|
||||||
badNodeType(nodep);
|
badNodeType(nodep);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ class SliceCloneVisitor : public AstNVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstArraySel* nodep, AstNUser*) {
|
virtual void visit(AstArraySel* nodep) {
|
||||||
if (!nodep->backp()->castArraySel()) {
|
if (!nodep->backp()->castArraySel()) {
|
||||||
// This is the top of an ArraySel, setup for iteration
|
// This is the top of an ArraySel, setup for iteration
|
||||||
m_refp = nodep->user1p()->castNode()->castVarRef();
|
m_refp = nodep->user1p()->castNode()->castVarRef();
|
||||||
|
|
@ -118,7 +118,7 @@ class SliceCloneVisitor : public AstNVisitor {
|
||||||
nodep->length(1);
|
nodep->length(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
if (nodep->user2() < 2) return; // Don't need clones
|
if (nodep->user2() < 2) return; // Don't need clones
|
||||||
m_selBits.clear();
|
m_selBits.clear();
|
||||||
UINFO(4, "Cloning "<<nodep->user2()<<" times: "<<nodep<<endl);
|
UINFO(4, "Cloning "<<nodep->user2()<<" times: "<<nodep<<endl);
|
||||||
|
|
@ -168,20 +168,20 @@ class SliceCloneVisitor : public AstNVisitor {
|
||||||
nodep->replaceWith(lhsp);
|
nodep->replaceWith(lhsp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstRedOr* nodep, AstNUser*) {
|
virtual void visit(AstRedOr* nodep) {
|
||||||
cloneUniop(nodep);
|
cloneUniop(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstRedAnd* nodep, AstNUser*) {
|
virtual void visit(AstRedAnd* nodep) {
|
||||||
cloneUniop(nodep);
|
cloneUniop(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstRedXor* nodep, AstNUser*) {
|
virtual void visit(AstRedXor* nodep) {
|
||||||
cloneUniop(nodep);
|
cloneUniop(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstRedXnor* nodep, AstNUser*) {
|
virtual void visit(AstRedXnor* nodep) {
|
||||||
cloneUniop(nodep);
|
cloneUniop(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
@ -289,7 +289,7 @@ class SliceVisitor : public AstNVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
// The LHS/RHS of an Assign may be to a Var that is an array. In this
|
// The LHS/RHS of an Assign may be to a Var that is an array. In this
|
||||||
// case we need to create a slice across the entire Var
|
// case we need to create a slice across the entire Var
|
||||||
if (m_assignp && !nodep->backp()->castArraySel()) {
|
if (m_assignp && !nodep->backp()->castArraySel()) {
|
||||||
|
|
@ -305,7 +305,7 @@ class SliceVisitor : public AstNVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstExtend* nodep, AstNUser*) {
|
virtual void visit(AstExtend* nodep) {
|
||||||
m_extend = true;
|
m_extend = true;
|
||||||
if (m_assignp && m_assignp->user2() > 1 && !m_assignError) {
|
if (m_assignp && m_assignp->user2() > 1 && !m_assignError) {
|
||||||
m_assignp->v3error("Unsupported: Assignment between unpacked arrays of different dimensions");
|
m_assignp->v3error("Unsupported: Assignment between unpacked arrays of different dimensions");
|
||||||
|
|
@ -314,7 +314,7 @@ class SliceVisitor : public AstNVisitor {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) {
|
virtual void visit(AstConst* nodep) {
|
||||||
m_extend = true;
|
m_extend = true;
|
||||||
if (m_assignp && m_assignp->user2() > 1 && !m_assignError) {
|
if (m_assignp && m_assignp->user2() > 1 && !m_assignError) {
|
||||||
m_assignp->v3error("Unsupported: Assignment between a constant and an array slice");
|
m_assignp->v3error("Unsupported: Assignment between a constant and an array slice");
|
||||||
|
|
@ -322,7 +322,7 @@ class SliceVisitor : public AstNVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstArraySel* nodep, AstNUser*) {
|
virtual void visit(AstArraySel* nodep) {
|
||||||
if (!m_assignp) return;
|
if (!m_assignp) return;
|
||||||
if (nodep->user3()) return; // Prevent recursion on just created nodes
|
if (nodep->user3()) return; // Prevent recursion on just created nodes
|
||||||
unsigned dim = explicitDimensions(nodep);
|
unsigned dim = explicitDimensions(nodep);
|
||||||
|
|
@ -352,7 +352,7 @@ class SliceVisitor : public AstNVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstSel* nodep, AstNUser*) {
|
virtual void visit(AstSel* nodep) {
|
||||||
m_extend = true;
|
m_extend = true;
|
||||||
if (m_assignp && m_assignp->user2() > 1 && !m_assignError) {
|
if (m_assignp && m_assignp->user2() > 1 && !m_assignError) {
|
||||||
m_assignp->v3error("Unsupported: Assignment between unpacked arrays of different dimensions");
|
m_assignp->v3error("Unsupported: Assignment between unpacked arrays of different dimensions");
|
||||||
|
|
@ -361,7 +361,7 @@ class SliceVisitor : public AstNVisitor {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeCond* nodep, AstNUser*) {
|
virtual void visit(AstNodeCond* nodep) {
|
||||||
// The conditional must be a single bit so only look at the expressions
|
// The conditional must be a single bit so only look at the expressions
|
||||||
nodep->expr1p()->accept(*this);
|
nodep->expr1p()->accept(*this);
|
||||||
nodep->expr2p()->accept(*this);
|
nodep->expr2p()->accept(*this);
|
||||||
|
|
@ -412,7 +412,7 @@ class SliceVisitor : public AstNVisitor {
|
||||||
m_assignp = NULL;
|
m_assignp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
if (!nodep->user1()) {
|
if (!nodep->user1()) {
|
||||||
// Cleanup initArrays
|
// Cleanup initArrays
|
||||||
if (AstInitArray* initp = nodep->rhsp()->castInitArray()) {
|
if (AstInitArray* initp = nodep->rhsp()->castInitArray()) {
|
||||||
|
|
@ -458,16 +458,16 @@ class SliceVisitor : public AstNVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstRedOr* nodep, AstNUser*) {
|
virtual void visit(AstRedOr* nodep) {
|
||||||
expandUniOp(nodep);
|
expandUniOp(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstRedAnd* nodep, AstNUser*) {
|
virtual void visit(AstRedAnd* nodep) {
|
||||||
expandUniOp(nodep);
|
expandUniOp(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstRedXor* nodep, AstNUser*) {
|
virtual void visit(AstRedXor* nodep) {
|
||||||
expandUniOp(nodep);
|
expandUniOp(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstRedXnor* nodep, AstNUser*) {
|
virtual void visit(AstRedXnor* nodep) {
|
||||||
expandUniOp(nodep);
|
expandUniOp(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -514,20 +514,20 @@ class SliceVisitor : public AstNVisitor {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstEq* nodep, AstNUser*) {
|
virtual void visit(AstEq* nodep) {
|
||||||
expandBiOp(nodep);
|
expandBiOp(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNeq* nodep, AstNUser*) {
|
virtual void visit(AstNeq* nodep) {
|
||||||
expandBiOp(nodep);
|
expandBiOp(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstEqCase* nodep, AstNUser*) {
|
virtual void visit(AstEqCase* nodep) {
|
||||||
expandBiOp(nodep);
|
expandBiOp(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNeqCase* nodep, AstNUser*) {
|
virtual void visit(AstNeqCase* nodep) {
|
||||||
expandBiOp(nodep);
|
expandBiOp(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -465,14 +465,14 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
UINFO(4," ALW "<<nodep<<endl);
|
UINFO(4," ALW "<<nodep<<endl);
|
||||||
if (debug()>=9) nodep->dumpTree(cout," alwIn:: ");
|
if (debug()>=9) nodep->dumpTree(cout," alwIn:: ");
|
||||||
scoreboardClear();
|
scoreboardClear();
|
||||||
processBlock(nodep->bodysp());
|
processBlock(nodep->bodysp());
|
||||||
if (debug()>=9) nodep->dumpTree(cout," alwOut: ");
|
if (debug()>=9) nodep->dumpTree(cout," alwOut: ");
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeIf* nodep, AstNUser*) {
|
virtual void visit(AstNodeIf* nodep) {
|
||||||
if (!m_reorder) {
|
if (!m_reorder) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -485,13 +485,13 @@ private:
|
||||||
// We don't do AstNodeFor/AstWhile loops, due to the standard question
|
// We don't do AstNodeFor/AstWhile loops, due to the standard question
|
||||||
// of what is before vs. after
|
// of what is before vs. after
|
||||||
|
|
||||||
virtual void visit(AstAssignDly* nodep, AstNUser*) {
|
virtual void visit(AstAssignDly* nodep) {
|
||||||
m_inDly = true;
|
m_inDly = true;
|
||||||
UINFO(4," ASSIGNDLY "<<nodep<<endl);
|
UINFO(4," ASSIGNDLY "<<nodep<<endl);
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_inDly = false;
|
m_inDly = false;
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (!m_stmtStackps.empty()) {
|
if (!m_stmtStackps.empty()) {
|
||||||
AstVarScope* vscp = nodep->varScopep();
|
AstVarScope* vscp = nodep->varScopep();
|
||||||
if (!vscp) nodep->v3fatalSrc("Not linked");
|
if (!vscp) nodep->v3fatalSrc("Not linked");
|
||||||
|
|
@ -539,7 +539,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstJumpGo* nodep, AstNUser*) {
|
virtual void visit(AstJumpGo* nodep) {
|
||||||
// Jumps will disable reordering at all levels
|
// Jumps will disable reordering at all levels
|
||||||
// This is overly pessimistic; we could treat jumps as barriers, and
|
// This is overly pessimistic; we could treat jumps as barriers, and
|
||||||
// reorder everything between jumps/labels, however jumps are rare
|
// reorder everything between jumps/labels, however jumps are rare
|
||||||
|
|
@ -551,7 +551,7 @@ private:
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default
|
// Default
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// **** SPECIAL default type that sets PLI_ORDERING
|
// **** SPECIAL default type that sets PLI_ORDERING
|
||||||
if (!m_stmtStackps.empty() && !nodep->isPure()) {
|
if (!m_stmtStackps.empty() && !nodep->isPure()) {
|
||||||
UINFO(9," NotSplittable "<<nodep<<endl);
|
UINFO(9," NotSplittable "<<nodep<<endl);
|
||||||
|
|
|
||||||
|
|
@ -60,13 +60,13 @@ private:
|
||||||
AstVarScope* m_splitVscp; // Variable we want to split
|
AstVarScope* m_splitVscp; // Variable we want to split
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (nodep->lvalue() && !m_splitVscp
|
if (nodep->lvalue() && !m_splitVscp
|
||||||
&& nodep->varp()->attrIsolateAssign()) {
|
&& nodep->varp()->attrIsolateAssign()) {
|
||||||
m_splitVscp = nodep->varScopep();
|
m_splitVscp = nodep->varScopep();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -92,7 +92,7 @@ private:
|
||||||
bool m_matches; // Statement below has matching lvalue reference
|
bool m_matches; // Statement below has matching lvalue reference
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (nodep->lvalue()) {
|
if (nodep->lvalue()) {
|
||||||
if (nodep->varScopep()==m_splitVscp) {
|
if (nodep->varScopep()==m_splitVscp) {
|
||||||
UINFO(6," CL VAR "<<nodep<<endl);
|
UINFO(6," CL VAR "<<nodep<<endl);
|
||||||
|
|
@ -100,7 +100,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeStmt* nodep, AstNUser*) {
|
virtual void visit(AstNodeStmt* nodep) {
|
||||||
UINFO(6," CL STMT "<<nodep<<endl);
|
UINFO(6," CL STMT "<<nodep<<endl);
|
||||||
bool oldKeep = m_keepStmt;
|
bool oldKeep = m_keepStmt;
|
||||||
{
|
{
|
||||||
|
|
@ -122,7 +122,7 @@ private:
|
||||||
m_keepStmt = oldKeep || m_keepStmt;
|
m_keepStmt = oldKeep || m_keepStmt;
|
||||||
UINFO(9," upKeep="<<m_keepStmt<<" STMT "<<nodep<<endl);
|
UINFO(9," upKeep="<<m_keepStmt<<" STMT "<<nodep<<endl);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -167,7 +167,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
// Are there any lvalue references below this?
|
// Are there any lvalue references below this?
|
||||||
// There could be more than one. So, we process the first one found first.
|
// There could be more than one. So, we process the first one found first.
|
||||||
AstVarScope* lastSplitVscp = NULL;
|
AstVarScope* lastSplitVscp = NULL;
|
||||||
|
|
@ -192,9 +192,9 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Speedup; no always under math
|
// Speedup; no always under math
|
||||||
virtual void visit(AstNodeMath* nodep, AstNUser*) {}
|
virtual void visit(AstNodeMath* nodep) {}
|
||||||
|
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
allNodes(nodep);
|
allNodes(nodep);
|
||||||
if (!m_fast) {
|
if (!m_fast) {
|
||||||
nodep->iterateChildrenConst(*this);
|
nodep->iterateChildrenConst(*this);
|
||||||
|
|
@ -95,7 +95,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
allNodes(nodep);
|
allNodes(nodep);
|
||||||
nodep->iterateChildrenConst(*this);
|
nodep->iterateChildrenConst(*this);
|
||||||
if (m_counting && nodep->dtypep()) {
|
if (m_counting && nodep->dtypep()) {
|
||||||
|
|
@ -118,7 +118,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarScope* nodep, AstNUser*) {
|
virtual void visit(AstVarScope* nodep) {
|
||||||
allNodes(nodep);
|
allNodes(nodep);
|
||||||
nodep->iterateChildrenConst(*this);
|
nodep->iterateChildrenConst(*this);
|
||||||
if (m_counting) {
|
if (m_counting) {
|
||||||
|
|
@ -127,7 +127,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeIf* nodep, AstNUser*) {
|
virtual void visit(AstNodeIf* nodep) {
|
||||||
UINFO(4," IF "<<nodep<<endl);
|
UINFO(4," IF "<<nodep<<endl);
|
||||||
allNodes(nodep);
|
allNodes(nodep);
|
||||||
// Condition is part of PREVIOUS block
|
// Condition is part of PREVIOUS block
|
||||||
|
|
@ -175,9 +175,9 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// While's we assume evaluate once.
|
// While's we assume evaluate once.
|
||||||
//virtual void visit(AstWhile* nodep, AstNUser*) {
|
//virtual void visit(AstWhile* nodep) {
|
||||||
|
|
||||||
virtual void visit(AstCCall* nodep, AstNUser*) {
|
virtual void visit(AstCCall* nodep) {
|
||||||
//UINFO(4," CCALL "<<nodep<<endl);
|
//UINFO(4," CCALL "<<nodep<<endl);
|
||||||
allNodes(nodep);
|
allNodes(nodep);
|
||||||
nodep->iterateChildrenConst(*this);
|
nodep->iterateChildrenConst(*this);
|
||||||
|
|
@ -186,13 +186,13 @@ private:
|
||||||
nodep->funcp()->accept(*this);
|
nodep->funcp()->accept(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
m_cfuncp = nodep;
|
m_cfuncp = nodep;
|
||||||
allNodes(nodep);
|
allNodes(nodep);
|
||||||
nodep->iterateChildrenConst(*this);
|
nodep->iterateChildrenConst(*this);
|
||||||
m_cfuncp = NULL;
|
m_cfuncp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
allNodes(nodep);
|
allNodes(nodep);
|
||||||
nodep->iterateChildrenConst(*this);
|
nodep->iterateChildrenConst(*this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,7 @@ private:
|
||||||
return (SubstVarEntry*)(nodep->varp()->user1p()); // Might be NULL
|
return (SubstVarEntry*)(nodep->varp()->user1p()); // Might be NULL
|
||||||
}
|
}
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
SubstVarEntry* entryp = findEntryp (nodep);
|
SubstVarEntry* entryp = findEntryp (nodep);
|
||||||
if (entryp) {
|
if (entryp) {
|
||||||
// Don't sweat it. We assign a new temp variable for every new assignment,
|
// Don't sweat it. We assign a new temp variable for every new assignment,
|
||||||
|
|
@ -208,8 +208,8 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) {} // Accelerate
|
virtual void visit(AstConst* nodep) {} // Accelerate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -263,7 +263,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
m_ops = 0;
|
m_ops = 0;
|
||||||
m_assignStep++;
|
m_assignStep++;
|
||||||
nodep->rhsp()->iterateAndNext(*this);
|
nodep->rhsp()->iterateAndNext(*this);
|
||||||
|
|
@ -313,7 +313,7 @@ private:
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
++m_statSubsts;
|
++m_statSubsts;
|
||||||
}
|
}
|
||||||
virtual void visit(AstWordSel* nodep, AstNUser*) {
|
virtual void visit(AstWordSel* nodep) {
|
||||||
nodep->rhsp()->accept(*this);
|
nodep->rhsp()->accept(*this);
|
||||||
AstVarRef* varrefp = nodep->lhsp()->castVarRef();
|
AstVarRef* varrefp = nodep->lhsp()->castVarRef();
|
||||||
AstConst* constp = nodep->rhsp()->castConst();
|
AstConst* constp = nodep->rhsp()->castConst();
|
||||||
|
|
@ -340,7 +340,7 @@ private:
|
||||||
nodep->lhsp()->accept(*this);
|
nodep->lhsp()->accept(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
// Any variable
|
// Any variable
|
||||||
if (nodep->lvalue()) {
|
if (nodep->lvalue()) {
|
||||||
m_assignStep++;
|
m_assignStep++;
|
||||||
|
|
@ -368,9 +368,9 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {}
|
virtual void visit(AstVar* nodep) {}
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) {}
|
virtual void visit(AstConst* nodep) {}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
m_ops++;
|
m_ops++;
|
||||||
if (!nodep->isSubstOptimizable()) {
|
if (!nodep->isSubstOptimizable()) {
|
||||||
m_ops = SUBST_MAX_OPS_NA;
|
m_ops = SUBST_MAX_OPS_NA;
|
||||||
|
|
|
||||||
|
|
@ -402,37 +402,37 @@ private:
|
||||||
|
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
m_modTables = 0;
|
m_modTables = 0;
|
||||||
m_modTableVscs.clear();
|
m_modTableVscs.clear();
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
UINFO(4," SCOPE "<<nodep<<endl);
|
UINFO(4," SCOPE "<<nodep<<endl);
|
||||||
m_scopep = nodep;
|
m_scopep = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_scopep = NULL;
|
m_scopep = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
UINFO(4," ALWAYS "<<nodep<<endl);
|
UINFO(4," ALWAYS "<<nodep<<endl);
|
||||||
if (treeTest(nodep)) {
|
if (treeTest(nodep)) {
|
||||||
// Well, then, I'll be a memory hog.
|
// Well, then, I'll be a memory hog.
|
||||||
createTable(nodep); VL_DANGLING(nodep);
|
createTable(nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignAlias* nodep, AstNUser*) {}
|
virtual void visit(AstAssignAlias* nodep) {}
|
||||||
virtual void visit(AstAssignW* nodep, AstNUser*) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
// It's nearly impossible to have a large enough assign to make this worthwhile
|
// It's nearly impossible to have a large enough assign to make this worthwhile
|
||||||
// For now we won't bother.
|
// For now we won't bother.
|
||||||
// Accelerated: no iterate
|
// Accelerated: no iterate
|
||||||
}
|
}
|
||||||
// default
|
// default
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
// Each FTask is unique per-scope, so AstNodeFTaskRefs do not need
|
// Each FTask is unique per-scope, so AstNodeFTaskRefs do not need
|
||||||
// pointers to what scope the FTask is to be invoked under.
|
// pointers to what scope the FTask is to be invoked under.
|
||||||
// However, to create variables, we need to track the scopes involved.
|
// However, to create variables, we need to track the scopes involved.
|
||||||
|
|
@ -180,12 +180,12 @@ private:
|
||||||
}
|
}
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignW* nodep, AstNUser*) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
m_assignwp = nodep;
|
m_assignwp = nodep;
|
||||||
nodep->iterateChildren(*this); VL_DANGLING(nodep); // May delete nodep.
|
nodep->iterateChildren(*this); VL_DANGLING(nodep); // May delete nodep.
|
||||||
m_assignwp = NULL;
|
m_assignwp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||||
if (m_assignwp) {
|
if (m_assignwp) {
|
||||||
// Wire assigns must become always statements to deal with insertion
|
// Wire assigns must become always statements to deal with insertion
|
||||||
// of multiple statements. Perhaps someday make all wassigns into always's?
|
// of multiple statements. Perhaps someday make all wassigns into always's?
|
||||||
|
|
@ -196,7 +196,7 @@ private:
|
||||||
if (!nodep->taskp()) nodep->v3fatalSrc("Unlinked task");
|
if (!nodep->taskp()) nodep->v3fatalSrc("Unlinked task");
|
||||||
new TaskEdge (&m_callGraph, m_curVxp, getFTaskVertex(nodep->taskp()));
|
new TaskEdge (&m_callGraph, m_curVxp, getFTaskVertex(nodep->taskp()));
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
UINFO(9," TASK "<<nodep<<endl);
|
UINFO(9," TASK "<<nodep<<endl);
|
||||||
TaskBaseVertex* lastVxp = m_curVxp;
|
TaskBaseVertex* lastVxp = m_curVxp;
|
||||||
m_curVxp = getFTaskVertex(nodep);
|
m_curVxp = getFTaskVertex(nodep);
|
||||||
|
|
@ -204,7 +204,7 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_curVxp = lastVxp;
|
m_curVxp = lastVxp;
|
||||||
}
|
}
|
||||||
virtual void visit(AstPragma* nodep, AstNUser*) {
|
virtual void visit(AstPragma* nodep) {
|
||||||
if (nodep->pragType() == AstPragmaType::NO_INLINE_TASK) {
|
if (nodep->pragType() == AstPragmaType::NO_INLINE_TASK) {
|
||||||
// Just mark for the next steps, and we're done with it.
|
// Just mark for the next steps, and we're done with it.
|
||||||
m_curVxp->noInline(true);
|
m_curVxp->noInline(true);
|
||||||
|
|
@ -214,11 +214,11 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
nodep->user4p(m_curVxp); // Remember what task it's under
|
nodep->user4p(m_curVxp); // Remember what task it's under
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (nodep->varp()->user4p() != m_curVxp) {
|
if (nodep->varp()->user4p() != m_curVxp) {
|
||||||
if (m_curVxp->pure()
|
if (m_curVxp->pure()
|
||||||
|
|
@ -229,7 +229,7 @@ private:
|
||||||
}
|
}
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -258,7 +258,7 @@ private:
|
||||||
// AstVar::user2p // AstVarScope* to replace varref with
|
// AstVar::user2p // AstVarScope* to replace varref with
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
// Similar code in V3Inline
|
// Similar code in V3Inline
|
||||||
if (nodep->varp()->user2p()) { // It's being converted to a alias.
|
if (nodep->varp()->user2p()) { // It's being converted to a alias.
|
||||||
UINFO(9, " relinkVar "<<(void*)nodep->varp()->user2p()<<" "<<nodep<<endl);
|
UINFO(9, " relinkVar "<<(void*)nodep->varp()->user2p()<<" "<<nodep<<endl);
|
||||||
|
|
@ -272,7 +272,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -1021,24 +1021,24 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
m_insStmtp = NULL;
|
m_insStmtp = NULL;
|
||||||
m_modNCalls = 0;
|
m_modNCalls = 0;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstTopScope* nodep, AstNUser*) {
|
virtual void visit(AstTopScope* nodep) {
|
||||||
m_topScopep = nodep;
|
m_topScopep = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstScope* nodep, AstNUser*) {
|
virtual void visit(AstScope* nodep) {
|
||||||
m_scopep = nodep;
|
m_scopep = nodep;
|
||||||
m_insStmtp = NULL;
|
m_insStmtp = NULL;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_scopep = NULL;
|
m_scopep = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||||
if (!nodep->taskp()) nodep->v3fatalSrc("Unlinked?");
|
if (!nodep->taskp()) nodep->v3fatalSrc("Unlinked?");
|
||||||
iterateIntoFTask(nodep->taskp()); // First, do hierarchical funcs
|
iterateIntoFTask(nodep->taskp()); // First, do hierarchical funcs
|
||||||
UINFO(4," FTask REF "<<nodep<<endl);
|
UINFO(4," FTask REF "<<nodep<<endl);
|
||||||
|
|
@ -1077,7 +1077,7 @@ private:
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->deleteTree(); VL_DANGLING(nodep);
|
||||||
UINFO(4," FTask REF Done.\n");
|
UINFO(4," FTask REF Done.\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
UINFO(4," Inline "<<nodep<<endl);
|
UINFO(4," Inline "<<nodep<<endl);
|
||||||
InsertMode prevInsMode = m_insMode;
|
InsertMode prevInsMode = m_insMode;
|
||||||
AstNode* prevInsStmtp = m_insStmtp;
|
AstNode* prevInsStmtp = m_insStmtp;
|
||||||
|
|
@ -1130,7 +1130,7 @@ private:
|
||||||
m_insMode = prevInsMode;
|
m_insMode = prevInsMode;
|
||||||
m_insStmtp = prevInsStmtp;
|
m_insStmtp = prevInsStmtp;
|
||||||
}
|
}
|
||||||
virtual void visit(AstWhile* nodep, AstNUser*) {
|
virtual void visit(AstWhile* nodep) {
|
||||||
// Special, as statements need to be put in different places
|
// Special, as statements need to be put in different places
|
||||||
// Preconditions insert first just before themselves (the normal rule for other statement types)
|
// Preconditions insert first just before themselves (the normal rule for other statement types)
|
||||||
m_insStmtp = NULL; // First thing should be new statement
|
m_insStmtp = NULL; // First thing should be new statement
|
||||||
|
|
@ -1146,10 +1146,10 @@ private:
|
||||||
// Done the loop
|
// Done the loop
|
||||||
m_insStmtp = NULL; // Next thing should be new statement
|
m_insStmtp = NULL; // Next thing should be new statement
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFor* nodep, AstNUser*) {
|
virtual void visit(AstNodeFor* nodep) {
|
||||||
nodep->v3fatalSrc("For statements should have been converted to while statements in V3Begin.cpp\n");
|
nodep->v3fatalSrc("For statements should have been converted to while statements in V3Begin.cpp\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeStmt* nodep, AstNUser*) {
|
virtual void visit(AstNodeStmt* nodep) {
|
||||||
m_insMode = IM_BEFORE;
|
m_insMode = IM_BEFORE;
|
||||||
m_insStmtp = nodep;
|
m_insStmtp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -1157,7 +1157,7 @@ private:
|
||||||
}
|
}
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -557,7 +557,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
m_code = 1; // Multiple TopScopes will require fixing how code#s
|
m_code = 1; // Multiple TopScopes will require fixing how code#s
|
||||||
// are assigned as duplicate varscopes must result in the same tracing code#.
|
// are assigned as duplicate varscopes must result in the same tracing code#.
|
||||||
|
|
||||||
|
|
@ -585,17 +585,17 @@ private:
|
||||||
assignActivity();
|
assignActivity();
|
||||||
putTracesIntoTree();
|
putTracesIntoTree();
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
if (nodep->isTop()) m_topModp = nodep;
|
if (nodep->isTop()) m_topModp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstTopScope* nodep, AstNUser*) {
|
virtual void visit(AstTopScope* nodep) {
|
||||||
AstScope* scopep = nodep->scopep();
|
AstScope* scopep = nodep->scopep();
|
||||||
if (!scopep) nodep->v3fatalSrc("No scope found on top level");
|
if (!scopep) nodep->v3fatalSrc("No scope found on top level");
|
||||||
m_highScopep = scopep;
|
m_highScopep = scopep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCCall* nodep, AstNUser*) {
|
virtual void visit(AstCCall* nodep) {
|
||||||
UINFO(8," CCALL "<<nodep<<endl);
|
UINFO(8," CCALL "<<nodep<<endl);
|
||||||
if (!m_finding && !nodep->user2()) {
|
if (!m_finding && !nodep->user2()) {
|
||||||
// See if there are other calls in same statement list;
|
// See if there are other calls in same statement list;
|
||||||
|
|
@ -613,7 +613,7 @@ private:
|
||||||
}
|
}
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
virtual void visit(AstCFunc* nodep) {
|
||||||
UINFO(8," CFUNC "<<nodep<<endl);
|
UINFO(8," CFUNC "<<nodep<<endl);
|
||||||
if (nodep->funcType() == AstCFuncType::TRACE_INIT) {
|
if (nodep->funcType() == AstCFuncType::TRACE_INIT) {
|
||||||
m_initFuncp = nodep;
|
m_initFuncp = nodep;
|
||||||
|
|
@ -636,7 +636,7 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_funcp = NULL;
|
m_funcp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstTraceInc* nodep, AstNUser*) {
|
virtual void visit(AstTraceInc* nodep) {
|
||||||
UINFO(8," TRACE "<<nodep<<endl);
|
UINFO(8," TRACE "<<nodep<<endl);
|
||||||
if (m_finding) nodep->v3fatalSrc("Traces should have been removed in prev step.");
|
if (m_finding) nodep->v3fatalSrc("Traces should have been removed in prev step.");
|
||||||
nodep->unlinkFrBack();
|
nodep->unlinkFrBack();
|
||||||
|
|
@ -649,7 +649,7 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_tracep = NULL;
|
m_tracep = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (m_tracep) {
|
if (m_tracep) {
|
||||||
if (!nodep->varScopep()) nodep->v3fatalSrc("No var scope?");
|
if (!nodep->varScopep()) nodep->v3fatalSrc("No var scope?");
|
||||||
if (nodep->lvalue()) nodep->v3fatalSrc("Lvalue in trace? Should be const.");
|
if (nodep->lvalue()) nodep->v3fatalSrc("Lvalue in trace? Should be const.");
|
||||||
|
|
@ -675,7 +675,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//--------------------
|
//--------------------
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstTopScope* nodep, AstNUser*) {
|
virtual void visit(AstTopScope* nodep) {
|
||||||
m_scopetopp = nodep->scopep();
|
m_scopetopp = nodep->scopep();
|
||||||
// Make containers for TRACEDECLs first
|
// Make containers for TRACEDECLs first
|
||||||
m_initFuncp = newCFunc(AstCFuncType::TRACE_INIT, "traceInitThis", true);
|
m_initFuncp = newCFunc(AstCFuncType::TRACE_INIT, "traceInitThis", true);
|
||||||
|
|
@ -148,7 +148,7 @@ private:
|
||||||
// And find variables
|
// And find variables
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarScope* nodep, AstNUser*) {
|
virtual void visit(AstVarScope* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Avoid updating this if (), instead see varp->isTrace()
|
// Avoid updating this if (), instead see varp->isTrace()
|
||||||
if (!nodep->varp()->isTemp() && !nodep->varp()->isFuncLocal()) {
|
if (!nodep->varp()->isTemp() && !nodep->varp()->isFuncLocal()) {
|
||||||
|
|
@ -183,17 +183,17 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// VISITORS - Data types when tracing
|
// VISITORS - Data types when tracing
|
||||||
virtual void visit(AstConstDType* nodep, AstNUser*) {
|
virtual void visit(AstConstDType* nodep) {
|
||||||
if (m_traVscp) {
|
if (m_traVscp) {
|
||||||
nodep->subDTypep()->skipRefp()->accept(*this);
|
nodep->subDTypep()->skipRefp()->accept(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstRefDType* nodep, AstNUser*) {
|
virtual void visit(AstRefDType* nodep) {
|
||||||
if (m_traVscp) {
|
if (m_traVscp) {
|
||||||
nodep->subDTypep()->skipRefp()->accept(*this);
|
nodep->subDTypep()->skipRefp()->accept(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstUnpackArrayDType* nodep, AstNUser*) {
|
virtual void visit(AstUnpackArrayDType* nodep) {
|
||||||
// Note more specific dtypes above
|
// Note more specific dtypes above
|
||||||
if (m_traVscp) {
|
if (m_traVscp) {
|
||||||
if ((int)nodep->arrayUnpackedElements() > v3Global.opt.traceMaxArray()) {
|
if ((int)nodep->arrayUnpackedElements() > v3Global.opt.traceMaxArray()) {
|
||||||
|
|
@ -223,7 +223,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstPackArrayDType* nodep, AstNUser*) {
|
virtual void visit(AstPackArrayDType* nodep) {
|
||||||
if (m_traVscp) {
|
if (m_traVscp) {
|
||||||
if (!v3Global.opt.traceStructs()) {
|
if (!v3Global.opt.traceStructs()) {
|
||||||
// Everything downstream is packed, so deal with as one trace unit
|
// Everything downstream is packed, so deal with as one trace unit
|
||||||
|
|
@ -248,7 +248,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeClassDType* nodep, AstNUser*) {
|
virtual void visit(AstNodeClassDType* nodep) {
|
||||||
if (m_traVscp) {
|
if (m_traVscp) {
|
||||||
if (nodep->packed() && !v3Global.opt.traceStructs()) {
|
if (nodep->packed() && !v3Global.opt.traceStructs()) {
|
||||||
// Everything downstream is packed, so deal with as one trace unit
|
// Everything downstream is packed, so deal with as one trace unit
|
||||||
|
|
@ -280,7 +280,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstBasicDType* nodep, AstNUser*) {
|
virtual void visit(AstBasicDType* nodep) {
|
||||||
if (m_traVscp) {
|
if (m_traVscp) {
|
||||||
if (nodep->keyword()==AstBasicDTypeKwd::STRING) {
|
if (nodep->keyword()==AstBasicDTypeKwd::STRING) {
|
||||||
addIgnore("Unsupported: strings");
|
addIgnore("Unsupported: strings");
|
||||||
|
|
@ -289,14 +289,14 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeDType* nodep, AstNUser*) {
|
virtual void visit(AstNodeDType* nodep) {
|
||||||
// Note more specific dtypes above
|
// Note more specific dtypes above
|
||||||
if (!m_traVscp) return;
|
if (!m_traVscp) return;
|
||||||
addIgnore("Unsupported: data type");
|
addIgnore("Unsupported: data type");
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -286,7 +286,7 @@ class TristatePinVisitor : public TristateBaseVisitor {
|
||||||
TristateGraph& m_tgraph;
|
TristateGraph& m_tgraph;
|
||||||
bool m_lvalue; // Flip to be an LVALUE
|
bool m_lvalue; // Flip to be an LVALUE
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (m_lvalue && !nodep->lvalue()) {
|
if (m_lvalue && !nodep->lvalue()) {
|
||||||
UINFO(9," Flip-to-LValue "<<nodep<<endl);
|
UINFO(9," Flip-to-LValue "<<nodep<<endl);
|
||||||
nodep->lvalue(true);
|
nodep->lvalue(true);
|
||||||
|
|
@ -298,12 +298,12 @@ class TristatePinVisitor : public TristateBaseVisitor {
|
||||||
m_tgraph.setTristate(nodep->varp());
|
m_tgraph.setTristate(nodep->varp());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstArraySel* nodep, AstNUser*) {
|
virtual void visit(AstArraySel* nodep) {
|
||||||
// Doesn't work because we'd set lvalue on the array index's var
|
// Doesn't work because we'd set lvalue on the array index's var
|
||||||
if (m_lvalue) nodep->v3fatalSrc("ArraySel conversion to output, under tristate node");
|
if (m_lvalue) nodep->v3fatalSrc("ArraySel conversion to output, under tristate node");
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
@ -635,7 +635,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) {
|
virtual void visit(AstConst* nodep) {
|
||||||
UINFO(9,dbgState()<<nodep<<endl);
|
UINFO(9,dbgState()<<nodep<<endl);
|
||||||
if (m_graphing) {
|
if (m_graphing) {
|
||||||
if (!m_alhs && nodep->num().hasZ()) {
|
if (!m_alhs && nodep->num().hasZ()) {
|
||||||
|
|
@ -668,7 +668,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstCond* nodep, AstNUser*) {
|
virtual void visit(AstCond* nodep) {
|
||||||
if (m_graphing) {
|
if (m_graphing) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_alhs) {
|
if (m_alhs) {
|
||||||
|
|
@ -707,7 +707,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstSel* nodep, AstNUser*) {
|
virtual void visit(AstSel* nodep) {
|
||||||
if (m_graphing) {
|
if (m_graphing) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_alhs) {
|
if (m_alhs) {
|
||||||
|
|
@ -744,7 +744,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstConcat* nodep, AstNUser*) {
|
virtual void visit(AstConcat* nodep) {
|
||||||
if (m_graphing) {
|
if (m_graphing) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_alhs) {
|
if (m_alhs) {
|
||||||
|
|
@ -793,7 +793,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstBufIf1* nodep, AstNUser*) {
|
virtual void visit(AstBufIf1* nodep) {
|
||||||
// For BufIf1, the enable is the LHS expression
|
// For BufIf1, the enable is the LHS expression
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
UINFO(9,dbgState()<<nodep<<endl);
|
UINFO(9,dbgState()<<nodep<<endl);
|
||||||
|
|
@ -873,10 +873,10 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
expr2p->user1p(NULL);
|
expr2p->user1p(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstAnd* nodep, AstNUser*) {
|
virtual void visit(AstAnd* nodep) {
|
||||||
visitAndOr(nodep,true);
|
visitAndOr(nodep,true);
|
||||||
}
|
}
|
||||||
virtual void visit(AstOr* nodep, AstNUser*) {
|
virtual void visit(AstOr* nodep) {
|
||||||
visitAndOr(nodep,false);
|
visitAndOr(nodep,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -913,10 +913,10 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
m_alhs = false;
|
m_alhs = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignW* nodep, AstNUser*) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
visitAssign(nodep);
|
visitAssign(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssign* nodep, AstNUser*) {
|
virtual void visit(AstAssign* nodep) {
|
||||||
visitAssign(nodep);
|
visitAssign(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -964,20 +964,20 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
nodep->lhsp()->iterateAndNext(*this);
|
nodep->lhsp()->iterateAndNext(*this);
|
||||||
if (nodep->lhsp()->user1p()) { nodep->v3error("Unsupported LHS tristate construct: "<<nodep->prettyTypeName()); return; }
|
if (nodep->lhsp()->user1p()) { nodep->v3error("Unsupported LHS tristate construct: "<<nodep->prettyTypeName()); return; }
|
||||||
}
|
}
|
||||||
virtual void visit(AstEqCase* nodep, AstNUser*) {
|
virtual void visit(AstEqCase* nodep) {
|
||||||
visitCaseEq(nodep,false);
|
visitCaseEq(nodep,false);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNeqCase* nodep, AstNUser*) {
|
virtual void visit(AstNeqCase* nodep) {
|
||||||
visitCaseEq(nodep,true);
|
visitCaseEq(nodep,true);
|
||||||
}
|
}
|
||||||
virtual void visit(AstEqWild* nodep, AstNUser*) {
|
virtual void visit(AstEqWild* nodep) {
|
||||||
visitEqNeqWild(nodep);
|
visitEqNeqWild(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNeqWild* nodep, AstNUser*) {
|
virtual void visit(AstNeqWild* nodep) {
|
||||||
visitEqNeqWild(nodep);
|
visitEqNeqWild(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstPull* nodep, AstNUser*) {
|
virtual void visit(AstPull* nodep) {
|
||||||
UINFO(9,dbgState()<<nodep<<endl);
|
UINFO(9,dbgState()<<nodep<<endl);
|
||||||
if (m_graphing) {
|
if (m_graphing) {
|
||||||
if (AstVarRef* lhsp = nodep->lhsp()->castVarRef()) {
|
if (AstVarRef* lhsp = nodep->lhsp()->castVarRef()) {
|
||||||
|
|
@ -1046,7 +1046,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
// const input in(from-resolver-with-const-value), __en(from-resolver-const), __out(to-resolver-only)
|
// const input in(from-resolver-with-const-value), __en(from-resolver-const), __out(to-resolver-only)
|
||||||
// const inout Spec says illegal
|
// const inout Spec says illegal
|
||||||
// const output Unsupported; Illegal?
|
// const output Unsupported; Illegal?
|
||||||
virtual void visit(AstPin* nodep, AstNUser*) {
|
virtual void visit(AstPin* nodep) {
|
||||||
if (m_graphing) {
|
if (m_graphing) {
|
||||||
if (nodep->user2() & U2_GRAPHING) return; // This pin is already expanded
|
if (nodep->user2() & U2_GRAPHING) return; // This pin is already expanded
|
||||||
nodep->user2(U2_GRAPHING);
|
nodep->user2(U2_GRAPHING);
|
||||||
|
|
@ -1185,7 +1185,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
UINFO(9,dbgState()<<nodep<<endl);
|
UINFO(9,dbgState()<<nodep<<endl);
|
||||||
if (m_graphing) {
|
if (m_graphing) {
|
||||||
if (nodep->lvalue()) {
|
if (nodep->lvalue()) {
|
||||||
|
|
@ -1219,7 +1219,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
UINFO(9,dbgState()<<nodep<<endl);
|
UINFO(9,dbgState()<<nodep<<endl);
|
||||||
if (m_graphing) {
|
if (m_graphing) {
|
||||||
|
|
@ -1251,7 +1251,7 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
UINFO(8, nodep<<endl);
|
UINFO(8, nodep<<endl);
|
||||||
if (m_graphing) nodep->v3fatalSrc("Modules under modules not supported"); // Lots of per-module state breaks
|
if (m_graphing) nodep->v3fatalSrc("Modules under modules not supported"); // Lots of per-module state breaks
|
||||||
// Clear state
|
// Clear state
|
||||||
|
|
@ -1275,28 +1275,28 @@ class TristateVisitor : public TristateBaseVisitor {
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
// don't deal with functions
|
// don't deal with functions
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstCaseItem* nodep, AstNUser*) {
|
virtual void visit(AstCaseItem* nodep) {
|
||||||
// don't deal with casez compare '???? values
|
// don't deal with casez compare '???? values
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
m_cellp = nodep;
|
m_cellp = nodep;
|
||||||
m_alhs = false;
|
m_alhs = false;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_cellp = NULL;
|
m_cellp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
nodep->iterateChildrenBackwards(*this);
|
nodep->iterateChildrenBackwards(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
checkUnhandled(nodep);
|
checkUnhandled(nodep);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
for (int usr=1; usr<(m_alwaysp?3:2); ++usr) {
|
for (int usr=1; usr<(m_alwaysp?3:2); ++usr) {
|
||||||
UndrivenVarEntry* entryp = getEntryp (nodep, usr);
|
UndrivenVarEntry* entryp = getEntryp (nodep, usr);
|
||||||
if (nodep->isInput()
|
if (nodep->isInput()
|
||||||
|
|
@ -284,11 +284,11 @@ private:
|
||||||
// Discover variables used in bit definitions, etc
|
// Discover variables used in bit definitions, etc
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstArraySel* nodep, AstNUser*) {
|
virtual void visit(AstArraySel* nodep) {
|
||||||
// Arrays are rarely constant assigned, so for now we punt and do all entries
|
// Arrays are rarely constant assigned, so for now we punt and do all entries
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstSel* nodep, AstNUser*) {
|
virtual void visit(AstSel* nodep) {
|
||||||
AstVarRef* varrefp = nodep->fromp()->castVarRef();
|
AstVarRef* varrefp = nodep->fromp()->castVarRef();
|
||||||
AstConst* constp = nodep->lsbp()->castConst();
|
AstConst* constp = nodep->lsbp()->castConst();
|
||||||
if (varrefp && constp && !constp->num().isFourState()) {
|
if (varrefp && constp && !constp->num().isFourState()) {
|
||||||
|
|
@ -310,7 +310,7 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
// Any variable
|
// Any variable
|
||||||
for (int usr=1; usr<(m_alwaysp?3:2); ++usr) {
|
for (int usr=1; usr<(m_alwaysp?3:2); ++usr) {
|
||||||
UndrivenVarEntry* entryp = getEntryp (nodep->varp(), usr);
|
UndrivenVarEntry* entryp = getEntryp (nodep->varp(), usr);
|
||||||
|
|
@ -327,14 +327,14 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't know what black boxed calls do, assume in+out
|
// Don't know what black boxed calls do, assume in+out
|
||||||
virtual void visit(AstSysIgnore* nodep, AstNUser*) {
|
virtual void visit(AstSysIgnore* nodep) {
|
||||||
bool prevMark = m_inBBox;
|
bool prevMark = m_inBBox;
|
||||||
m_inBBox = true;
|
m_inBBox = true;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_inBBox = prevMark;
|
m_inBBox = prevMark;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstAlways* nodep, AstNUser*) {
|
virtual void visit(AstAlways* nodep) {
|
||||||
AstAlways* prevAlwp = m_alwaysp;
|
AstAlways* prevAlwp = m_alwaysp;
|
||||||
{
|
{
|
||||||
AstNode::user2ClearTree();
|
AstNode::user2ClearTree();
|
||||||
|
|
@ -347,7 +347,7 @@ private:
|
||||||
m_alwaysp = prevAlwp;
|
m_alwaysp = prevAlwp;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
AstNodeFTask* prevTaskp = m_taskp;
|
AstNodeFTask* prevTaskp = m_taskp;
|
||||||
m_taskp = nodep;
|
m_taskp = nodep;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
|
|
@ -355,18 +355,18 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Until we support tables, primitives will have undriven and unused I/Os
|
// Until we support tables, primitives will have undriven and unused I/Os
|
||||||
virtual void visit(AstPrimitive* nodep, AstNUser*) {}
|
virtual void visit(AstPrimitive* nodep) {}
|
||||||
|
|
||||||
// Coverage artifacts etc shouldn't count as a sink
|
// Coverage artifacts etc shouldn't count as a sink
|
||||||
virtual void visit(AstCoverDecl* nodep, AstNUser*) {}
|
virtual void visit(AstCoverDecl* nodep) {}
|
||||||
virtual void visit(AstCoverInc* nodep, AstNUser*) {}
|
virtual void visit(AstCoverInc* nodep) {}
|
||||||
virtual void visit(AstCoverToggle* nodep, AstNUser*) {}
|
virtual void visit(AstCoverToggle* nodep) {}
|
||||||
virtual void visit(AstTraceDecl* nodep, AstNUser*) {}
|
virtual void visit(AstTraceDecl* nodep) {}
|
||||||
virtual void visit(AstTraceInc* nodep, AstNUser*) {}
|
virtual void visit(AstTraceInc* nodep) {}
|
||||||
|
|
||||||
// iterate
|
// iterate
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) {}
|
virtual void visit(AstConst* nodep) {}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -147,30 +147,30 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
virtual void visit(AstNodeModule* nodep) {
|
||||||
UINFO(4," MOD "<<nodep<<endl);
|
UINFO(4," MOD "<<nodep<<endl);
|
||||||
m_modp = nodep;
|
m_modp = nodep;
|
||||||
m_constXCvt = true;
|
m_constXCvt = true;
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_modp = NULL;
|
m_modp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignDly* nodep, AstNUser*) {
|
virtual void visit(AstAssignDly* nodep) {
|
||||||
m_assigndlyp = nodep;
|
m_assigndlyp = nodep;
|
||||||
nodep->iterateChildren(*this); VL_DANGLING(nodep); // May delete nodep.
|
nodep->iterateChildren(*this); VL_DANGLING(nodep); // May delete nodep.
|
||||||
m_assigndlyp = NULL;
|
m_assigndlyp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstAssignW* nodep, AstNUser*) {
|
virtual void visit(AstAssignW* nodep) {
|
||||||
m_assignwp = nodep;
|
m_assignwp = nodep;
|
||||||
nodep->iterateChildren(*this); VL_DANGLING(nodep); // May delete nodep.
|
nodep->iterateChildren(*this); VL_DANGLING(nodep); // May delete nodep.
|
||||||
m_assignwp = NULL;
|
m_assignwp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstCaseItem* nodep, AstNUser*) {
|
virtual void visit(AstCaseItem* nodep) {
|
||||||
m_constXCvt = false; // Avoid losing the X's in casex
|
m_constXCvt = false; // Avoid losing the X's in casex
|
||||||
nodep->condsp()->iterateAndNext(*this);
|
nodep->condsp()->iterateAndNext(*this);
|
||||||
m_constXCvt = true;
|
m_constXCvt = true;
|
||||||
nodep->bodysp()->iterateAndNext(*this);
|
nodep->bodysp()->iterateAndNext(*this);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeDType* nodep, AstNUser*) {
|
virtual void visit(AstNodeDType* nodep) {
|
||||||
m_constXCvt = false; // Avoid losing the X's in casex
|
m_constXCvt = false; // Avoid losing the X's in casex
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
m_constXCvt = true;
|
m_constXCvt = true;
|
||||||
|
|
@ -242,19 +242,19 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstEqCase* nodep, AstNUser*) {
|
virtual void visit(AstEqCase* nodep) {
|
||||||
visitEqNeqCase(nodep);
|
visitEqNeqCase(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNeqCase* nodep, AstNUser*) {
|
virtual void visit(AstNeqCase* nodep) {
|
||||||
visitEqNeqCase(nodep);
|
visitEqNeqCase(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstEqWild* nodep, AstNUser*) {
|
virtual void visit(AstEqWild* nodep) {
|
||||||
visitEqNeqWild(nodep);
|
visitEqNeqWild(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNeqWild* nodep, AstNUser*) {
|
virtual void visit(AstNeqWild* nodep) {
|
||||||
visitEqNeqWild(nodep);
|
visitEqNeqWild(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstIsUnknown* nodep, AstNUser*) {
|
virtual void visit(AstIsUnknown* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
// Ahh, we're two state, so this is easy
|
// Ahh, we're two state, so this is easy
|
||||||
UINFO(4," ISUNKNOWN->0 "<<nodep<<endl);
|
UINFO(4," ISUNKNOWN->0 "<<nodep<<endl);
|
||||||
|
|
@ -263,7 +263,7 @@ private:
|
||||||
nodep->replaceWith(newp);
|
nodep->replaceWith(newp);
|
||||||
nodep->deleteTree(); VL_DANGLING(nodep);
|
nodep->deleteTree(); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) {
|
virtual void visit(AstConst* nodep) {
|
||||||
if (m_constXCvt
|
if (m_constXCvt
|
||||||
&& nodep->num().isFourState()) {
|
&& nodep->num().isFourState()) {
|
||||||
UINFO(4," CONST4 "<<nodep<<endl);
|
UINFO(4," CONST4 "<<nodep<<endl);
|
||||||
|
|
@ -327,7 +327,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstSel* nodep, AstNUser*) {
|
virtual void visit(AstSel* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (!nodep->user1SetOnce()) {
|
if (!nodep->user1SetOnce()) {
|
||||||
// Guard against reading/writing past end of bit vector array
|
// Guard against reading/writing past end of bit vector array
|
||||||
|
|
@ -375,7 +375,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstArraySel* nodep, AstNUser*) {
|
virtual void visit(AstArraySel* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (!nodep->user1SetOnce()) {
|
if (!nodep->user1SetOnce()) {
|
||||||
if (debug()==9) nodep->dumpTree(cout,"-in: ");
|
if (debug()==9) nodep->dumpTree(cout,"-in: ");
|
||||||
|
|
@ -453,7 +453,7 @@ private:
|
||||||
}
|
}
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -358,7 +358,7 @@ private:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstWhile* nodep, AstNUser*) {
|
virtual void visit(AstWhile* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
if (m_varModeCheck || m_varModeReplace) {
|
if (m_varModeCheck || m_varModeReplace) {
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -387,7 +387,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstGenFor* nodep, AstNUser*) {
|
virtual void visit(AstGenFor* nodep) {
|
||||||
if (!m_generate || m_varModeReplace) {
|
if (!m_generate || m_varModeReplace) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
} // else V3Param will recursively call each for loop to be unrolled for us
|
} // else V3Param will recursively call each for loop to be unrolled for us
|
||||||
|
|
@ -415,7 +415,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFor* nodep, AstNUser*) {
|
virtual void visit(AstNodeFor* nodep) {
|
||||||
if (m_generate) { // Ignore for's when expanding genfor's
|
if (m_generate) { // Ignore for's when expanding genfor's
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -423,7 +423,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstVarRef* nodep, AstNUser*) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
if (m_varModeCheck
|
if (m_varModeCheck
|
||||||
&& nodep->varp() == m_forVarp
|
&& nodep->varp() == m_forVarp
|
||||||
&& nodep->varScopep() == m_forVscp
|
&& nodep->varScopep() == m_forVscp
|
||||||
|
|
@ -444,7 +444,7 @@ private:
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
if (m_varModeCheck && nodep == m_ignoreIncp) {
|
if (m_varModeCheck && nodep == m_ignoreIncp) {
|
||||||
// Ignore subtree that is the increment
|
// Ignore subtree that is the increment
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
334
src/V3Width.cpp
334
src/V3Width.cpp
|
|
@ -215,128 +215,128 @@ private:
|
||||||
// _Ox=anything
|
// _Ox=anything
|
||||||
|
|
||||||
// Widths: 1 bit out, lhs 1 bit; Real: converts via compare with 0
|
// Widths: 1 bit out, lhs 1 bit; Real: converts via compare with 0
|
||||||
virtual void visit(AstLogNot* nodep, AstNUser*) { visit_log_not(nodep); }
|
virtual void visit(AstLogNot* nodep) { visit_log_not(nodep); }
|
||||||
// Widths: 1 bit out, lhs 1 bit, rhs 1 bit; Real: converts via compare with 0
|
// Widths: 1 bit out, lhs 1 bit, rhs 1 bit; Real: converts via compare with 0
|
||||||
virtual void visit(AstLogAnd* nodep, AstNUser*) { visit_log_and_or(nodep); }
|
virtual void visit(AstLogAnd* nodep) { visit_log_and_or(nodep); }
|
||||||
virtual void visit(AstLogOr* nodep, AstNUser*) { visit_log_and_or(nodep); }
|
virtual void visit(AstLogOr* nodep) { visit_log_and_or(nodep); }
|
||||||
virtual void visit(AstLogIf* nodep, AstNUser*) { visit_log_and_or(nodep); } // Conversion from real not in IEEE, but a fallout
|
virtual void visit(AstLogIf* nodep) { visit_log_and_or(nodep); } // Conversion from real not in IEEE, but a fallout
|
||||||
virtual void visit(AstLogIff* nodep, AstNUser*) { visit_log_and_or(nodep); } // Conversion from real not in IEEE, but a fallout
|
virtual void visit(AstLogIff* nodep) { visit_log_and_or(nodep); } // Conversion from real not in IEEE, but a fallout
|
||||||
|
|
||||||
// Widths: 1 bit out, Any width lhs
|
// Widths: 1 bit out, Any width lhs
|
||||||
virtual void visit(AstRedAnd* nodep, AstNUser*) { visit_red_and_or(nodep); }
|
virtual void visit(AstRedAnd* nodep) { visit_red_and_or(nodep); }
|
||||||
virtual void visit(AstRedOr* nodep, AstNUser*) { visit_red_and_or(nodep); }
|
virtual void visit(AstRedOr* nodep) { visit_red_and_or(nodep); }
|
||||||
virtual void visit(AstRedXnor* nodep, AstNUser*){ visit_red_and_or(nodep); }
|
virtual void visit(AstRedXnor* nodep){ visit_red_and_or(nodep); }
|
||||||
virtual void visit(AstRedXor* nodep, AstNUser*) { visit_red_and_or(nodep); }
|
virtual void visit(AstRedXor* nodep) { visit_red_and_or(nodep); }
|
||||||
virtual void visit(AstOneHot* nodep, AstNUser*) { visit_red_and_or(nodep); }
|
virtual void visit(AstOneHot* nodep) { visit_red_and_or(nodep); }
|
||||||
virtual void visit(AstOneHot0* nodep, AstNUser*) { visit_red_and_or(nodep); }
|
virtual void visit(AstOneHot0* nodep) { visit_red_and_or(nodep); }
|
||||||
virtual void visit(AstIsUnknown* nodep, AstNUser*) { visit_red_unknown(nodep); } // Allow real
|
virtual void visit(AstIsUnknown* nodep) { visit_red_unknown(nodep); } // Allow real
|
||||||
|
|
||||||
// These have different node types, as they operate differently
|
// These have different node types, as they operate differently
|
||||||
// Must add to case statement below,
|
// Must add to case statement below,
|
||||||
// Widths: 1 bit out, lhs width == rhs width. real if lhs|rhs real
|
// Widths: 1 bit out, lhs width == rhs width. real if lhs|rhs real
|
||||||
virtual void visit(AstEq* nodep, AstNUser*) { visit_cmp_eq_gt(nodep, true); }
|
virtual void visit(AstEq* nodep) { visit_cmp_eq_gt(nodep, true); }
|
||||||
virtual void visit(AstNeq* nodep, AstNUser*) { visit_cmp_eq_gt(nodep, true); }
|
virtual void visit(AstNeq* nodep) { visit_cmp_eq_gt(nodep, true); }
|
||||||
virtual void visit(AstGt* nodep, AstNUser*) { visit_cmp_eq_gt(nodep, true); }
|
virtual void visit(AstGt* nodep) { visit_cmp_eq_gt(nodep, true); }
|
||||||
virtual void visit(AstGte* nodep, AstNUser*) { visit_cmp_eq_gt(nodep, true); }
|
virtual void visit(AstGte* nodep) { visit_cmp_eq_gt(nodep, true); }
|
||||||
virtual void visit(AstLt* nodep, AstNUser*) { visit_cmp_eq_gt(nodep, true); }
|
virtual void visit(AstLt* nodep) { visit_cmp_eq_gt(nodep, true); }
|
||||||
virtual void visit(AstLte* nodep, AstNUser*) { visit_cmp_eq_gt(nodep, true); }
|
virtual void visit(AstLte* nodep) { visit_cmp_eq_gt(nodep, true); }
|
||||||
virtual void visit(AstGtS* nodep, AstNUser*) { visit_cmp_eq_gt(nodep, true); }
|
virtual void visit(AstGtS* nodep) { visit_cmp_eq_gt(nodep, true); }
|
||||||
virtual void visit(AstGteS* nodep, AstNUser*) { visit_cmp_eq_gt(nodep, true); }
|
virtual void visit(AstGteS* nodep) { visit_cmp_eq_gt(nodep, true); }
|
||||||
virtual void visit(AstLtS* nodep, AstNUser*) { visit_cmp_eq_gt(nodep, true); }
|
virtual void visit(AstLtS* nodep) { visit_cmp_eq_gt(nodep, true); }
|
||||||
virtual void visit(AstLteS* nodep, AstNUser*) { visit_cmp_eq_gt(nodep, true); }
|
virtual void visit(AstLteS* nodep) { visit_cmp_eq_gt(nodep, true); }
|
||||||
virtual void visit(AstEqCase* nodep, AstNUser*) { visit_cmp_eq_gt(nodep, true); }
|
virtual void visit(AstEqCase* nodep) { visit_cmp_eq_gt(nodep, true); }
|
||||||
virtual void visit(AstNeqCase* nodep, AstNUser*) { visit_cmp_eq_gt(nodep, true); }
|
virtual void visit(AstNeqCase* nodep) { visit_cmp_eq_gt(nodep, true); }
|
||||||
// ... These comparisons don't allow reals
|
// ... These comparisons don't allow reals
|
||||||
virtual void visit(AstEqWild* nodep, AstNUser*) { visit_cmp_eq_gt(nodep, false); }
|
virtual void visit(AstEqWild* nodep) { visit_cmp_eq_gt(nodep, false); }
|
||||||
virtual void visit(AstNeqWild* nodep, AstNUser*) { visit_cmp_eq_gt(nodep, false); }
|
virtual void visit(AstNeqWild* nodep) { visit_cmp_eq_gt(nodep, false); }
|
||||||
// ... Real compares
|
// ... Real compares
|
||||||
virtual void visit(AstEqD* nodep, AstNUser*) { visit_cmp_real(nodep); }
|
virtual void visit(AstEqD* nodep) { visit_cmp_real(nodep); }
|
||||||
virtual void visit(AstNeqD* nodep, AstNUser*) { visit_cmp_real(nodep); }
|
virtual void visit(AstNeqD* nodep) { visit_cmp_real(nodep); }
|
||||||
virtual void visit(AstLtD* nodep, AstNUser*) { visit_cmp_real(nodep); }
|
virtual void visit(AstLtD* nodep) { visit_cmp_real(nodep); }
|
||||||
virtual void visit(AstLteD* nodep, AstNUser*) { visit_cmp_real(nodep); }
|
virtual void visit(AstLteD* nodep) { visit_cmp_real(nodep); }
|
||||||
virtual void visit(AstGtD* nodep, AstNUser*) { visit_cmp_real(nodep); }
|
virtual void visit(AstGtD* nodep) { visit_cmp_real(nodep); }
|
||||||
virtual void visit(AstGteD* nodep, AstNUser*) { visit_cmp_real(nodep); }
|
virtual void visit(AstGteD* nodep) { visit_cmp_real(nodep); }
|
||||||
// ... String compares
|
// ... String compares
|
||||||
virtual void visit(AstEqN* nodep, AstNUser*) { visit_cmp_string(nodep); }
|
virtual void visit(AstEqN* nodep) { visit_cmp_string(nodep); }
|
||||||
virtual void visit(AstNeqN* nodep, AstNUser*) { visit_cmp_string(nodep); }
|
virtual void visit(AstNeqN* nodep) { visit_cmp_string(nodep); }
|
||||||
virtual void visit(AstLtN* nodep, AstNUser*) { visit_cmp_string(nodep); }
|
virtual void visit(AstLtN* nodep) { visit_cmp_string(nodep); }
|
||||||
virtual void visit(AstLteN* nodep, AstNUser*) { visit_cmp_string(nodep); }
|
virtual void visit(AstLteN* nodep) { visit_cmp_string(nodep); }
|
||||||
virtual void visit(AstGtN* nodep, AstNUser*) { visit_cmp_string(nodep); }
|
virtual void visit(AstGtN* nodep) { visit_cmp_string(nodep); }
|
||||||
virtual void visit(AstGteN* nodep, AstNUser*) { visit_cmp_string(nodep); }
|
virtual void visit(AstGteN* nodep) { visit_cmp_string(nodep); }
|
||||||
|
|
||||||
// Widths: out width = lhs width = rhs width
|
// Widths: out width = lhs width = rhs width
|
||||||
// Signed: Output signed iff LHS & RHS signed.
|
// Signed: Output signed iff LHS & RHS signed.
|
||||||
// Real: Not allowed
|
// Real: Not allowed
|
||||||
virtual void visit(AstAnd* nodep, AstNUser*) { visit_boolmath_and_or(nodep); }
|
virtual void visit(AstAnd* nodep) { visit_boolmath_and_or(nodep); }
|
||||||
virtual void visit(AstOr* nodep, AstNUser*) { visit_boolmath_and_or(nodep); }
|
virtual void visit(AstOr* nodep) { visit_boolmath_and_or(nodep); }
|
||||||
virtual void visit(AstXnor* nodep, AstNUser*) { visit_boolmath_and_or(nodep); }
|
virtual void visit(AstXnor* nodep) { visit_boolmath_and_or(nodep); }
|
||||||
virtual void visit(AstXor* nodep, AstNUser*) { visit_boolmath_and_or(nodep); }
|
virtual void visit(AstXor* nodep) { visit_boolmath_and_or(nodep); }
|
||||||
virtual void visit(AstBufIf1* nodep, AstNUser*) { visit_boolmath_and_or(nodep); } // Signed behavior changing in 3.814
|
virtual void visit(AstBufIf1* nodep) { visit_boolmath_and_or(nodep); } // Signed behavior changing in 3.814
|
||||||
// Width: Max(Lhs,Rhs) sort of.
|
// Width: Max(Lhs,Rhs) sort of.
|
||||||
// Real: If either side real
|
// Real: If either side real
|
||||||
// Signed: If both sides real
|
// Signed: If both sides real
|
||||||
virtual void visit(AstAdd* nodep, AstNUser*) { visit_add_sub_replace(nodep, true); }
|
virtual void visit(AstAdd* nodep) { visit_add_sub_replace(nodep, true); }
|
||||||
virtual void visit(AstSub* nodep, AstNUser*) { visit_add_sub_replace(nodep, true); }
|
virtual void visit(AstSub* nodep) { visit_add_sub_replace(nodep, true); }
|
||||||
virtual void visit(AstDiv* nodep, AstNUser*) { visit_add_sub_replace(nodep, true); }
|
virtual void visit(AstDiv* nodep) { visit_add_sub_replace(nodep, true); }
|
||||||
virtual void visit(AstMul* nodep, AstNUser*) { visit_add_sub_replace(nodep, true); }
|
virtual void visit(AstMul* nodep) { visit_add_sub_replace(nodep, true); }
|
||||||
// These can't promote to real
|
// These can't promote to real
|
||||||
virtual void visit(AstModDiv* nodep, AstNUser*) { visit_add_sub_replace(nodep, false); }
|
virtual void visit(AstModDiv* nodep) { visit_add_sub_replace(nodep, false); }
|
||||||
virtual void visit(AstModDivS* nodep, AstNUser*) { visit_add_sub_replace(nodep, false); }
|
virtual void visit(AstModDivS* nodep) { visit_add_sub_replace(nodep, false); }
|
||||||
virtual void visit(AstMulS* nodep, AstNUser*) { visit_add_sub_replace(nodep, false); }
|
virtual void visit(AstMulS* nodep) { visit_add_sub_replace(nodep, false); }
|
||||||
virtual void visit(AstDivS* nodep, AstNUser*) { visit_add_sub_replace(nodep, false); }
|
virtual void visit(AstDivS* nodep) { visit_add_sub_replace(nodep, false); }
|
||||||
// Widths: out width = lhs width, but upper matters
|
// Widths: out width = lhs width, but upper matters
|
||||||
// Signed: Output signed iff LHS signed; unary operator
|
// Signed: Output signed iff LHS signed; unary operator
|
||||||
// Unary promote to real
|
// Unary promote to real
|
||||||
virtual void visit(AstNegate* nodep, AstNUser*) { visit_negate_not(nodep, true); }
|
virtual void visit(AstNegate* nodep) { visit_negate_not(nodep, true); }
|
||||||
// Unary never real
|
// Unary never real
|
||||||
virtual void visit(AstNot* nodep, AstNUser*) { visit_negate_not(nodep, false); }
|
virtual void visit(AstNot* nodep) { visit_negate_not(nodep, false); }
|
||||||
|
|
||||||
// Real: inputs and output real
|
// Real: inputs and output real
|
||||||
virtual void visit(AstAddD* nodep, AstNUser*) { visit_real_add_sub(nodep); }
|
virtual void visit(AstAddD* nodep) { visit_real_add_sub(nodep); }
|
||||||
virtual void visit(AstSubD* nodep, AstNUser*) { visit_real_add_sub(nodep); }
|
virtual void visit(AstSubD* nodep) { visit_real_add_sub(nodep); }
|
||||||
virtual void visit(AstDivD* nodep, AstNUser*) { visit_real_add_sub(nodep); }
|
virtual void visit(AstDivD* nodep) { visit_real_add_sub(nodep); }
|
||||||
virtual void visit(AstMulD* nodep, AstNUser*) { visit_real_add_sub(nodep); }
|
virtual void visit(AstMulD* nodep) { visit_real_add_sub(nodep); }
|
||||||
virtual void visit(AstPowD* nodep, AstNUser*) { visit_real_add_sub(nodep); }
|
virtual void visit(AstPowD* nodep) { visit_real_add_sub(nodep); }
|
||||||
// Real: Output real
|
// Real: Output real
|
||||||
virtual void visit(AstNegateD* nodep, AstNUser*) { visit_real_neg_ceil(nodep); }
|
virtual void visit(AstNegateD* nodep) { visit_real_neg_ceil(nodep); }
|
||||||
virtual void visit(AstCeilD* nodep, AstNUser*) { visit_real_neg_ceil(nodep); }
|
virtual void visit(AstCeilD* nodep) { visit_real_neg_ceil(nodep); }
|
||||||
virtual void visit(AstExpD* nodep, AstNUser*) { visit_real_neg_ceil(nodep); }
|
virtual void visit(AstExpD* nodep) { visit_real_neg_ceil(nodep); }
|
||||||
virtual void visit(AstFloorD* nodep, AstNUser*) { visit_real_neg_ceil(nodep); }
|
virtual void visit(AstFloorD* nodep) { visit_real_neg_ceil(nodep); }
|
||||||
virtual void visit(AstLogD* nodep, AstNUser*) { visit_real_neg_ceil(nodep); }
|
virtual void visit(AstLogD* nodep) { visit_real_neg_ceil(nodep); }
|
||||||
virtual void visit(AstLog10D* nodep, AstNUser*) { visit_real_neg_ceil(nodep); }
|
virtual void visit(AstLog10D* nodep) { visit_real_neg_ceil(nodep); }
|
||||||
virtual void visit(AstSqrtD* nodep, AstNUser*) { visit_real_neg_ceil(nodep); }
|
virtual void visit(AstSqrtD* nodep) { visit_real_neg_ceil(nodep); }
|
||||||
|
|
||||||
// Widths: out signed/unsigned width = lhs width, input un|signed
|
// Widths: out signed/unsigned width = lhs width, input un|signed
|
||||||
virtual void visit(AstSigned* nodep, AstNUser*) { visit_signed_unsigned(nodep, AstNumeric::SIGNED); }
|
virtual void visit(AstSigned* nodep) { visit_signed_unsigned(nodep, AstNumeric::SIGNED); }
|
||||||
virtual void visit(AstUnsigned* nodep, AstNUser*) { visit_signed_unsigned(nodep, AstNumeric::UNSIGNED); }
|
virtual void visit(AstUnsigned* nodep) { visit_signed_unsigned(nodep, AstNumeric::UNSIGNED); }
|
||||||
|
|
||||||
// Widths: Output width from lhs, rhs<33 bits
|
// Widths: Output width from lhs, rhs<33 bits
|
||||||
// Signed: If lhs signed
|
// Signed: If lhs signed
|
||||||
virtual void visit(AstShiftL* nodep, AstNUser*) { visit_shift(nodep); }
|
virtual void visit(AstShiftL* nodep) { visit_shift(nodep); }
|
||||||
virtual void visit(AstShiftR* nodep, AstNUser*) { visit_shift(nodep); }
|
virtual void visit(AstShiftR* nodep) { visit_shift(nodep); }
|
||||||
// ShiftRS converts to ShiftR, but not vice-versa
|
// ShiftRS converts to ShiftR, but not vice-versa
|
||||||
virtual void visit(AstShiftRS* nodep, AstNUser*) { visit_shift(nodep); }
|
virtual void visit(AstShiftRS* nodep) { visit_shift(nodep); }
|
||||||
|
|
||||||
//========
|
//========
|
||||||
// Widths: Output real, input integer signed
|
// Widths: Output real, input integer signed
|
||||||
virtual void visit(AstBitsToRealD* nodep, AstNUser*) { visit_Or_Lu64(nodep); }
|
virtual void visit(AstBitsToRealD* nodep) { visit_Or_Lu64(nodep); }
|
||||||
virtual void visit(AstIToRD* nodep, AstNUser*) { visit_Or_Ls32(nodep); }
|
virtual void visit(AstIToRD* nodep) { visit_Or_Ls32(nodep); }
|
||||||
|
|
||||||
// Widths: Output integer signed, input real
|
// Widths: Output integer signed, input real
|
||||||
virtual void visit(AstRToIS* nodep, AstNUser*) { visit_Os32_Lr(nodep); }
|
virtual void visit(AstRToIS* nodep) { visit_Os32_Lr(nodep); }
|
||||||
virtual void visit(AstRToIRoundS* nodep, AstNUser*) { visit_Os32_Lr(nodep); }
|
virtual void visit(AstRToIRoundS* nodep) { visit_Os32_Lr(nodep); }
|
||||||
|
|
||||||
// Widths: Output integer unsigned, input real
|
// Widths: Output integer unsigned, input real
|
||||||
virtual void visit(AstRealToBits* nodep, AstNUser*) { visit_Ou64_Lr(nodep); }
|
virtual void visit(AstRealToBits* nodep) { visit_Ou64_Lr(nodep); }
|
||||||
|
|
||||||
// Widths: Constant, terminal
|
// Widths: Constant, terminal
|
||||||
virtual void visit(AstTime* nodep, AstNUser*) { nodep->dtypeSetUInt64(); }
|
virtual void visit(AstTime* nodep) { nodep->dtypeSetUInt64(); }
|
||||||
virtual void visit(AstTimeD* nodep, AstNUser*) { nodep->dtypeSetDouble(); }
|
virtual void visit(AstTimeD* nodep) { nodep->dtypeSetDouble(); }
|
||||||
virtual void visit(AstTestPlusArgs* nodep, AstNUser*) { nodep->dtypeSetSigned32(); }
|
virtual void visit(AstTestPlusArgs* nodep) { nodep->dtypeSetSigned32(); }
|
||||||
virtual void visit(AstScopeName* nodep, AstNUser*) { nodep->dtypeSetUInt64(); } // A pointer, but not that it matters
|
virtual void visit(AstScopeName* nodep) { nodep->dtypeSetUInt64(); } // A pointer, but not that it matters
|
||||||
|
|
||||||
// Special cases. So many....
|
// Special cases. So many....
|
||||||
virtual void visit(AstNodeCond* nodep, AstNUser*) {
|
virtual void visit(AstNodeCond* nodep) {
|
||||||
// op=cond?expr1:expr2
|
// op=cond?expr1:expr2
|
||||||
// Signed: Output signed iff RHS & THS signed (presumed, not in IEEE)
|
// Signed: Output signed iff RHS & THS signed (presumed, not in IEEE)
|
||||||
// See IEEE-2012 11.4.11 and Table 11-21.
|
// See IEEE-2012 11.4.11 and Table 11-21.
|
||||||
|
|
@ -373,7 +373,7 @@ private:
|
||||||
iterateCheck(nodep,"Conditional False",nodep->expr2p(),CONTEXT,FINAL,subDTypep,EXTEND_EXP);
|
iterateCheck(nodep,"Conditional False",nodep->expr2p(),CONTEXT,FINAL,subDTypep,EXTEND_EXP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstConcat* nodep, AstNUser*) {
|
virtual void visit(AstConcat* nodep) {
|
||||||
// Real: Not allowed (assumed)
|
// Real: Not allowed (assumed)
|
||||||
// Signed: unsigned output, input either (assumed)
|
// Signed: unsigned output, input either (assumed)
|
||||||
// IEEE-2012 Table 11-21, and 11.8.1:
|
// IEEE-2012 Table 11-21, and 11.8.1:
|
||||||
|
|
@ -418,7 +418,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstConcatN* nodep, AstNUser*) {
|
virtual void visit(AstConcatN* nodep) {
|
||||||
// String concatenate.
|
// String concatenate.
|
||||||
// Already did AstConcat simplifications
|
// Already did AstConcat simplifications
|
||||||
if (m_vup->prelim()) {
|
if (m_vup->prelim()) {
|
||||||
|
|
@ -433,7 +433,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstReplicate* nodep, AstNUser*) {
|
virtual void visit(AstReplicate* nodep) {
|
||||||
// IEEE-2012 Table 11-21:
|
// IEEE-2012 Table 11-21:
|
||||||
// LHS, RHS is self-determined
|
// LHS, RHS is self-determined
|
||||||
// width: value(LHS) * width(RHS)
|
// width: value(LHS) * width(RHS)
|
||||||
|
|
@ -466,7 +466,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstReplicateN* nodep, AstNUser*) {
|
virtual void visit(AstReplicateN* nodep) {
|
||||||
// Replicate with string
|
// Replicate with string
|
||||||
if (m_vup->prelim()) {
|
if (m_vup->prelim()) {
|
||||||
iterateCheckString(nodep,"LHS",nodep->lhsp(),BOTH);
|
iterateCheckString(nodep,"LHS",nodep->lhsp(),BOTH);
|
||||||
|
|
@ -487,7 +487,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeStream* nodep, AstNUser*) {
|
virtual void visit(AstNodeStream* nodep) {
|
||||||
if (m_vup->prelim()) {
|
if (m_vup->prelim()) {
|
||||||
iterateCheckSizedSelf(nodep,"LHS",nodep->lhsp(),SELF,BOTH);
|
iterateCheckSizedSelf(nodep,"LHS",nodep->lhsp(),SELF,BOTH);
|
||||||
iterateCheckSizedSelf(nodep,"RHS",nodep->rhsp(),SELF,BOTH);
|
iterateCheckSizedSelf(nodep,"RHS",nodep->rhsp(),SELF,BOTH);
|
||||||
|
|
@ -514,7 +514,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstRange* nodep, AstNUser*) {
|
virtual void visit(AstRange* nodep) {
|
||||||
// Real: Not allowed
|
// Real: Not allowed
|
||||||
// Signed: unsigned output, input either
|
// Signed: unsigned output, input either
|
||||||
// Convert all range values to constants
|
// Convert all range values to constants
|
||||||
|
|
@ -545,7 +545,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstSel* nodep, AstNUser*) {
|
virtual void visit(AstSel* nodep) {
|
||||||
// Signed: always unsigned; Real: Not allowed
|
// Signed: always unsigned; Real: Not allowed
|
||||||
// LSB is self-determined (IEEE 2012 11.5.1)
|
// LSB is self-determined (IEEE 2012 11.5.1)
|
||||||
// We also use SELs to shorten a signed constant etc, in this case they are signed.
|
// We also use SELs to shorten a signed constant etc, in this case they are signed.
|
||||||
|
|
@ -643,7 +643,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstArraySel* nodep, AstNUser*) {
|
virtual void visit(AstArraySel* nodep) {
|
||||||
// Signed/Real: Output signed iff LHS signed/real; binary operator
|
// Signed/Real: Output signed iff LHS signed/real; binary operator
|
||||||
// Note by contrast, bit extract selects are unsigned
|
// Note by contrast, bit extract selects are unsigned
|
||||||
// LSB is self-determined (IEEE 2012 11.5.1)
|
// LSB is self-determined (IEEE 2012 11.5.1)
|
||||||
|
|
@ -698,7 +698,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstSelBit* nodep, AstNUser*) {
|
virtual void visit(AstSelBit* nodep) {
|
||||||
// Just a quick check as after V3Param these nodes instead are AstSel's
|
// Just a quick check as after V3Param these nodes instead are AstSel's
|
||||||
userIterateAndNext(nodep->fromp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
userIterateAndNext(nodep->fromp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
||||||
userIterateAndNext(nodep->rhsp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
userIterateAndNext(nodep->rhsp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
||||||
|
|
@ -707,7 +707,7 @@ private:
|
||||||
AstNode* selp = V3Width::widthSelNoIterEdit(nodep); if (selp!=nodep) { nodep=NULL; userIterate(selp, m_vup); return; }
|
AstNode* selp = V3Width::widthSelNoIterEdit(nodep); if (selp!=nodep) { nodep=NULL; userIterate(selp, m_vup); return; }
|
||||||
nodep->v3fatalSrc("AstSelBit should disappear after widthSel");
|
nodep->v3fatalSrc("AstSelBit should disappear after widthSel");
|
||||||
}
|
}
|
||||||
virtual void visit(AstSelExtract* nodep, AstNUser*) {
|
virtual void visit(AstSelExtract* nodep) {
|
||||||
// Just a quick check as after V3Param these nodes instead are AstSel's
|
// Just a quick check as after V3Param these nodes instead are AstSel's
|
||||||
userIterateAndNext(nodep->fromp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
userIterateAndNext(nodep->fromp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
||||||
userIterateAndNext(nodep->rhsp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
userIterateAndNext(nodep->rhsp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
||||||
|
|
@ -716,7 +716,7 @@ private:
|
||||||
AstNode* selp = V3Width::widthSelNoIterEdit(nodep); if (selp!=nodep) { nodep=NULL; userIterate(selp, m_vup); return; }
|
AstNode* selp = V3Width::widthSelNoIterEdit(nodep); if (selp!=nodep) { nodep=NULL; userIterate(selp, m_vup); return; }
|
||||||
nodep->v3fatalSrc("AstSelExtract should disappear after widthSel");
|
nodep->v3fatalSrc("AstSelExtract should disappear after widthSel");
|
||||||
}
|
}
|
||||||
virtual void visit(AstSelPlus* nodep, AstNUser*) {
|
virtual void visit(AstSelPlus* nodep) {
|
||||||
userIterateAndNext(nodep->fromp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
userIterateAndNext(nodep->fromp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
||||||
userIterateAndNext(nodep->rhsp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
userIterateAndNext(nodep->rhsp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
||||||
userIterateAndNext(nodep->thsp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
userIterateAndNext(nodep->thsp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
||||||
|
|
@ -724,7 +724,7 @@ private:
|
||||||
AstNode* selp = V3Width::widthSelNoIterEdit(nodep); if (selp!=nodep) { nodep=NULL; userIterate(selp, m_vup); return; }
|
AstNode* selp = V3Width::widthSelNoIterEdit(nodep); if (selp!=nodep) { nodep=NULL; userIterate(selp, m_vup); return; }
|
||||||
nodep->v3fatalSrc("AstSelPlus should disappear after widthSel");
|
nodep->v3fatalSrc("AstSelPlus should disappear after widthSel");
|
||||||
}
|
}
|
||||||
virtual void visit(AstSelMinus* nodep, AstNUser*) {
|
virtual void visit(AstSelMinus* nodep) {
|
||||||
userIterateAndNext(nodep->fromp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
userIterateAndNext(nodep->fromp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
||||||
userIterateAndNext(nodep->rhsp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
userIterateAndNext(nodep->rhsp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
||||||
userIterateAndNext(nodep->thsp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
userIterateAndNext(nodep->thsp(), WidthVP(CONTEXT,PRELIM).p()); //FINAL in AstSel
|
||||||
|
|
@ -733,13 +733,13 @@ private:
|
||||||
nodep->v3fatalSrc("AstSelMinus should disappear after widthSel");
|
nodep->v3fatalSrc("AstSelMinus should disappear after widthSel");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstExtend* nodep, AstNUser*) {
|
virtual void visit(AstExtend* nodep) {
|
||||||
// Only created by this process, so we know width from here down is correct.
|
// Only created by this process, so we know width from here down is correct.
|
||||||
}
|
}
|
||||||
virtual void visit(AstExtendS* nodep, AstNUser*) {
|
virtual void visit(AstExtendS* nodep) {
|
||||||
// Only created by this process, so we know width from here down is correct.
|
// Only created by this process, so we know width from here down is correct.
|
||||||
}
|
}
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) {
|
virtual void visit(AstConst* nodep) {
|
||||||
// The node got setup with the signed/real state of the node.
|
// The node got setup with the signed/real state of the node.
|
||||||
// However a later operation may have changed the node->signed w/o changing
|
// However a later operation may have changed the node->signed w/o changing
|
||||||
// the number's sign. So we don't: nodep->dtypeChgSigned(nodep->num().isSigned());
|
// the number's sign. So we don't: nodep->dtypeChgSigned(nodep->num().isSigned());
|
||||||
|
|
@ -755,12 +755,12 @@ private:
|
||||||
// We don't size the constant until we commit the widths, as need parameters
|
// We don't size the constant until we commit the widths, as need parameters
|
||||||
// to remain unsized, and numbers to remain unsized to avoid backp() warnings
|
// to remain unsized, and numbers to remain unsized to avoid backp() warnings
|
||||||
}
|
}
|
||||||
virtual void visit(AstRand* nodep, AstNUser*) {
|
virtual void visit(AstRand* nodep) {
|
||||||
if (m_vup->prelim()) {
|
if (m_vup->prelim()) {
|
||||||
nodep->dtypeSetSigned32(); // Says the spec
|
nodep->dtypeSetSigned32(); // Says the spec
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstUCFunc* nodep, AstNUser*) {
|
virtual void visit(AstUCFunc* nodep) {
|
||||||
// Give it the size the user wants.
|
// Give it the size the user wants.
|
||||||
if (m_vup && m_vup->prelim()) {
|
if (m_vup && m_vup->prelim()) {
|
||||||
nodep->dtypeSetLogicSized(32,1,AstNumeric::UNSIGNED); // We don't care
|
nodep->dtypeSetLogicSized(32,1,AstNumeric::UNSIGNED); // We don't care
|
||||||
|
|
@ -773,13 +773,13 @@ private:
|
||||||
if (nodep->width()>64) nodep->v3error("Unsupported: $c can't generate wider than 64 bits");
|
if (nodep->width()>64) nodep->v3error("Unsupported: $c can't generate wider than 64 bits");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstCLog2* nodep, AstNUser*) {
|
virtual void visit(AstCLog2* nodep) {
|
||||||
if (m_vup->prelim()) {
|
if (m_vup->prelim()) {
|
||||||
iterateCheckSizedSelf(nodep,"LHS",nodep->lhsp(),SELF,BOTH);
|
iterateCheckSizedSelf(nodep,"LHS",nodep->lhsp(),SELF,BOTH);
|
||||||
nodep->dtypeSetSigned32();
|
nodep->dtypeSetSigned32();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstPow* nodep, AstNUser*) {
|
virtual void visit(AstPow* nodep) {
|
||||||
// Pow is special, output sign only depends on LHS sign, but function result depends on both signs
|
// Pow is special, output sign only depends on LHS sign, but function result depends on both signs
|
||||||
// RHS is self-determined (IEEE)
|
// RHS is self-determined (IEEE)
|
||||||
// Real if either side is real (as with AstAdd)
|
// Real if either side is real (as with AstAdd)
|
||||||
|
|
@ -823,22 +823,22 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstPowSU* nodep, AstNUser*) {
|
virtual void visit(AstPowSU* nodep) {
|
||||||
// POWSU/SS/US only created here, dtype already determined, so nothing to do in this function
|
// POWSU/SS/US only created here, dtype already determined, so nothing to do in this function
|
||||||
userIterateAndNext(nodep->lhsp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->lhsp(), WidthVP(SELF,BOTH).p());
|
||||||
userIterateAndNext(nodep->rhsp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->rhsp(), WidthVP(SELF,BOTH).p());
|
||||||
}
|
}
|
||||||
virtual void visit(AstPowSS* nodep, AstNUser*) {
|
virtual void visit(AstPowSS* nodep) {
|
||||||
// POWSU/SS/US only created here, dtype already determined, so nothing to do in this function
|
// POWSU/SS/US only created here, dtype already determined, so nothing to do in this function
|
||||||
userIterateAndNext(nodep->lhsp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->lhsp(), WidthVP(SELF,BOTH).p());
|
||||||
userIterateAndNext(nodep->rhsp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->rhsp(), WidthVP(SELF,BOTH).p());
|
||||||
}
|
}
|
||||||
virtual void visit(AstPowUS* nodep, AstNUser*) {
|
virtual void visit(AstPowUS* nodep) {
|
||||||
// POWSU/SS/US only created here, dtype already determined, so nothing to do in this function
|
// POWSU/SS/US only created here, dtype already determined, so nothing to do in this function
|
||||||
userIterateAndNext(nodep->lhsp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->lhsp(), WidthVP(SELF,BOTH).p());
|
||||||
userIterateAndNext(nodep->rhsp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->rhsp(), WidthVP(SELF,BOTH).p());
|
||||||
}
|
}
|
||||||
virtual void visit(AstCountOnes* nodep, AstNUser*) {
|
virtual void visit(AstCountOnes* nodep) {
|
||||||
if (m_vup->prelim()) {
|
if (m_vup->prelim()) {
|
||||||
iterateCheckSizedSelf(nodep,"LHS",nodep->lhsp(),SELF,BOTH);
|
iterateCheckSizedSelf(nodep,"LHS",nodep->lhsp(),SELF,BOTH);
|
||||||
// If it's a 32 bit number, we need a 6 bit number as we need to return '32'.
|
// If it's a 32 bit number, we need a 6 bit number as we need to return '32'.
|
||||||
|
|
@ -846,12 +846,12 @@ private:
|
||||||
nodep->dtypeSetLogicSized(selwidth,selwidth,AstNumeric::UNSIGNED); // Spec doesn't indicate if an integer
|
nodep->dtypeSetLogicSized(selwidth,selwidth,AstNumeric::UNSIGNED); // Spec doesn't indicate if an integer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstCvtPackString* nodep, AstNUser*) {
|
virtual void visit(AstCvtPackString* nodep) {
|
||||||
// Opaque returns, so arbitrary
|
// Opaque returns, so arbitrary
|
||||||
userIterateAndNext(nodep->lhsp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->lhsp(), WidthVP(SELF,BOTH).p());
|
||||||
// Type set in constructor
|
// Type set in constructor
|
||||||
}
|
}
|
||||||
virtual void visit(AstAttrOf* nodep, AstNUser*) {
|
virtual void visit(AstAttrOf* nodep) {
|
||||||
AstAttrOf* oldAttr = m_attrp;
|
AstAttrOf* oldAttr = m_attrp;
|
||||||
m_attrp = nodep;
|
m_attrp = nodep;
|
||||||
userIterateAndNext(nodep->fromp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->fromp(), WidthVP(SELF,BOTH).p());
|
||||||
|
|
@ -907,12 +907,12 @@ private:
|
||||||
}
|
}
|
||||||
m_attrp = oldAttr;
|
m_attrp = oldAttr;
|
||||||
}
|
}
|
||||||
virtual void visit(AstText* nodep, AstNUser*) {
|
virtual void visit(AstText* nodep) {
|
||||||
// Only used in CStmts which don't care....
|
// Only used in CStmts which don't care....
|
||||||
}
|
}
|
||||||
|
|
||||||
// DTYPES
|
// DTYPES
|
||||||
virtual void visit(AstNodeArrayDType* nodep, AstNUser*) {
|
virtual void visit(AstNodeArrayDType* nodep) {
|
||||||
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
||||||
if (nodep->childDTypep()) nodep->refDTypep(moveChildDTypeEdit(nodep));
|
if (nodep->childDTypep()) nodep->refDTypep(moveChildDTypeEdit(nodep));
|
||||||
// Iterate into subDTypep() to resolve that type and update pointer.
|
// Iterate into subDTypep() to resolve that type and update pointer.
|
||||||
|
|
@ -929,7 +929,7 @@ private:
|
||||||
}
|
}
|
||||||
UINFO(4,"dtWidthed "<<nodep<<endl);
|
UINFO(4,"dtWidthed "<<nodep<<endl);
|
||||||
}
|
}
|
||||||
virtual void visit(AstBasicDType* nodep, AstNUser*) {
|
virtual void visit(AstBasicDType* nodep) {
|
||||||
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
||||||
if (nodep->generic()) return; // Already perfect
|
if (nodep->generic()) return; // Already perfect
|
||||||
if (nodep->rangep()) {
|
if (nodep->rangep()) {
|
||||||
|
|
@ -953,7 +953,7 @@ private:
|
||||||
// Instead for now doing this in V3WidthCommit
|
// Instead for now doing this in V3WidthCommit
|
||||||
UINFO(4,"dtWidthed "<<nodep<<endl);
|
UINFO(4,"dtWidthed "<<nodep<<endl);
|
||||||
}
|
}
|
||||||
virtual void visit(AstConstDType* nodep, AstNUser*) {
|
virtual void visit(AstConstDType* nodep) {
|
||||||
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
||||||
// Move any childDTypep to instead be in global AstTypeTable.
|
// Move any childDTypep to instead be in global AstTypeTable.
|
||||||
// This way if this node gets deleted and some other dtype points to it
|
// This way if this node gets deleted and some other dtype points to it
|
||||||
|
|
@ -966,7 +966,7 @@ private:
|
||||||
nodep->widthFromSub(nodep->subDTypep());
|
nodep->widthFromSub(nodep->subDTypep());
|
||||||
UINFO(4,"dtWidthed "<<nodep<<endl);
|
UINFO(4,"dtWidthed "<<nodep<<endl);
|
||||||
}
|
}
|
||||||
virtual void visit(AstRefDType* nodep, AstNUser*) {
|
virtual void visit(AstRefDType* nodep) {
|
||||||
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
||||||
userIterateChildren(nodep, NULL);
|
userIterateChildren(nodep, NULL);
|
||||||
if (nodep->subDTypep()) nodep->refDTypep(iterateEditDTypep(nodep, nodep->subDTypep()));
|
if (nodep->subDTypep()) nodep->refDTypep(iterateEditDTypep(nodep, nodep->subDTypep()));
|
||||||
|
|
@ -974,20 +974,20 @@ private:
|
||||||
nodep->widthFromSub(nodep->subDTypep());
|
nodep->widthFromSub(nodep->subDTypep());
|
||||||
UINFO(4,"dtWidthed "<<nodep<<endl);
|
UINFO(4,"dtWidthed "<<nodep<<endl);
|
||||||
}
|
}
|
||||||
virtual void visit(AstTypedef* nodep, AstNUser*) {
|
virtual void visit(AstTypedef* nodep) {
|
||||||
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
||||||
if (nodep->childDTypep()) nodep->dtypep(moveChildDTypeEdit(nodep));
|
if (nodep->childDTypep()) nodep->dtypep(moveChildDTypeEdit(nodep));
|
||||||
userIterateChildren(nodep, NULL);
|
userIterateChildren(nodep, NULL);
|
||||||
nodep->dtypep(iterateEditDTypep(nodep, nodep->subDTypep()));
|
nodep->dtypep(iterateEditDTypep(nodep, nodep->subDTypep()));
|
||||||
}
|
}
|
||||||
virtual void visit(AstParamTypeDType* nodep, AstNUser*) {
|
virtual void visit(AstParamTypeDType* nodep) {
|
||||||
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
||||||
if (nodep->childDTypep()) nodep->dtypep(moveChildDTypeEdit(nodep));
|
if (nodep->childDTypep()) nodep->dtypep(moveChildDTypeEdit(nodep));
|
||||||
userIterateChildren(nodep, NULL);
|
userIterateChildren(nodep, NULL);
|
||||||
nodep->dtypep(iterateEditDTypep(nodep, nodep->subDTypep()));
|
nodep->dtypep(iterateEditDTypep(nodep, nodep->subDTypep()));
|
||||||
nodep->widthFromSub(nodep->subDTypep());
|
nodep->widthFromSub(nodep->subDTypep());
|
||||||
}
|
}
|
||||||
virtual void visit(AstCastParse* nodep, AstNUser*) {
|
virtual void visit(AstCastParse* nodep) {
|
||||||
// nodep->dtp could be data type, or a primary_constant
|
// nodep->dtp could be data type, or a primary_constant
|
||||||
// Don't iterate lhsp, will deal with that once convert the type
|
// Don't iterate lhsp, will deal with that once convert the type
|
||||||
V3Const::constifyParamsEdit(nodep->dtp()); // itemp may change
|
V3Const::constifyParamsEdit(nodep->dtp()); // itemp may change
|
||||||
|
|
@ -1002,7 +1002,7 @@ private:
|
||||||
nodep->replaceWith(nodep->lhsp()->unlinkFrBack());
|
nodep->replaceWith(nodep->lhsp()->unlinkFrBack());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstCast* nodep, AstNUser*) {
|
virtual void visit(AstCast* nodep) {
|
||||||
if (nodep->childDTypep()) nodep->dtypep(moveChildDTypeEdit(nodep));
|
if (nodep->childDTypep()) nodep->dtypep(moveChildDTypeEdit(nodep));
|
||||||
nodep->dtypep(iterateEditDTypep(nodep, nodep->dtypep()));
|
nodep->dtypep(iterateEditDTypep(nodep, nodep->dtypep()));
|
||||||
//if (debug()) nodep->dumpTree(cout," CastPre: ");
|
//if (debug()) nodep->dumpTree(cout," CastPre: ");
|
||||||
|
|
@ -1041,7 +1041,7 @@ private:
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
//if (debug()) newp->dumpTree(cout," CastOut: ");
|
//if (debug()) newp->dumpTree(cout," CastOut: ");
|
||||||
}
|
}
|
||||||
virtual void visit(AstCastSize* nodep, AstNUser*) {
|
virtual void visit(AstCastSize* nodep) {
|
||||||
// IEEE: Signedness of result is same as self-determined signedness
|
// IEEE: Signedness of result is same as self-determined signedness
|
||||||
// However, the result is same as BITSEL, so we do not sign extend the LHS
|
// However, the result is same as BITSEL, so we do not sign extend the LHS
|
||||||
if (!nodep->rhsp()->castConst()) nodep->v3fatalSrc("Unsupported: Non-const cast of size");
|
if (!nodep->rhsp()->castConst()) nodep->v3fatalSrc("Unsupported: Non-const cast of size");
|
||||||
|
|
@ -1090,7 +1090,7 @@ private:
|
||||||
}
|
}
|
||||||
//if (debug()) nodep->dumpTree(cout," CastSizeOut: ");
|
//if (debug()) nodep->dumpTree(cout," CastSizeOut: ");
|
||||||
}
|
}
|
||||||
virtual void visit(AstVar* nodep, AstNUser*) {
|
virtual void visit(AstVar* nodep) {
|
||||||
//if (debug()) nodep->dumpTree(cout," InitPre: ");
|
//if (debug()) nodep->dumpTree(cout," InitPre: ");
|
||||||
// Must have deterministic constant width
|
// Must have deterministic constant width
|
||||||
// We can't skip this step when width()!=0, as creating a AstVar
|
// We can't skip this step when width()!=0, as creating a AstVar
|
||||||
|
|
@ -1182,7 +1182,7 @@ private:
|
||||||
nodep->didWidth(true);
|
nodep->didWidth(true);
|
||||||
nodep->doingWidth(false);
|
nodep->doingWidth(false);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeVarRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeVarRef* nodep) {
|
||||||
if (nodep->didWidth()) return;
|
if (nodep->didWidth()) return;
|
||||||
if (!nodep->varp()) nodep->v3fatalSrc("Unlinked varref");
|
if (!nodep->varp()) nodep->v3fatalSrc("Unlinked varref");
|
||||||
if (!nodep->varp()->didWidth()) {
|
if (!nodep->varp()->didWidth()) {
|
||||||
|
|
@ -1205,7 +1205,7 @@ private:
|
||||||
nodep->didWidth(true);
|
nodep->didWidth(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstEnumDType* nodep, AstNUser*) {
|
virtual void visit(AstEnumDType* nodep) {
|
||||||
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
||||||
UINFO(5," ENUMDTYPE "<<nodep<<endl);
|
UINFO(5," ENUMDTYPE "<<nodep<<endl);
|
||||||
if (nodep->childDTypep()) nodep->refDTypep(moveChildDTypeEdit(nodep));
|
if (nodep->childDTypep()) nodep->refDTypep(moveChildDTypeEdit(nodep));
|
||||||
|
|
@ -1251,7 +1251,7 @@ private:
|
||||||
num.opAdd(one, itemp->valuep()->castConst()->num());
|
num.opAdd(one, itemp->valuep()->castConst()->num());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstEnumItem* nodep, AstNUser*) {
|
virtual void visit(AstEnumItem* nodep) {
|
||||||
UINFO(5," ENUMITEM "<<nodep<<endl);
|
UINFO(5," ENUMITEM "<<nodep<<endl);
|
||||||
AstNodeDType* vdtypep = m_vup->dtypep();
|
AstNodeDType* vdtypep = m_vup->dtypep();
|
||||||
if (!vdtypep) nodep->v3fatalSrc("ENUMITEM not under ENUM");
|
if (!vdtypep) nodep->v3fatalSrc("ENUMITEM not under ENUM");
|
||||||
|
|
@ -1264,7 +1264,7 @@ private:
|
||||||
iterateCheck(nodep,"Enum value",nodep->valuep(),CONTEXT,FINAL,nodep->dtypep(),EXTEND_EXP);
|
iterateCheck(nodep,"Enum value",nodep->valuep(),CONTEXT,FINAL,nodep->dtypep(),EXTEND_EXP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstEnumItemRef* nodep, AstNUser*) {
|
virtual void visit(AstEnumItemRef* nodep) {
|
||||||
if (!nodep->itemp()->didWidth()) {
|
if (!nodep->itemp()->didWidth()) {
|
||||||
// We need to do the whole enum en-mass
|
// We need to do the whole enum en-mass
|
||||||
AstNode* enump = nodep->itemp();
|
AstNode* enump = nodep->itemp();
|
||||||
|
|
@ -1277,7 +1277,7 @@ private:
|
||||||
}
|
}
|
||||||
nodep->dtypeFrom(nodep->itemp());
|
nodep->dtypeFrom(nodep->itemp());
|
||||||
}
|
}
|
||||||
virtual void visit(AstInitArray* nodep, AstNUser*) {
|
virtual void visit(AstInitArray* nodep) {
|
||||||
// InitArray has type of the array; children are array values
|
// InitArray has type of the array; children are array values
|
||||||
if (m_vup->prelim()) { // First stage evaluation
|
if (m_vup->prelim()) { // First stage evaluation
|
||||||
AstNodeDType* vdtypep = m_vup->dtypep();
|
AstNodeDType* vdtypep = m_vup->dtypep();
|
||||||
|
|
@ -1290,7 +1290,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstInside* nodep, AstNUser*) {
|
virtual void visit(AstInside* nodep) {
|
||||||
userIterateAndNext(nodep->exprp(), WidthVP(CONTEXT,PRELIM).p());
|
userIterateAndNext(nodep->exprp(), WidthVP(CONTEXT,PRELIM).p());
|
||||||
for (AstNode* nextip, *itemp = nodep->itemsp(); itemp; itemp=nextip) {
|
for (AstNode* nextip, *itemp = nodep->itemsp(); itemp; itemp=nextip) {
|
||||||
nextip = itemp->nextp(); // Prelim may cause the node to get replaced
|
nextip = itemp->nextp(); // Prelim may cause the node to get replaced
|
||||||
|
|
@ -1337,14 +1337,14 @@ private:
|
||||||
if (debug()>=9) newp->dumpTree(cout,"-inside-out: ");
|
if (debug()>=9) newp->dumpTree(cout,"-inside-out: ");
|
||||||
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
nodep->replaceWith(newp); pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstInsideRange* nodep, AstNUser*) {
|
virtual void visit(AstInsideRange* nodep) {
|
||||||
// Just do each side; AstInside will rip these nodes out later
|
// Just do each side; AstInside will rip these nodes out later
|
||||||
userIterateAndNext(nodep->lhsp(), m_vup);
|
userIterateAndNext(nodep->lhsp(), m_vup);
|
||||||
userIterateAndNext(nodep->rhsp(), m_vup);
|
userIterateAndNext(nodep->rhsp(), m_vup);
|
||||||
nodep->dtypeFrom(nodep->lhsp());
|
nodep->dtypeFrom(nodep->lhsp());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstIfaceRefDType* nodep, AstNUser*) {
|
virtual void visit(AstIfaceRefDType* nodep) {
|
||||||
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
||||||
UINFO(5," IFACEREF "<<nodep<<endl);
|
UINFO(5," IFACEREF "<<nodep<<endl);
|
||||||
userIterateChildren(nodep, m_vup);
|
userIterateChildren(nodep, m_vup);
|
||||||
|
|
@ -1352,7 +1352,7 @@ private:
|
||||||
nodep->widthForce(1, 1); // Not really relevant
|
nodep->widthForce(1, 1); // Not really relevant
|
||||||
UINFO(4,"dtWidthed "<<nodep<<endl);
|
UINFO(4,"dtWidthed "<<nodep<<endl);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeClassDType* nodep, AstNUser*) {
|
virtual void visit(AstNodeClassDType* nodep) {
|
||||||
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
||||||
UINFO(5," NODECLASS "<<nodep<<endl);
|
UINFO(5," NODECLASS "<<nodep<<endl);
|
||||||
//if (debug()>=9) nodep->dumpTree("-class-in--");
|
//if (debug()>=9) nodep->dumpTree("-class-in--");
|
||||||
|
|
@ -1381,7 +1381,7 @@ private:
|
||||||
nodep->widthForce(width,width); // Signing stays as-is, as parsed from declaration
|
nodep->widthForce(width,width); // Signing stays as-is, as parsed from declaration
|
||||||
//if (debug()>=9) nodep->dumpTree("-class-out-");
|
//if (debug()>=9) nodep->dumpTree("-class-out-");
|
||||||
}
|
}
|
||||||
virtual void visit(AstMemberDType* nodep, AstNUser*) {
|
virtual void visit(AstMemberDType* nodep) {
|
||||||
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed
|
||||||
if (nodep->childDTypep()) nodep->refDTypep(moveChildDTypeEdit(nodep));
|
if (nodep->childDTypep()) nodep->refDTypep(moveChildDTypeEdit(nodep));
|
||||||
// Iterate into subDTypep() to resolve that type and update pointer.
|
// Iterate into subDTypep() to resolve that type and update pointer.
|
||||||
|
|
@ -1389,7 +1389,7 @@ private:
|
||||||
nodep->dtypep(nodep); // The member itself, not subDtype
|
nodep->dtypep(nodep); // The member itself, not subDtype
|
||||||
nodep->widthFromSub(nodep->subDTypep());
|
nodep->widthFromSub(nodep->subDTypep());
|
||||||
}
|
}
|
||||||
virtual void visit(AstMemberSel* nodep, AstNUser*) {
|
virtual void visit(AstMemberSel* nodep) {
|
||||||
UINFO(5," MEMBERSEL "<<nodep<<endl);
|
UINFO(5," MEMBERSEL "<<nodep<<endl);
|
||||||
if (debug()>=9) nodep->dumpTree("-mbs-in: ");
|
if (debug()>=9) nodep->dumpTree("-mbs-in: ");
|
||||||
userIterateChildren(nodep, WidthVP(SELF,BOTH).p());
|
userIterateChildren(nodep, WidthVP(SELF,BOTH).p());
|
||||||
|
|
@ -1441,7 +1441,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstMethodSel* nodep, AstNUser*) {
|
virtual void visit(AstMethodSel* nodep) {
|
||||||
UINFO(5," METHODSEL "<<nodep<<endl);
|
UINFO(5," METHODSEL "<<nodep<<endl);
|
||||||
if (debug()>=9) nodep->dumpTree("-mts-in: ");
|
if (debug()>=9) nodep->dumpTree("-mts-in: ");
|
||||||
// Should check types the method requires, but at present we don't do much
|
// Should check types the method requires, but at present we don't do much
|
||||||
|
|
@ -1535,7 +1535,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstPattern* nodep, AstNUser*) {
|
virtual void visit(AstPattern* nodep) {
|
||||||
if (nodep->didWidthAndSet()) return;
|
if (nodep->didWidthAndSet()) return;
|
||||||
UINFO(9,"PATTERN "<<nodep<<endl);
|
UINFO(9,"PATTERN "<<nodep<<endl);
|
||||||
if (nodep->childDTypep()) nodep->dtypep(moveChildDTypeEdit(nodep)); // data_type '{ pattern }
|
if (nodep->childDTypep()) nodep->dtypep(moveChildDTypeEdit(nodep)); // data_type '{ pattern }
|
||||||
|
|
@ -1798,7 +1798,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstPatMember* nodep, AstNUser*) {
|
virtual void visit(AstPatMember* nodep) {
|
||||||
AstNodeDType* vdtypep = m_vup->dtypeNullp();
|
AstNodeDType* vdtypep = m_vup->dtypeNullp();
|
||||||
if (!vdtypep) nodep->v3fatalSrc("Pattern member type not assigned by AstPattern visitor");
|
if (!vdtypep) nodep->v3fatalSrc("Pattern member type not assigned by AstPattern visitor");
|
||||||
nodep->dtypep(vdtypep);
|
nodep->dtypep(vdtypep);
|
||||||
|
|
@ -1822,7 +1822,7 @@ private:
|
||||||
return times;
|
return times;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstPslClocked* nodep, AstNUser*) {
|
virtual void visit(AstPslClocked* nodep) {
|
||||||
if (m_vup->prelim()) { // First stage evaluation
|
if (m_vup->prelim()) { // First stage evaluation
|
||||||
iterateCheckBool(nodep,"Property",nodep->propp(),BOTH);
|
iterateCheckBool(nodep,"Property",nodep->propp(),BOTH);
|
||||||
userIterateAndNext(nodep->sensesp(), NULL);
|
userIterateAndNext(nodep->sensesp(), NULL);
|
||||||
|
|
@ -1836,7 +1836,7 @@ private:
|
||||||
//--------------------
|
//--------------------
|
||||||
// Top levels
|
// Top levels
|
||||||
|
|
||||||
virtual void visit(AstNodeCase* nodep, AstNUser*) {
|
virtual void visit(AstNodeCase* nodep) {
|
||||||
// IEEE-2012 12.5:
|
// IEEE-2012 12.5:
|
||||||
// Width: MAX(expr, all items)
|
// Width: MAX(expr, all items)
|
||||||
// Signed: Only if expr, and all items signed
|
// Signed: Only if expr, and all items signed
|
||||||
|
|
@ -1876,7 +1876,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFor* nodep, AstNUser*) {
|
virtual void visit(AstNodeFor* nodep) {
|
||||||
assertAtStatement(nodep);
|
assertAtStatement(nodep);
|
||||||
userIterateAndNext(nodep->initsp(), NULL);
|
userIterateAndNext(nodep->initsp(), NULL);
|
||||||
iterateCheckBool(nodep,"For Test Condition",nodep->condp(),BOTH); // it's like an if() condition.
|
iterateCheckBool(nodep,"For Test Condition",nodep->condp(),BOTH); // it's like an if() condition.
|
||||||
|
|
@ -1884,19 +1884,19 @@ private:
|
||||||
userIterateAndNext(nodep->incsp(), NULL);
|
userIterateAndNext(nodep->incsp(), NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
virtual void visit(AstRepeat* nodep, AstNUser*) {
|
virtual void visit(AstRepeat* nodep) {
|
||||||
assertAtStatement(nodep);
|
assertAtStatement(nodep);
|
||||||
userIterateAndNext(nodep->countp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->countp(), WidthVP(SELF,BOTH).p());
|
||||||
userIterateAndNext(nodep->bodysp(), NULL);
|
userIterateAndNext(nodep->bodysp(), NULL);
|
||||||
}
|
}
|
||||||
virtual void visit(AstWhile* nodep, AstNUser*) {
|
virtual void visit(AstWhile* nodep) {
|
||||||
assertAtStatement(nodep);
|
assertAtStatement(nodep);
|
||||||
userIterateAndNext(nodep->precondsp(), NULL);
|
userIterateAndNext(nodep->precondsp(), NULL);
|
||||||
iterateCheckBool(nodep,"For Test Condition",nodep->condp(),BOTH); // it's like an if() condition.
|
iterateCheckBool(nodep,"For Test Condition",nodep->condp(),BOTH); // it's like an if() condition.
|
||||||
userIterateAndNext(nodep->bodysp(), NULL);
|
userIterateAndNext(nodep->bodysp(), NULL);
|
||||||
userIterateAndNext(nodep->incsp(), NULL);
|
userIterateAndNext(nodep->incsp(), NULL);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeIf* nodep, AstNUser*) {
|
virtual void visit(AstNodeIf* nodep) {
|
||||||
assertAtStatement(nodep);
|
assertAtStatement(nodep);
|
||||||
//if (debug()) nodep->dumpTree(cout," IfPre: ");
|
//if (debug()) nodep->dumpTree(cout," IfPre: ");
|
||||||
if (!nodep->castGenIf()) { // for m_paramsOnly
|
if (!nodep->castGenIf()) { // for m_paramsOnly
|
||||||
|
|
@ -1907,7 +1907,7 @@ private:
|
||||||
//if (debug()) nodep->dumpTree(cout," IfOut: ");
|
//if (debug()) nodep->dumpTree(cout," IfOut: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstNodeAssign* nodep, AstNUser*) {
|
virtual void visit(AstNodeAssign* nodep) {
|
||||||
// IEEE-2012 10.7, 11.8.2, 11.8.3, 11.5: (Careful of 11.8.1 which is
|
// IEEE-2012 10.7, 11.8.2, 11.8.3, 11.5: (Careful of 11.8.1 which is
|
||||||
// only one step; final dtype depends on assign LHS.)
|
// only one step; final dtype depends on assign LHS.)
|
||||||
// Determine RHS type width and signing
|
// Determine RHS type width and signing
|
||||||
|
|
@ -1933,7 +1933,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstSFormatF* nodep, AstNUser*) {
|
virtual void visit(AstSFormatF* nodep) {
|
||||||
// Excludes NodeDisplay, see below
|
// Excludes NodeDisplay, see below
|
||||||
if (m_vup && !m_vup->prelim()) return; // Can be called as statement or function
|
if (m_vup && !m_vup->prelim()) return; // Can be called as statement or function
|
||||||
// Just let all arguments seek their natural sizes
|
// Just let all arguments seek their natural sizes
|
||||||
|
|
@ -2001,7 +2001,7 @@ private:
|
||||||
nodep->text(newFormat);
|
nodep->text(newFormat);
|
||||||
UINFO(9," Display out "<<nodep->text()<<endl);
|
UINFO(9," Display out "<<nodep->text()<<endl);
|
||||||
}
|
}
|
||||||
virtual void visit(AstDisplay* nodep, AstNUser*) {
|
virtual void visit(AstDisplay* nodep) {
|
||||||
assertAtStatement(nodep);
|
assertAtStatement(nodep);
|
||||||
if (nodep->filep()) {
|
if (nodep->filep()) {
|
||||||
iterateCheckFileDesc(nodep,nodep->filep(),BOTH);
|
iterateCheckFileDesc(nodep,nodep->filep(),BOTH);
|
||||||
|
|
@ -2009,70 +2009,70 @@ private:
|
||||||
// Just let all arguments seek their natural sizes
|
// Just let all arguments seek their natural sizes
|
||||||
userIterateChildren(nodep, WidthVP(SELF,BOTH).p());
|
userIterateChildren(nodep, WidthVP(SELF,BOTH).p());
|
||||||
}
|
}
|
||||||
virtual void visit(AstFOpen* nodep, AstNUser*) {
|
virtual void visit(AstFOpen* nodep) {
|
||||||
// Although a system function in IEEE, here a statement which sets the file pointer (MCD)
|
// Although a system function in IEEE, here a statement which sets the file pointer (MCD)
|
||||||
assertAtStatement(nodep);
|
assertAtStatement(nodep);
|
||||||
iterateCheckFileDesc(nodep,nodep->filep(),BOTH);
|
iterateCheckFileDesc(nodep,nodep->filep(),BOTH);
|
||||||
userIterateAndNext(nodep->filenamep(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->filenamep(), WidthVP(SELF,BOTH).p());
|
||||||
userIterateAndNext(nodep->modep(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->modep(), WidthVP(SELF,BOTH).p());
|
||||||
}
|
}
|
||||||
virtual void visit(AstFClose* nodep, AstNUser*) {
|
virtual void visit(AstFClose* nodep) {
|
||||||
assertAtStatement(nodep);
|
assertAtStatement(nodep);
|
||||||
iterateCheckFileDesc(nodep,nodep->filep(),BOTH);
|
iterateCheckFileDesc(nodep,nodep->filep(),BOTH);
|
||||||
}
|
}
|
||||||
virtual void visit(AstFEof* nodep, AstNUser*) {
|
virtual void visit(AstFEof* nodep) {
|
||||||
if (m_vup->prelim()) {
|
if (m_vup->prelim()) {
|
||||||
iterateCheckFileDesc(nodep,nodep->filep(),BOTH);
|
iterateCheckFileDesc(nodep,nodep->filep(),BOTH);
|
||||||
nodep->dtypeSetLogicSized(32,1,AstNumeric::SIGNED); // Spec says integer return
|
nodep->dtypeSetLogicSized(32,1,AstNumeric::SIGNED); // Spec says integer return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstFFlush* nodep, AstNUser*) {
|
virtual void visit(AstFFlush* nodep) {
|
||||||
assertAtStatement(nodep);
|
assertAtStatement(nodep);
|
||||||
if (nodep->filep()) {
|
if (nodep->filep()) {
|
||||||
iterateCheckFileDesc(nodep,nodep->filep(),BOTH);
|
iterateCheckFileDesc(nodep,nodep->filep(),BOTH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstFGetC* nodep, AstNUser*) {
|
virtual void visit(AstFGetC* nodep) {
|
||||||
if (m_vup->prelim()) {
|
if (m_vup->prelim()) {
|
||||||
iterateCheckFileDesc(nodep,nodep->filep(),BOTH);
|
iterateCheckFileDesc(nodep,nodep->filep(),BOTH);
|
||||||
nodep->dtypeSetLogicSized(32,8,AstNumeric::SIGNED); // Spec says integer return
|
nodep->dtypeSetLogicSized(32,8,AstNumeric::SIGNED); // Spec says integer return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstFGetS* nodep, AstNUser*) {
|
virtual void visit(AstFGetS* nodep) {
|
||||||
if (m_vup->prelim()) {
|
if (m_vup->prelim()) {
|
||||||
nodep->dtypeSetSigned32(); // Spec says integer return
|
nodep->dtypeSetSigned32(); // Spec says integer return
|
||||||
iterateCheckFileDesc(nodep,nodep->filep(),BOTH);
|
iterateCheckFileDesc(nodep,nodep->filep(),BOTH);
|
||||||
userIterateAndNext(nodep->strgp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->strgp(), WidthVP(SELF,BOTH).p());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstFScanF* nodep, AstNUser*) {
|
virtual void visit(AstFScanF* nodep) {
|
||||||
if (m_vup->prelim()) {
|
if (m_vup->prelim()) {
|
||||||
nodep->dtypeSetSigned32(); // Spec says integer return
|
nodep->dtypeSetSigned32(); // Spec says integer return
|
||||||
iterateCheckFileDesc(nodep,nodep->filep(),BOTH);
|
iterateCheckFileDesc(nodep,nodep->filep(),BOTH);
|
||||||
userIterateAndNext(nodep->exprsp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->exprsp(), WidthVP(SELF,BOTH).p());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstSScanF* nodep, AstNUser*) {
|
virtual void visit(AstSScanF* nodep) {
|
||||||
if (m_vup->prelim()) {
|
if (m_vup->prelim()) {
|
||||||
nodep->dtypeSetSigned32(); // Spec says integer return
|
nodep->dtypeSetSigned32(); // Spec says integer return
|
||||||
userIterateAndNext(nodep->fromp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->fromp(), WidthVP(SELF,BOTH).p());
|
||||||
userIterateAndNext(nodep->exprsp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->exprsp(), WidthVP(SELF,BOTH).p());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstSysIgnore* nodep, AstNUser*) {
|
virtual void visit(AstSysIgnore* nodep) {
|
||||||
userIterateAndNext(nodep->exprsp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->exprsp(), WidthVP(SELF,BOTH).p());
|
||||||
}
|
}
|
||||||
virtual void visit(AstSystemF* nodep, AstNUser*) {
|
virtual void visit(AstSystemF* nodep) {
|
||||||
if (m_vup->prelim()) {
|
if (m_vup->prelim()) {
|
||||||
userIterateAndNext(nodep->lhsp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->lhsp(), WidthVP(SELF,BOTH).p());
|
||||||
nodep->dtypeSetSigned32(); // Spec says integer return
|
nodep->dtypeSetSigned32(); // Spec says integer return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstSystemT* nodep, AstNUser*) {
|
virtual void visit(AstSystemT* nodep) {
|
||||||
assertAtStatement(nodep);
|
assertAtStatement(nodep);
|
||||||
userIterateAndNext(nodep->lhsp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->lhsp(), WidthVP(SELF,BOTH).p());
|
||||||
}
|
}
|
||||||
virtual void visit(AstReadMem* nodep, AstNUser*) {
|
virtual void visit(AstReadMem* nodep) {
|
||||||
assertAtStatement(nodep);
|
assertAtStatement(nodep);
|
||||||
userIterateAndNext(nodep->filenamep(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->filenamep(), WidthVP(SELF,BOTH).p());
|
||||||
userIterateAndNext(nodep->memp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->memp(), WidthVP(SELF,BOTH).p());
|
||||||
|
|
@ -2082,29 +2082,29 @@ private:
|
||||||
userIterateAndNext(nodep->lsbp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->lsbp(), WidthVP(SELF,BOTH).p());
|
||||||
userIterateAndNext(nodep->msbp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->msbp(), WidthVP(SELF,BOTH).p());
|
||||||
}
|
}
|
||||||
virtual void visit(AstValuePlusArgs* nodep, AstNUser*) {
|
virtual void visit(AstValuePlusArgs* nodep) {
|
||||||
if (m_vup->prelim()) {
|
if (m_vup->prelim()) {
|
||||||
userIterateAndNext(nodep->exprsp(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->exprsp(), WidthVP(SELF,BOTH).p());
|
||||||
nodep->dtypeSetSigned32(); // Spec says integer return
|
nodep->dtypeSetSigned32(); // Spec says integer return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstUCStmt* nodep, AstNUser*) {
|
virtual void visit(AstUCStmt* nodep) {
|
||||||
// Just let all arguments seek their natural sizes
|
// Just let all arguments seek their natural sizes
|
||||||
assertAtStatement(nodep);
|
assertAtStatement(nodep);
|
||||||
userIterateChildren(nodep, WidthVP(SELF,BOTH).p());
|
userIterateChildren(nodep, WidthVP(SELF,BOTH).p());
|
||||||
}
|
}
|
||||||
virtual void visit(AstPslCover* nodep, AstNUser*) {
|
virtual void visit(AstPslCover* nodep) {
|
||||||
assertAtStatement(nodep);
|
assertAtStatement(nodep);
|
||||||
iterateCheckBool(nodep,"Property",nodep->propp(),BOTH); // it's like an if() condition.
|
iterateCheckBool(nodep,"Property",nodep->propp(),BOTH); // it's like an if() condition.
|
||||||
userIterateAndNext(nodep->stmtsp(), NULL);
|
userIterateAndNext(nodep->stmtsp(), NULL);
|
||||||
}
|
}
|
||||||
virtual void visit(AstVAssert* nodep, AstNUser*) {
|
virtual void visit(AstVAssert* nodep) {
|
||||||
assertAtStatement(nodep);
|
assertAtStatement(nodep);
|
||||||
iterateCheckBool(nodep,"Property",nodep->propp(),BOTH); // it's like an if() condition.
|
iterateCheckBool(nodep,"Property",nodep->propp(),BOTH); // it's like an if() condition.
|
||||||
userIterateAndNext(nodep->passsp(), NULL);
|
userIterateAndNext(nodep->passsp(), NULL);
|
||||||
userIterateAndNext(nodep->failsp(), NULL);
|
userIterateAndNext(nodep->failsp(), NULL);
|
||||||
}
|
}
|
||||||
virtual void visit(AstPin* nodep, AstNUser*) {
|
virtual void visit(AstPin* nodep) {
|
||||||
//if (debug()) nodep->dumpTree(cout,"- PinPre: ");
|
//if (debug()) nodep->dumpTree(cout,"- PinPre: ");
|
||||||
// TOP LEVEL NODE
|
// TOP LEVEL NODE
|
||||||
if (nodep->modVarp() && nodep->modVarp()->isGParam()) {
|
if (nodep->modVarp() && nodep->modVarp()->isGParam()) {
|
||||||
|
|
@ -2172,7 +2172,7 @@ private:
|
||||||
}
|
}
|
||||||
//if (debug()) nodep->dumpTree(cout,"- PinOut: ");
|
//if (debug()) nodep->dumpTree(cout,"- PinOut: ");
|
||||||
}
|
}
|
||||||
virtual void visit(AstCell* nodep, AstNUser*) {
|
virtual void visit(AstCell* nodep) {
|
||||||
if (!m_paramsOnly) {
|
if (!m_paramsOnly) {
|
||||||
if (nodep->modp()->castNotFoundModule()) {
|
if (nodep->modp()->castNotFoundModule()) {
|
||||||
// We've resolved parameters and hit a module that we couldn't resolve. It's
|
// We've resolved parameters and hit a module that we couldn't resolve. It's
|
||||||
|
|
@ -2190,7 +2190,7 @@ private:
|
||||||
userIterateAndNext(nodep->paramsp(), NULL);
|
userIterateAndNext(nodep->paramsp(), NULL);
|
||||||
m_cellRangep = NULL;
|
m_cellRangep = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstGatePin* nodep, AstNUser*) {
|
virtual void visit(AstGatePin* nodep) {
|
||||||
if (m_vup->prelim()) {
|
if (m_vup->prelim()) {
|
||||||
userIterateAndNext(nodep->rangep(), WidthVP(SELF,BOTH).p());
|
userIterateAndNext(nodep->rangep(), WidthVP(SELF,BOTH).p());
|
||||||
userIterateAndNext(nodep->exprp(), WidthVP(CONTEXT,PRELIM).p());
|
userIterateAndNext(nodep->exprp(), WidthVP(CONTEXT,PRELIM).p());
|
||||||
|
|
@ -2216,7 +2216,7 @@ private:
|
||||||
pushDeletep(nodep); VL_DANGLING(nodep);
|
pushDeletep(nodep); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTask* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTask* nodep) {
|
||||||
// Grab width from the output variable (if it's a function)
|
// Grab width from the output variable (if it's a function)
|
||||||
if (nodep->didWidth()) return;
|
if (nodep->didWidth()) return;
|
||||||
UINFO(5," FTASK "<<nodep<<endl);
|
UINFO(5," FTASK "<<nodep<<endl);
|
||||||
|
|
@ -2238,7 +2238,7 @@ private:
|
||||||
nodep->doingWidth(false);
|
nodep->doingWidth(false);
|
||||||
m_funcp = NULL;
|
m_funcp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstReturn* nodep, AstNUser*) {
|
virtual void visit(AstReturn* nodep) {
|
||||||
// IEEE: Assignment-like context
|
// IEEE: Assignment-like context
|
||||||
assertAtStatement(nodep);
|
assertAtStatement(nodep);
|
||||||
if (!m_funcp) {
|
if (!m_funcp) {
|
||||||
|
|
@ -2256,12 +2256,12 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstFuncRef* nodep, AstNUser*) {
|
virtual void visit(AstFuncRef* nodep) {
|
||||||
visit(nodep->castNodeFTaskRef(), NULL);
|
visit(nodep->castNodeFTaskRef());
|
||||||
nodep->dtypeFrom(nodep->taskp());
|
nodep->dtypeFrom(nodep->taskp());
|
||||||
//if (debug()) nodep->dumpTree(cout," FuncOut: ");
|
//if (debug()) nodep->dumpTree(cout," FuncOut: ");
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTaskRef* nodep, AstNUser*) {
|
virtual void visit(AstNodeFTaskRef* nodep) {
|
||||||
// For arguments, is assignment-like context; see IEEE rules in AstNodeAssign
|
// For arguments, is assignment-like context; see IEEE rules in AstNodeAssign
|
||||||
// Function hasn't been widthed, so make it so.
|
// Function hasn't been widthed, so make it so.
|
||||||
UINFO(5, " FTASKREF "<<nodep<<endl);
|
UINFO(5, " FTASKREF "<<nodep<<endl);
|
||||||
|
|
@ -2344,24 +2344,24 @@ private:
|
||||||
}
|
}
|
||||||
nodep->didWidth(true);
|
nodep->didWidth(true);
|
||||||
}
|
}
|
||||||
virtual void visit(AstInitial* nodep, AstNUser*) {
|
virtual void visit(AstInitial* nodep) {
|
||||||
assertAtStatement(nodep);
|
assertAtStatement(nodep);
|
||||||
m_initialp = nodep;
|
m_initialp = nodep;
|
||||||
userIterateChildren(nodep, NULL);
|
userIterateChildren(nodep, NULL);
|
||||||
m_initialp = NULL;
|
m_initialp = NULL;
|
||||||
}
|
}
|
||||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
virtual void visit(AstNetlist* nodep) {
|
||||||
// Iterate modules backwards, in bottom-up order. That's faster
|
// Iterate modules backwards, in bottom-up order. That's faster
|
||||||
userIterateChildrenBackwards(nodep, NULL);
|
userIterateChildrenBackwards(nodep, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default
|
// Default
|
||||||
virtual void visit(AstNodeMath* nodep, AstNUser*) {
|
virtual void visit(AstNodeMath* nodep) {
|
||||||
nodep->v3fatalSrc("Visit function missing? Widthed function missing for math node: "<<nodep);
|
nodep->v3fatalSrc("Visit function missing? Widthed function missing for math node: "<<nodep);
|
||||||
userIterateChildren(nodep, NULL);
|
userIterateChildren(nodep, NULL);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// Default: Just iterate
|
// Default: Just iterate
|
||||||
if (m_vup) nodep->v3fatalSrc("Visit function missing? Widthed expectation for this node: "<<nodep);
|
if (m_vup) nodep->v3fatalSrc("Visit function missing? Widthed expectation for this node: "<<nodep);
|
||||||
userIterateChildren(nodep, NULL);
|
userIterateChildren(nodep, NULL);
|
||||||
|
|
|
||||||
|
|
@ -37,13 +37,13 @@
|
||||||
class WidthRemoveVisitor : public AstNVisitor {
|
class WidthRemoveVisitor : public AstNVisitor {
|
||||||
private:
|
private:
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstSigned* nodep, AstNUser*) {
|
virtual void visit(AstSigned* nodep) {
|
||||||
replaceWithSignedVersion(nodep, nodep->lhsp()->unlinkFrBack()); VL_DANGLING(nodep);
|
replaceWithSignedVersion(nodep, nodep->lhsp()->unlinkFrBack()); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstUnsigned* nodep, AstNUser*) {
|
virtual void visit(AstUnsigned* nodep) {
|
||||||
replaceWithSignedVersion(nodep, nodep->lhsp()->unlinkFrBack()); VL_DANGLING(nodep);
|
replaceWithSignedVersion(nodep, nodep->lhsp()->unlinkFrBack()); VL_DANGLING(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
}
|
}
|
||||||
void replaceWithSignedVersion(AstNode* nodep, AstNode* newp) {
|
void replaceWithSignedVersion(AstNode* nodep, AstNode* newp) {
|
||||||
|
|
@ -99,7 +99,7 @@ private:
|
||||||
// dtypep() figures into sameTree() results in better optimizations
|
// dtypep() figures into sameTree() results in better optimizations
|
||||||
if (!nodep) return NULL;
|
if (!nodep) return NULL;
|
||||||
// Recurse to handle the data type, as may change the size etc of this type
|
// Recurse to handle the data type, as may change the size etc of this type
|
||||||
if (!nodep->user1()) nodep->accept(*this,NULL);
|
if (!nodep->user1()) nodep->accept(*this);
|
||||||
// Look for duplicate
|
// Look for duplicate
|
||||||
if (AstBasicDType* bdtypep = nodep->castBasicDType()) {
|
if (AstBasicDType* bdtypep = nodep->castBasicDType()) {
|
||||||
AstBasicDType* newp = nodep->findInsertSameDType(bdtypep);
|
AstBasicDType* newp = nodep->findInsertSameDType(bdtypep);
|
||||||
|
|
@ -112,7 +112,7 @@ private:
|
||||||
return nodep;
|
return nodep;
|
||||||
}
|
}
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstConst* nodep, AstNUser*) {
|
virtual void visit(AstConst* nodep) {
|
||||||
if (!nodep->dtypep()) nodep->v3fatalSrc("No dtype");
|
if (!nodep->dtypep()) nodep->v3fatalSrc("No dtype");
|
||||||
nodep->dtypep()->accept(*this); // Do datatype first
|
nodep->dtypep()->accept(*this); // Do datatype first
|
||||||
if (AstConst* newp = newIfConstCommitSize(nodep)) {
|
if (AstConst* newp = newIfConstCommitSize(nodep)) {
|
||||||
|
|
@ -124,15 +124,15 @@ private:
|
||||||
}
|
}
|
||||||
editDType(nodep);
|
editDType(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeDType* nodep, AstNUser*) {
|
virtual void visit(AstNodeDType* nodep) {
|
||||||
visitIterateNodeDType(nodep);
|
visitIterateNodeDType(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeClassDType* nodep, AstNUser*) {
|
virtual void visit(AstNodeClassDType* nodep) {
|
||||||
if (nodep->user1SetOnce()) return; // Process once
|
if (nodep->user1SetOnce()) return; // Process once
|
||||||
visitIterateNodeDType(nodep);
|
visitIterateNodeDType(nodep);
|
||||||
nodep->clearCache();
|
nodep->clearCache();
|
||||||
}
|
}
|
||||||
virtual void visit(AstParamTypeDType* nodep, AstNUser*) {
|
virtual void visit(AstParamTypeDType* nodep) {
|
||||||
if (nodep->user1SetOnce()) return; // Process once
|
if (nodep->user1SetOnce()) return; // Process once
|
||||||
visitIterateNodeDType(nodep);
|
visitIterateNodeDType(nodep);
|
||||||
// Move to type table as all dtype pointers must resolve there
|
// Move to type table as all dtype pointers must resolve there
|
||||||
|
|
@ -150,11 +150,11 @@ private:
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
nodep->virtRefDTypep(editOneDType(nodep->virtRefDTypep()));
|
nodep->virtRefDTypep(editOneDType(nodep->virtRefDTypep()));
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodePreSel* nodep, AstNUser*) {
|
virtual void visit(AstNodePreSel* nodep) {
|
||||||
// This check could go anywhere after V3Param
|
// This check could go anywhere after V3Param
|
||||||
nodep->v3fatalSrc("Presels should have been removed before this point");
|
nodep->v3fatalSrc("Presels should have been removed before this point");
|
||||||
}
|
}
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
nodep->iterateChildren(*this);
|
nodep->iterateChildren(*this);
|
||||||
editDType(nodep);
|
editDType(nodep);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ private:
|
||||||
// VISITORS
|
// VISITORS
|
||||||
// If adding new visitors, insure V3Width's visit(TYPE) calls into here
|
// If adding new visitors, insure V3Width's visit(TYPE) calls into here
|
||||||
|
|
||||||
virtual void visit(AstSelBit* nodep, AstNUser*) {
|
virtual void visit(AstSelBit* nodep) {
|
||||||
// Select of a non-width specified part of an array, i.e. "array[2]"
|
// Select of a non-width specified part of an array, i.e. "array[2]"
|
||||||
// This select style has a lsb and msb (no user specified width)
|
// This select style has a lsb and msb (no user specified width)
|
||||||
UINFO(6,"SELBIT "<<nodep<<endl);
|
UINFO(6,"SELBIT "<<nodep<<endl);
|
||||||
|
|
@ -273,7 +273,7 @@ private:
|
||||||
}
|
}
|
||||||
if (!rhsp->backp()) { pushDeletep(rhsp); VL_DANGLING(rhsp); }
|
if (!rhsp->backp()) { pushDeletep(rhsp); VL_DANGLING(rhsp); }
|
||||||
}
|
}
|
||||||
virtual void visit(AstSelExtract* nodep, AstNUser*) {
|
virtual void visit(AstSelExtract* nodep) {
|
||||||
// Select of a range specified part of an array, i.e. "array[2:3]"
|
// Select of a range specified part of an array, i.e. "array[2:3]"
|
||||||
// SELEXTRACT(from,msb,lsb) -> SEL(from, lsb, 1+msb-lsb)
|
// SELEXTRACT(from,msb,lsb) -> SEL(from, lsb, 1+msb-lsb)
|
||||||
// This select style has a (msb or lsb) and width
|
// This select style has a (msb or lsb) and width
|
||||||
|
|
@ -443,17 +443,17 @@ private:
|
||||||
if (!rhsp->backp()) { pushDeletep(rhsp); VL_DANGLING(rhsp); }
|
if (!rhsp->backp()) { pushDeletep(rhsp); VL_DANGLING(rhsp); }
|
||||||
if (!widthp->backp()) { pushDeletep(widthp); VL_DANGLING(widthp); }
|
if (!widthp->backp()) { pushDeletep(widthp); VL_DANGLING(widthp); }
|
||||||
}
|
}
|
||||||
virtual void visit(AstSelPlus* nodep, AstNUser*) {
|
virtual void visit(AstSelPlus* nodep) {
|
||||||
replaceSelPlusMinus(nodep);
|
replaceSelPlusMinus(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstSelMinus* nodep, AstNUser*) {
|
virtual void visit(AstSelMinus* nodep) {
|
||||||
replaceSelPlusMinus(nodep);
|
replaceSelPlusMinus(nodep);
|
||||||
}
|
}
|
||||||
// If adding new visitors, insure V3Width's visit(TYPE) calls into here
|
// If adding new visitors, insure V3Width's visit(TYPE) calls into here
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
// Default
|
// Default
|
||||||
virtual void visit(AstNode* nodep, AstNUser*) {
|
virtual void visit(AstNode* nodep) {
|
||||||
// See notes above; we never iterate
|
// See notes above; we never iterate
|
||||||
nodep->v3fatalSrc("Shouldn't iterate in V3WidthSel");
|
nodep->v3fatalSrc("Shouldn't iterate in V3WidthSel");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -226,9 +226,9 @@ sub write_visitor {
|
||||||
foreach my $type (sort (keys %Classes)) {
|
foreach my $type (sort (keys %Classes)) {
|
||||||
my $base = $Classes{$type};
|
my $base = $Classes{$type};
|
||||||
if ($base) {
|
if ($base) {
|
||||||
printf $fh " virtual void visit(Ast${type}* nodep, AstNUser* vup) { visit((Ast${base}*)(nodep),vup); }\n";
|
printf $fh " virtual void visit(Ast${type}* nodep) { visit((Ast${base}*)(nodep)); }\n";
|
||||||
} else {
|
} else {
|
||||||
printf $fh " virtual void visit(Ast${type}*, AstNUser*) = 0;\n";
|
printf $fh " virtual void visit(Ast${type}*) = 0;\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$fh->close();
|
$fh->close();
|
||||||
|
|
@ -596,7 +596,7 @@ sub tree_base {
|
||||||
# saves one comparison.
|
# saves one comparison.
|
||||||
if ($out_for_type_sc[0]) { # Short-circuited types
|
if ($out_for_type_sc[0]) { # Short-circuited types
|
||||||
$self->print(" // Generated by astgen with short-circuiting\n",
|
$self->print(" // Generated by astgen with short-circuiting\n",
|
||||||
" virtual void visit(Ast${type}* nodep, AstNUser*) {\n",
|
" virtual void visit(Ast${type}* nodep) {\n",
|
||||||
" nodep->lhsp()->iterateAndNext(*this);\n",
|
" nodep->lhsp()->iterateAndNext(*this);\n",
|
||||||
@out_for_type_sc);
|
@out_for_type_sc);
|
||||||
$self->print(" nodep->rhsp()->iterateAndNext(*this);\n",
|
$self->print(" nodep->rhsp()->iterateAndNext(*this);\n",
|
||||||
|
|
@ -608,7 +608,7 @@ sub tree_base {
|
||||||
my $skip = $self->{tree_skip_visit}{$type};
|
my $skip = $self->{tree_skip_visit}{$type};
|
||||||
my $gen = $skip ? "Gen" : "";
|
my $gen = $skip ? "Gen" : "";
|
||||||
$self->print(" // Generated by astgen\n",
|
$self->print(" // Generated by astgen\n",
|
||||||
" virtual void visit$gen(Ast${type}* nodep, AstNUser*) {\n",
|
" virtual void visit$gen(Ast${type}* nodep) {\n",
|
||||||
($skip?"":
|
($skip?"":
|
||||||
" nodep->iterateChildren(*this);\n"),
|
" nodep->iterateChildren(*this);\n"),
|
||||||
@out_for_type,
|
@out_for_type,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue