From 268f0544be9b60afc0ce6b40958f7ff853838736 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Tue, 29 Aug 2006 19:10:55 +0000 Subject: [PATCH] Cast as scope always under topscopes - no func change git-svn-id: file://localhost/svn/verilator/trunk/verilator@765 77ca24e4-aefa-0310-84f0-b9a241c72d87 --- src/V3AstNodes.h | 2 +- src/V3Changed.cpp | 2 +- src/V3Clock.cpp | 2 +- src/V3GenClk.cpp | 2 +- src/V3Life.cpp | 2 +- src/V3Order.cpp | 2 +- src/V3Trace.cpp | 2 +- src/V3TraceDecl.cpp | 2 +- src/V3Width.cpp | 1 + 9 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index 045b052ef..7a971846f 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -450,7 +450,7 @@ public: virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); } AstNode* stmtsp() const { return op1p()->castNode(); } void addStmtsp(AstNode* nodep) { addOp1p(nodep); } - AstNode* scopep() const { return op2p()->castNode(); } // op1 = AstVarScope's + AstScope* scopep() const { return op2p()->castScope(); } // op1 = AstVarScope's }; struct AstVarScope : public AstNode { diff --git a/src/V3Changed.cpp b/src/V3Changed.cpp index eb9da355e..ea52a0678 100644 --- a/src/V3Changed.cpp +++ b/src/V3Changed.cpp @@ -101,7 +101,7 @@ private: // Clearing AstNode::userClearTree(); // Create the change detection function - AstScope* scopep = nodep->scopep()->castScope(); + AstScope* scopep = nodep->scopep(); if (!scopep) nodep->v3fatalSrc("No scope found on top level, perhaps you have no statements?\n"); m_scopetopp = scopep; // Create change detection function diff --git a/src/V3Clock.cpp b/src/V3Clock.cpp index f11179c6c..251c6625f 100644 --- a/src/V3Clock.cpp +++ b/src/V3Clock.cpp @@ -180,7 +180,7 @@ private: virtual void visit(AstTopScope* nodep, AstNUser*) { UINFO(4," TOPSCOPE "<scopep()->castScope(); + m_scopep = nodep->scopep(); if (!m_scopep) nodep->v3fatalSrc("No scope found on top level, perhaps you have no statements?\n"); //VV***** We reset all userp() AstNode::userClearTree(); diff --git a/src/V3GenClk.cpp b/src/V3GenClk.cpp index 92048f3a4..15c00159b 100644 --- a/src/V3GenClk.cpp +++ b/src/V3GenClk.cpp @@ -84,7 +84,7 @@ private: virtual void visit(AstTopScope* nodep, AstNUser*) { AstNode::user2ClearTree(); // userp() used on entire tree - AstScope* scopep = nodep->scopep()->castScope(); + AstScope* scopep = nodep->scopep(); if (!scopep) nodep->v3fatalSrc("No scope found on top level"); m_scopetopp = scopep; diff --git a/src/V3Life.cpp b/src/V3Life.cpp index 11f4c8195..b14a6c220 100644 --- a/src/V3Life.cpp +++ b/src/V3Life.cpp @@ -169,7 +169,7 @@ private: AstNode::user3ClearTree(); // userp() used on entire tree AstNode::user4ClearTree(); // userp() used on entire tree - AstScope* scopep = nodep->scopep()->castScope(); + AstScope* scopep = nodep->scopep(); if (!scopep) nodep->v3fatalSrc("TopScope has no scope\n"); AstCFunc* evalp = NULL; for (AstNode* searchp = scopep->blocksp(); searchp; searchp=searchp->nextp()) { diff --git a/src/V3Order.cpp b/src/V3Order.cpp index 5badf3706..ee63febc5 100644 --- a/src/V3Order.cpp +++ b/src/V3Order.cpp @@ -410,7 +410,7 @@ private: m_graph.clear(); m_activep = NULL; m_topScopep = nodep; - m_scopetopp = nodep->scopep()->castScope(); + m_scopetopp = nodep->scopep(); // Find sentree's m_finder.main(m_topScopep); // ProcessDomainsIterate will use these when it needs to move diff --git a/src/V3Trace.cpp b/src/V3Trace.cpp index 101c8e1c7..1a4da82b8 100644 --- a/src/V3Trace.cpp +++ b/src/V3Trace.cpp @@ -522,7 +522,7 @@ private: nodep->iterateChildren(*this); } virtual void visit(AstTopScope* nodep, AstNUser*) { - AstScope* scopep = nodep->scopep()->castScope(); + AstScope* scopep = nodep->scopep(); if (!scopep) nodep->v3fatalSrc("No scope found on top level"); m_highScopep = scopep; nodep->iterateChildren(*this); diff --git a/src/V3TraceDecl.cpp b/src/V3TraceDecl.cpp index 94502e675..fd4f23aaf 100644 --- a/src/V3TraceDecl.cpp +++ b/src/V3TraceDecl.cpp @@ -71,7 +71,7 @@ private: // VISITORS virtual void visit(AstTopScope* nodep, AstNUser*) { - m_scopetopp = nodep->scopep()->castScope(); + m_scopetopp = nodep->scopep(); // The container for m_traceFuncp must be made first { AstCFunc* funcp = new AstCFunc(nodep->fileline(), "traceInitThis", m_scopetopp); diff --git a/src/V3Width.cpp b/src/V3Width.cpp index b97c1fc13..32a102ed3 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -643,6 +643,7 @@ private: } virtual void visit(AstNodeFTaskRef* nodep, AstNUser* vup) { // Function hasn't been widthed, so make it so. + if (!nodep->taskp()) nodep->v3fatalSrc("Unlinked"); if (nodep->taskp()->width()==0) { if (m_taskDepth > 100) { nodep->v3error("Unsupported: Recursive function or task call\n");