diff --git a/src/V3Ast.h b/src/V3Ast.h index f3dda1661..5917f1724 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -26,6 +26,7 @@ #include "verilatedos.h" #include "V3Error.h" #include "V3Number.h" +#include "V3Global.h" #include #include diff --git a/src/V3Global.h b/src/V3Global.h index 21e47816b..16e2139ed 100644 --- a/src/V3Global.h +++ b/src/V3Global.h @@ -29,7 +29,8 @@ #include "V3Error.h" #include "V3Options.h" -#include "V3Ast.h" + +class AstNetlist; //====================================================================== // Statics @@ -54,23 +55,22 @@ public: public: // CREATORS V3Global() { - m_rootp = new AstNetlist; m_debugFileNumber = 0; m_assertWidthsSame = false; m_needHInlines = false; m_needHeavy = false; m_dpi = false; + m_rootp = makeNetlist(); } - void clear() { - if (m_rootp) m_rootp->deleteTree(); m_rootp=NULL; - } + AstNetlist* makeNetlist(); + void clear(); // ACCESSORS (general) AstNetlist* rootp() const { return m_rootp; } bool assertWidthsSame() const { return m_assertWidthsSame; } // METHODS void readFiles(); - void checkTree() { rootp()->checkTree(); } + void checkTree(); void assertWidthsSame(bool flag) { m_assertWidthsSame = flag; } string debugFilename(const string& nameComment, int newNumber=0) { ++m_debugFileNumber; diff --git a/src/V3Graph.h b/src/V3Graph.h index b91827b8f..548720951 100644 --- a/src/V3Graph.h +++ b/src/V3Graph.h @@ -26,6 +26,7 @@ #include "verilatedos.h" #include "V3Error.h" #include "V3List.h" +#include "V3Ast.h" #include #include diff --git a/src/V3SymTable.h b/src/V3SymTable.h index 1775a31a1..acf792678 100644 --- a/src/V3SymTable.h +++ b/src/V3SymTable.h @@ -32,6 +32,7 @@ #include #include "V3Global.h" +#include "V3Ast.h" //###################################################################### // Symbol table diff --git a/src/Verilator.cpp b/src/Verilator.cpp index 13ab8bdaa..e27e13401 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -94,6 +94,13 @@ V3Global v3Global; //###################################################################### // V3 Class -- top level +AstNetlist* V3Global::makeNetlist() { return new AstNetlist(); } +void V3Global::checkTree() { rootp()->checkTree(); } + +void V3Global::clear() { + if (m_rootp) m_rootp->deleteTree(); m_rootp=NULL; +} + void V3Global::readFiles() { // NODE STATE // AstNode::user4p() // V3SymTable* Package and typedef symbol names