Internals: Create AstNodeModule in prep for packages
This commit is contained in:
parent
377f194837
commit
e0bca07e06
|
|
@ -72,7 +72,7 @@ private:
|
|||
nodep->iterateChildren(*this);
|
||||
m_topscopep = NULL;
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
// Create required actives and add to module
|
||||
// We can start ordering at a module, or a scope
|
||||
UINFO(4," MOD "<<nodep<<endl);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ private:
|
|||
AstUser1InUse m_inuser1;
|
||||
|
||||
// STATE
|
||||
AstModule* m_modp; // Last module
|
||||
AstNodeModule* m_modp; // Last module
|
||||
AstBegin* m_beginp; // Last begin
|
||||
V3Double0 m_statAsCover; // Statistic tracking
|
||||
V3Double0 m_statAsPsl; // Statistic tracking
|
||||
|
|
@ -257,7 +257,7 @@ private:
|
|||
m_statAsSV++;
|
||||
}
|
||||
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
m_modp = nodep;
|
||||
//
|
||||
nodep->iterateChildren(*this);
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ private:
|
|||
nodep->replaceWith(blockp);
|
||||
pushDeletep(nodep); nodep=NULL;
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
nodep->iterateChildren(*this);
|
||||
// Reset defaults
|
||||
m_seniDefaultp = NULL;
|
||||
|
|
|
|||
43
src/V3Ast.h
43
src/V3Ast.h
|
|
@ -1272,6 +1272,49 @@ public:
|
|||
void addPinsp(AstNode* nodep) { addOp2p(nodep); }
|
||||
};
|
||||
|
||||
struct AstNodeModule : public AstNode {
|
||||
// A module, package, program or interface declaration;
|
||||
// something that can live directly under the TOP,
|
||||
// excluding $unit package stuff
|
||||
private:
|
||||
string m_name; // Name of the module
|
||||
string m_origName; // Name of the module, ignoring name() changes, for dot lookup
|
||||
bool m_modPublic:1; // Module has public references
|
||||
bool m_modTrace:1; // Tracing this module
|
||||
bool m_inLibrary:1; // From a library, no error if not used, never top level
|
||||
int m_level; // 1=top module, 2=cell off top module, ...
|
||||
int m_varNum; // Incrementing variable number
|
||||
public:
|
||||
AstNodeModule(FileLine* fl, const string& name)
|
||||
: AstNode (fl)
|
||||
,m_name(name), m_origName(name)
|
||||
,m_modPublic(false), m_modTrace(false), m_inLibrary(false)
|
||||
,m_level(0), m_varNum(0) { }
|
||||
ASTNODE_BASE_FUNCS(NodeModule)
|
||||
virtual void dump(ostream& str);
|
||||
virtual bool maybePointedTo() const { return true; }
|
||||
virtual string name() const { return m_name; }
|
||||
AstNode* stmtsp() const { return op2p()->castNode(); } // op2 = List of statements
|
||||
AstActive* activesp() const { return op3p()->castActive(); } // op3 = List of i/sblocks
|
||||
// METHODS
|
||||
void addInlinesp(AstNode* nodep) { addOp1p(nodep); }
|
||||
void addStmtp(AstNode* nodep) { addOp2p(nodep); }
|
||||
void addActivep(AstNode* nodep) { addOp3p(nodep); }
|
||||
// ACCESSORS
|
||||
virtual void name(const string& name) { m_name = name; }
|
||||
string origName() const { return m_origName; }
|
||||
bool inLibrary() const { return m_inLibrary; }
|
||||
void inLibrary(bool flag) { m_inLibrary = flag; }
|
||||
void level(int level) { m_level = level; }
|
||||
int level() const { return m_level; }
|
||||
bool isTop() const { return level()==1; }
|
||||
int varNumGetInc() { return ++m_varNum; }
|
||||
void modPublic(bool flag) { m_modPublic = flag; }
|
||||
bool modPublic() const { return m_modPublic; }
|
||||
void modTrace(bool flag) { m_modTrace = flag; }
|
||||
bool modTrace() const { return m_modTrace; }
|
||||
};
|
||||
|
||||
//######################################################################
|
||||
|
||||
#include "V3AstNodes.h"
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ bool AstScope::broken() const {
|
|||
void AstScope::cloneRelink() {
|
||||
if (m_aboveScopep && m_aboveScopep->clonep()) m_aboveScopep->clonep()->castScope();
|
||||
if (m_aboveCellp && m_aboveCellp->clonep()) m_aboveCellp->clonep()->castCell();
|
||||
if (m_modp && ((AstNode*)m_modp)->clonep()) ((AstNode*)m_modp)->clonep()->castModule();
|
||||
if (m_modp && ((AstNode*)m_modp)->clonep()) ((AstNode*)m_modp)->clonep()->castNodeModule();
|
||||
}
|
||||
|
||||
string AstScope::nameDotless() const {
|
||||
|
|
@ -397,7 +397,7 @@ void AstVarXRef::dump(ostream& str) {
|
|||
else if (varp()) { varp()->dump(str); }
|
||||
else { str<<"UNLINKED"; }
|
||||
}
|
||||
void AstModule::dump(ostream& str) {
|
||||
void AstNodeModule::dump(ostream& str) {
|
||||
this->AstNode::dump(str);
|
||||
str<<" L"<<level();
|
||||
if (modPublic()) str<<" [P]";
|
||||
|
|
|
|||
|
|
@ -594,9 +594,9 @@ private:
|
|||
string m_name; // Name
|
||||
AstScope* m_aboveScopep; // Scope above this one in the hierarchy (NULL if top)
|
||||
AstCell* m_aboveCellp; // Cell above this in the hierarchy (NULL if top)
|
||||
AstModule* m_modp; // Module scope corresponds to
|
||||
AstNodeModule* m_modp; // Module scope corresponds to
|
||||
public:
|
||||
AstScope(FileLine* fl, AstModule* modp, const string& name,
|
||||
AstScope(FileLine* fl, AstNodeModule* modp, const string& name,
|
||||
AstScope* aboveScopep, AstCell* aboveCellp)
|
||||
:AstNode(fl)
|
||||
,m_name(name) ,m_aboveScopep(aboveScopep) ,m_aboveCellp(aboveCellp), m_modp(modp) {}
|
||||
|
|
@ -608,7 +608,7 @@ public:
|
|||
virtual void name(const string& name) { m_name = name; }
|
||||
string nameDotless() const;
|
||||
string nameVlSym() const { return (((string)"vlSymsp->") + nameDotless()); }
|
||||
AstModule* modp() const { return m_modp; }
|
||||
AstNodeModule* modp() const { return m_modp; }
|
||||
void addVarp(AstNode* nodep) { addOp1p(nodep); }
|
||||
AstNode* varsp() const { return op1p()->castNode(); } // op1 = AstVarScope's
|
||||
void addActivep(AstNode* nodep) { addOp2p(nodep); }
|
||||
|
|
@ -756,54 +756,20 @@ public:
|
|||
void svImplicit(bool flag) { m_svImplicit=flag; }
|
||||
};
|
||||
|
||||
struct AstModule : public AstNode {
|
||||
struct AstModule : public AstNodeModule {
|
||||
// A module declaration
|
||||
private:
|
||||
string m_name; // Name of the module
|
||||
string m_origName; // Name of the module, ignoring name() changes, for dot lookup
|
||||
bool m_modPublic:1; // Module has public references
|
||||
bool m_modTrace:1; // Tracing this module
|
||||
bool m_inLibrary:1; // From a library, no error if not used, never top level
|
||||
int m_level; // 1=top module, 2=cell off top module, ...
|
||||
int m_varNum; // Incrementing variable number
|
||||
public:
|
||||
AstModule(FileLine* fl, const string& name)
|
||||
: AstNode (fl)
|
||||
,m_name(name), m_origName(name)
|
||||
,m_modPublic(false), m_modTrace(false), m_inLibrary(false)
|
||||
,m_level(0), m_varNum(0) { }
|
||||
: AstNodeModule (fl,name) {}
|
||||
ASTNODE_NODE_FUNCS(Module, MODULE)
|
||||
virtual void dump(ostream& str);
|
||||
virtual bool maybePointedTo() const { return true; }
|
||||
virtual string name() const { return m_name; }
|
||||
AstNode* stmtsp() const { return op2p()->castNode(); } // op2 = List of statements
|
||||
AstActive* activesp() const { return op3p()->castActive(); } // op3 = List of i/sblocks
|
||||
// METHODS
|
||||
void addInlinesp(AstNode* nodep) { addOp1p(nodep); }
|
||||
void addStmtp(AstNode* nodep) { addOp2p(nodep); }
|
||||
void addActivep(AstNode* nodep) { addOp3p(nodep); }
|
||||
// ACCESSORS
|
||||
virtual void name(const string& name) { m_name = name; }
|
||||
string origName() const { return m_origName; }
|
||||
bool inLibrary() const { return m_inLibrary; }
|
||||
void inLibrary(bool flag) { m_inLibrary = flag; }
|
||||
void level(int level) { m_level = level; }
|
||||
int level() const { return m_level; }
|
||||
bool isTop() const { return level()==1; }
|
||||
int varNumGetInc() { return ++m_varNum; }
|
||||
void modPublic(bool flag) { m_modPublic = flag; }
|
||||
bool modPublic() const { return m_modPublic; }
|
||||
void modTrace(bool flag) { m_modTrace = flag; }
|
||||
bool modTrace() const { return m_modTrace; }
|
||||
};
|
||||
|
||||
struct AstCell : public AstNode {
|
||||
// A instantiation cell
|
||||
// A instantiation cell or interface call (don't know which until link)
|
||||
private:
|
||||
string m_name; // Cell name
|
||||
string m_origName; // Original name before dot addition
|
||||
string m_modName; // Module the cell instances
|
||||
AstModule* m_modp; // [AfterLink] Pointer to module instanced
|
||||
AstNodeModule* m_modp; // [AfterLink] Pointer to module instanced
|
||||
public:
|
||||
AstCell(FileLine* fl, const string& instName, const string& modName,
|
||||
AstPin* pinsp, AstPin* paramsp, AstRange* rangep)
|
||||
|
|
@ -826,10 +792,10 @@ public:
|
|||
AstPin* pinsp() const { return op1p()->castPin(); } // op1 = List of cell ports
|
||||
AstPin* paramsp() const { return op2p()->castPin(); } // op2 = List of parameter #(##) values
|
||||
AstRange* rangep() const { return op3p()->castRange(); } // op3 = Range of arrayed instants (NULL=not ranged)
|
||||
AstModule* modp() const { return m_modp; } // [AfterLink] = Pointer to module instantiated
|
||||
AstNodeModule* modp() const { return m_modp; } // [AfterLink] = Pointer to module instantiated
|
||||
void addPinsp(AstPin* nodep) { addOp1p(nodep); }
|
||||
void addParamsp(AstPin* nodep) { addOp2p(nodep); }
|
||||
void modp(AstModule* nodep) { m_modp = nodep; }
|
||||
void modp(AstNodeModule* nodep) { m_modp = nodep; }
|
||||
};
|
||||
|
||||
struct AstCellInline : public AstNode {
|
||||
|
|
@ -3098,18 +3064,18 @@ struct AstCInclude : public AstNode {
|
|||
// Parents: MODULE
|
||||
// Children: None
|
||||
private:
|
||||
AstModule* m_modp;
|
||||
AstNodeModule* m_modp;
|
||||
public:
|
||||
AstCInclude(FileLine* fl, AstModule* modp)
|
||||
AstCInclude(FileLine* fl, AstNodeModule* modp)
|
||||
: AstNode(fl) {
|
||||
m_modp = modp;
|
||||
}
|
||||
ASTNODE_NODE_FUNCS(CInclude, CINCLUDE)
|
||||
virtual bool broken() const { return (m_modp && !m_modp->brokeExists()); }
|
||||
virtual void cloneRelink() { if (m_modp && m_modp->clonep()) {
|
||||
m_modp = m_modp->clonep()->castModule();
|
||||
m_modp = m_modp->clonep()->castNodeModule();
|
||||
}}
|
||||
AstModule* modp() const { return m_modp; }
|
||||
AstNodeModule* modp() const { return m_modp; }
|
||||
};
|
||||
|
||||
struct AstCMath : public AstNodeMath {
|
||||
|
|
@ -3163,9 +3129,9 @@ struct AstNetlist : public AstNode {
|
|||
// Children: MODULEs & CFILEs
|
||||
AstNetlist() : AstNode(new FileLine("AstRoot",0)) {}
|
||||
ASTNODE_NODE_FUNCS(Netlist, NETLIST)
|
||||
AstModule* modulesp() const { return op1p()->castModule();} // op1 = List of modules
|
||||
AstModule* topModulep() const { return op1p()->castModule(); } // * = Top module in hierarchy (first one added, for now)
|
||||
void addModulep(AstModule* modulep) { addOp1p(modulep); }
|
||||
AstNodeModule* modulesp() const { return op1p()->castNodeModule();} // op1 = List of modules
|
||||
AstNodeModule* topModulep() const { return op1p()->castNodeModule(); } // * = Top module in hierarchy (first one added, for now)
|
||||
void addModulep(AstNodeModule* modulep) { addOp1p(modulep); }
|
||||
AstCFile* filesp() const { return op2p()->castCFile();} // op2 = List of files
|
||||
void addFilesp(AstCFile* filep) { addOp2p(filep); }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
class BeginVisitor : public AstNVisitor {
|
||||
private:
|
||||
// STATE
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstNodeFTask* m_ftaskp; // Current function/task
|
||||
string m_namedScope; // Name of begin blocks above us
|
||||
string m_unnamedScope; // Name of begin blocks, including unnamed blocks
|
||||
|
|
@ -62,7 +62,7 @@ private:
|
|||
}
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
m_modp = nodep;
|
||||
m_repeatNum = 0;
|
||||
nodep->iterateChildren(*this);
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ private:
|
|||
AstUser1InUse m_inuser1;
|
||||
|
||||
// STATE
|
||||
AstModule* m_topModp; // Top module
|
||||
AstNodeModule* m_topModp; // Top module
|
||||
AstScope* m_scopetopp; // Scope under TOPSCOPE
|
||||
AstCFunc* m_chgFuncp; // Change function we're building
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ private:
|
|||
}
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
UINFO(4," MOD "<<nodep<<endl);
|
||||
if (nodep->isTop()) {
|
||||
m_topModp = nodep;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ private:
|
|||
enum CleanState { UNKNOWN, CLEAN, DIRTY };
|
||||
|
||||
// STATE
|
||||
AstModule* m_modp;
|
||||
AstNodeModule* m_modp;
|
||||
|
||||
// METHODS
|
||||
static int debug() {
|
||||
|
|
@ -160,7 +160,7 @@ private:
|
|||
}
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
m_modp = NULL;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ private:
|
|||
enum { DOUBLE_OR_RATE = 10 }; // How many | per ||, Determined experimentally as best
|
||||
|
||||
// STATE
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstTopScope* m_topScopep; // Current top scope
|
||||
AstScope* m_scopep; // Current scope
|
||||
AstActive* m_activep; // Current block
|
||||
|
|
@ -258,7 +258,7 @@ private:
|
|||
m_topScopep=NULL;
|
||||
m_scopep = NULL;
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
//UINFO(4," MOD "<<nodep<<endl);
|
||||
m_modp = nodep;
|
||||
m_stableNum = 0;
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ private:
|
|||
typedef enum {STATE_IDLE, STATE_HASH, STATE_DUP} CombineState;
|
||||
V3Double0 m_statCombs; // Statistic tracking
|
||||
CombineState m_state; // Major state
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstCFunc* m_funcp; // Current function
|
||||
V3Hash m_lowerHash; // Hash of the statement we're building
|
||||
CombCallVisitor m_call; // Tracking of function call users
|
||||
|
|
@ -393,7 +393,7 @@ private:
|
|||
// Required so that a module instantiating another can benefit from collapsing.
|
||||
nodep->iterateChildrenBackwards(*this);
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
UINFO(4," MOD "<<nodep<<endl);
|
||||
m_modp = nodep;
|
||||
m_modNFuncs = 0;
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ private:
|
|||
bool m_warn; // Output warnings
|
||||
bool m_cpp; // C++ conversions only
|
||||
bool m_expensive; // Enable computationally expensive optimizations
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstNode* m_scopep; // Current scope
|
||||
|
||||
// METHODS
|
||||
|
|
@ -866,7 +866,7 @@ private:
|
|||
// Iterate modules backwards, in bottom-up order. That's faster
|
||||
nodep->iterateChildrenBackwards(*this);
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
m_modp = NULL;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ private:
|
|||
|
||||
// STATE
|
||||
bool m_checkBlock; // Should this block get covered?
|
||||
AstModule* m_modp; // Current module to add statement to
|
||||
AstNodeModule* m_modp; // Current module to add statement to
|
||||
bool m_inToggleOff; // In function/task etc
|
||||
FileMap m_fileps; // Column counts for each fileline
|
||||
string m_beginHier; // AstBegin hier name for user coverage points
|
||||
|
|
@ -121,7 +121,7 @@ private:
|
|||
}
|
||||
|
||||
// VISITORS - BOTH
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
m_modp = nodep;
|
||||
m_fileps.clear();
|
||||
nodep->iterateChildren(*this);
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ private:
|
|||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
DeadModVisitor(AstModule* nodep) {
|
||||
DeadModVisitor(AstNodeModule* nodep) {
|
||||
nodep->accept(*this);
|
||||
}
|
||||
virtual ~DeadModVisitor() {}
|
||||
|
|
@ -68,7 +68,7 @@ class DeadVisitor : public AstNVisitor {
|
|||
private:
|
||||
// NODE STATE
|
||||
// Entire Netlist:
|
||||
// AstModule::user() -> int. Count of number of cells referencing this module.
|
||||
// AstNodeModule::user() -> int. Count of number of cells referencing this module.
|
||||
// AstVar::user() -> int. Count of number of references
|
||||
// AstVarScope::user() -> int. Count of number of references
|
||||
AstUser1InUse m_inuser1;
|
||||
|
|
@ -145,9 +145,9 @@ private:
|
|||
// after we've done all the generate blocks
|
||||
for (bool retry=true; retry; ) {
|
||||
retry=false;
|
||||
AstModule* nextmodp;
|
||||
for (AstModule* modp = v3Global.rootp()->modulesp(); modp; modp=nextmodp) {
|
||||
nextmodp = modp->nextp()->castModule();
|
||||
AstNodeModule* nextmodp;
|
||||
for (AstNodeModule* modp = v3Global.rootp()->modulesp(); modp; modp=nextmodp) {
|
||||
nextmodp = modp->nextp()->castNodeModule();
|
||||
if (modp->level()>2 && modp->user1()==0) {
|
||||
// > 2 because L1 is the wrapper, L2 is the top user module
|
||||
UINFO(4," Dead module "<<modp<<endl);
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ private:
|
|||
bool m_inDly; // True in delayed assignments
|
||||
bool m_inLoop; // True in for loops
|
||||
bool m_inInitial; // True in intial blocks
|
||||
typedef std::map<pair<AstModule*,string>,AstVar*> VarMap;
|
||||
typedef std::map<pair<AstNodeModule*,string>,AstVar*> VarMap;
|
||||
VarMap m_modVarMap; // Table of new var names created under module
|
||||
V3Double0 m_statSharedSet;// Statistic tracking
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ private:
|
|||
// Because we've already scoped it, we may need to add both the AstVar and the AstVarScope
|
||||
if (!oldvarscp->scopep()) oldvarscp->v3fatalSrc("Var unscoped");
|
||||
AstVar* varp;
|
||||
AstModule* addmodp = oldvarscp->scopep()->modp();
|
||||
AstNodeModule* addmodp = oldvarscp->scopep()->modp();
|
||||
// We need a new AstVar, but only one for all scopes, to match the new AstVarScope
|
||||
VarMap::iterator iter = m_modVarMap.find(make_pair(addmodp,name));
|
||||
if (iter != m_modVarMap.end()) {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ private:
|
|||
// NODE STATE
|
||||
|
||||
// STATE
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstCFunc* m_funcp; // Current block
|
||||
AstNode* m_stmtp; // Current statement
|
||||
int m_depth; // How deep in an expression
|
||||
|
|
@ -85,7 +85,7 @@ private:
|
|||
}
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
UINFO(4," MOD "<<nodep<<endl);
|
||||
m_modp = nodep;
|
||||
m_funcp = NULL;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ private:
|
|||
// NODE STATE
|
||||
|
||||
// STATE
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstCFunc* m_funcp; // Current function
|
||||
int m_depth; // How deep in an expression
|
||||
int m_deepNum; // How many functions made
|
||||
|
|
@ -77,7 +77,7 @@ private:
|
|||
}
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
UINFO(4," MOD "<<nodep<<endl);
|
||||
m_modp = nodep;
|
||||
m_deepNum = 0;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ private:
|
|||
typedef multimap<string,AstCFunc*> FuncMmap;
|
||||
|
||||
// STATE
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstScope* m_scopep; // Current scope
|
||||
bool m_needThis; // Add thisp to function
|
||||
FuncMmap m_modFuncs; // Name of public functions added
|
||||
|
|
@ -179,7 +179,7 @@ private:
|
|||
}
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
m_modp = nodep;
|
||||
m_modFuncs.clear();
|
||||
nodep->iterateChildren(*this);
|
||||
|
|
|
|||
|
|
@ -551,7 +551,7 @@ public:
|
|||
|
||||
class EmitCImp : EmitCStmts {
|
||||
// MEMBERS
|
||||
AstModule* m_modp;
|
||||
AstNodeModule* m_modp;
|
||||
vector<AstChangeDet*> m_blkChangeDetVec; // All encountered changes in block
|
||||
bool m_slow; // Creating __Slow file
|
||||
bool m_fast; // Creating non __Slow file (or both)
|
||||
|
|
@ -592,7 +592,7 @@ class EmitCImp : EmitCStmts {
|
|||
}
|
||||
}
|
||||
|
||||
V3OutCFile* newOutCFile(AstModule* modp, bool slow, bool source, int filenum=0) {
|
||||
V3OutCFile* newOutCFile(AstNodeModule* modp, bool slow, bool source, int filenum=0) {
|
||||
string filenameNoExt = v3Global.opt.makeDir()+"/"+ modClassName(modp);
|
||||
if (filenum) filenameNoExt += "__"+cvtToStr(filenum);
|
||||
filenameNoExt += (slow ? "__Slow":"");
|
||||
|
|
@ -722,22 +722,22 @@ class EmitCImp : EmitCStmts {
|
|||
|
||||
// METHODS
|
||||
// Low level
|
||||
void emitVarResets(AstModule* modp);
|
||||
void emitCellCtors(AstModule* modp);
|
||||
void emitVarResets(AstNodeModule* modp);
|
||||
void emitCellCtors(AstNodeModule* modp);
|
||||
void emitSensitives();
|
||||
// Medium level
|
||||
void emitCtorImp(AstModule* modp);
|
||||
void emitConfigureImp(AstModule* modp);
|
||||
void emitCoverageDecl(AstModule* modp);
|
||||
void emitCoverageImp(AstModule* modp);
|
||||
void emitDestructorImp(AstModule* modp);
|
||||
void emitCtorImp(AstNodeModule* modp);
|
||||
void emitConfigureImp(AstNodeModule* modp);
|
||||
void emitCoverageDecl(AstNodeModule* modp);
|
||||
void emitCoverageImp(AstNodeModule* modp);
|
||||
void emitDestructorImp(AstNodeModule* modp);
|
||||
void emitTextSection(AstType type);
|
||||
void emitIntFuncDecls(AstModule* modp);
|
||||
void emitIntFuncDecls(AstNodeModule* modp);
|
||||
// High level
|
||||
void emitImp(AstModule* modp);
|
||||
void emitStaticDecl(AstModule* modp);
|
||||
void emitWrapEval(AstModule* modp);
|
||||
void emitInt(AstModule* modp);
|
||||
void emitImp(AstNodeModule* modp);
|
||||
void emitStaticDecl(AstNodeModule* modp);
|
||||
void emitWrapEval(AstNodeModule* modp);
|
||||
void emitInt(AstNodeModule* modp);
|
||||
void writeMakefile(string filename);
|
||||
|
||||
public:
|
||||
|
|
@ -745,7 +745,7 @@ public:
|
|||
m_modp = NULL;
|
||||
}
|
||||
virtual ~EmitCImp() {}
|
||||
void main(AstModule* modp, bool slow, bool fast);
|
||||
void main(AstNodeModule* modp, bool slow, bool fast);
|
||||
void mainDoFunc(AstCFunc* nodep) {
|
||||
nodep->accept(*this);
|
||||
}
|
||||
|
|
@ -1141,7 +1141,7 @@ void EmitCStmts::displayNode(AstNode* nodep, const string& vformat, AstNode* exp
|
|||
//######################################################################
|
||||
// Internal EmitC
|
||||
|
||||
void EmitCImp::emitVarResets(AstModule* modp) {
|
||||
void EmitCImp::emitVarResets(AstNodeModule* modp) {
|
||||
puts("// Reset internal values\n");
|
||||
if (modp->isTop()) {
|
||||
if (v3Global.opt.inhibitSim()) puts("__Vm_inhibitSim = false;\n");
|
||||
|
|
@ -1214,7 +1214,7 @@ void EmitCImp::emitVarResets(AstModule* modp) {
|
|||
}
|
||||
}
|
||||
|
||||
void EmitCImp::emitCoverageDecl(AstModule* modp) {
|
||||
void EmitCImp::emitCoverageDecl(AstNodeModule* modp) {
|
||||
if (v3Global.opt.coverage()) {
|
||||
ofp()->putsPrivate(true);
|
||||
puts("// Coverage\n");
|
||||
|
|
@ -1223,7 +1223,7 @@ void EmitCImp::emitCoverageDecl(AstModule* modp) {
|
|||
}
|
||||
}
|
||||
|
||||
void EmitCImp::emitCtorImp(AstModule* modp) {
|
||||
void EmitCImp::emitCtorImp(AstNodeModule* modp) {
|
||||
puts("\n");
|
||||
if (optSystemPerl() && modp->isTop()) {
|
||||
puts("SP_CTOR_IMP("+modClassName(modp)+")");
|
||||
|
|
@ -1243,7 +1243,7 @@ void EmitCImp::emitCtorImp(AstModule* modp) {
|
|||
puts("}\n");
|
||||
}
|
||||
|
||||
void EmitCImp::emitConfigureImp(AstModule* modp) {
|
||||
void EmitCImp::emitConfigureImp(AstNodeModule* modp) {
|
||||
puts("\nvoid "+modClassName(modp)+"::__Vconfigure("+symClassName()+"* vlSymsp, bool first) {\n");
|
||||
puts( "if (0 && first) {} // Prevent unused\n");
|
||||
puts( "this->__VlSymsp = vlSymsp;\n"); // First, as later stuff needs it.
|
||||
|
|
@ -1260,7 +1260,7 @@ void EmitCImp::emitConfigureImp(AstModule* modp) {
|
|||
puts("}\n");
|
||||
}
|
||||
|
||||
void EmitCImp::emitCoverageImp(AstModule* modp) {
|
||||
void EmitCImp::emitCoverageImp(AstNodeModule* modp) {
|
||||
if (v3Global.opt.coverage() ) {
|
||||
puts("\n// Coverage\n");
|
||||
// Rather than putting out SP_COVER_INSERT calls directly, we do it via this function
|
||||
|
|
@ -1284,7 +1284,7 @@ void EmitCImp::emitCoverageImp(AstModule* modp) {
|
|||
}
|
||||
}
|
||||
|
||||
void EmitCImp::emitDestructorImp(AstModule* modp) {
|
||||
void EmitCImp::emitDestructorImp(AstNodeModule* modp) {
|
||||
puts("\n");
|
||||
puts(modClassName(modp)+"::~"+modClassName(modp)+"() {\n");
|
||||
emitTextSection(AstType::SCDTOR);
|
||||
|
|
@ -1292,7 +1292,7 @@ void EmitCImp::emitDestructorImp(AstModule* modp) {
|
|||
puts("}\n");
|
||||
}
|
||||
|
||||
void EmitCImp::emitStaticDecl(AstModule* modp) {
|
||||
void EmitCImp::emitStaticDecl(AstNodeModule* modp) {
|
||||
// Need implementation here. Be careful of alignment code; needs to be uniquified
|
||||
// with module name to avoid multiple symbols.
|
||||
//emitVarList(modp->stmtsp(), EVL_ALL, modp->name());
|
||||
|
|
@ -1323,7 +1323,7 @@ void EmitCImp::emitTextSection(AstType type) {
|
|||
}
|
||||
}
|
||||
|
||||
void EmitCImp::emitCellCtors(AstModule* modp) {
|
||||
void EmitCImp::emitCellCtors(AstNodeModule* modp) {
|
||||
if (modp->isTop()) {
|
||||
// Must be before other constructors, as __vlCoverInsert calls it
|
||||
puts(EmitCBaseVisitor::symClassVar()+" = __VlSymsp = new "+symClassName()+"(this, name());\n");
|
||||
|
|
@ -1353,7 +1353,7 @@ void EmitCImp::emitSensitives() {
|
|||
}
|
||||
}
|
||||
|
||||
void EmitCImp::emitWrapEval(AstModule* modp) {
|
||||
void EmitCImp::emitWrapEval(AstNodeModule* modp) {
|
||||
puts("\nvoid "+modClassName(modp)+"::eval() {\n");
|
||||
puts(EmitCBaseVisitor::symClassVar()+" = this->__VlSymsp; // Setup global symbol table\n");
|
||||
puts(EmitCBaseVisitor::symTopAssign()+"\n");
|
||||
|
|
@ -1450,7 +1450,7 @@ struct CmpName {
|
|||
}
|
||||
};
|
||||
|
||||
void EmitCImp::emitIntFuncDecls(AstModule* modp) {
|
||||
void EmitCImp::emitIntFuncDecls(AstNodeModule* modp) {
|
||||
vector<AstCFunc*> funcsp;
|
||||
|
||||
for (AstNode* nodep=modp->stmtsp(); nodep; nodep = nodep->nextp()) {
|
||||
|
|
@ -1472,7 +1472,7 @@ void EmitCImp::emitIntFuncDecls(AstModule* modp) {
|
|||
}
|
||||
}
|
||||
|
||||
void EmitCImp::emitInt(AstModule* modp) {
|
||||
void EmitCImp::emitInt(AstNodeModule* modp) {
|
||||
// Always have this first; gcc has short circuiting if #ifdef is first in a file
|
||||
if (!optSystemPerl()) { // else done for us automatically
|
||||
puts("#ifndef _"+modClassName(modp)+"_H_\n");
|
||||
|
|
@ -1634,7 +1634,7 @@ void EmitCImp::emitInt(AstModule* modp) {
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
void EmitCImp::emitImp(AstModule* modp) {
|
||||
void EmitCImp::emitImp(AstNodeModule* modp) {
|
||||
if (optSystemPerl()) {
|
||||
puts("//############################################################\n");
|
||||
puts("#sp implementation\n");
|
||||
|
|
@ -1694,7 +1694,7 @@ void EmitCImp::emitImp(AstModule* modp) {
|
|||
|
||||
//######################################################################
|
||||
|
||||
void EmitCImp::main(AstModule* modp, bool slow, bool fast) {
|
||||
void EmitCImp::main(AstNodeModule* modp, bool slow, bool fast) {
|
||||
// Output a module
|
||||
m_modp = modp;
|
||||
m_slow = slow;
|
||||
|
|
@ -1922,7 +1922,7 @@ class EmitCTrace : EmitCStmts {
|
|||
// Top module only
|
||||
nodep->topModulep()->accept(*this);
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
nodep->iterateChildren(*this);
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
||||
|
|
@ -2022,7 +2022,7 @@ public:
|
|||
void V3EmitC::emitc() {
|
||||
UINFO(2,__FUNCTION__<<": "<<endl);
|
||||
// Process each module in turn
|
||||
for (AstModule* nodep = v3Global.rootp()->modulesp(); nodep; nodep=nodep->nextp()->castModule()) {
|
||||
for (AstNodeModule* nodep = v3Global.rootp()->modulesp(); nodep; nodep=nodep->nextp()->castNodeModule()) {
|
||||
if (v3Global.opt.outputSplit()) {
|
||||
{ EmitCImp imp; imp.main(nodep, false, true); }
|
||||
{ EmitCImp imp; imp.main(nodep, true, false); }
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ public:
|
|||
static string symClassName() { return v3Global.opt.prefix()+"__Syms"; }
|
||||
static string symClassVar() { return symClassName()+"* __restrict vlSymsp"; }
|
||||
static string symTopAssign() { return v3Global.opt.prefix()+"* __restrict vlTOPp VL_ATTR_UNUSED = vlSymsp->TOPp;"; }
|
||||
static string modClassName(AstModule* modp) { // Return name of current module being processed
|
||||
static string modClassName(AstNodeModule* modp) { // Return name of current module being processed
|
||||
if (modp->isTop()) {
|
||||
return v3Global.opt.prefix();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -41,12 +41,12 @@
|
|||
class EmitCSyms : EmitCBaseVisitor {
|
||||
// NODE STATE
|
||||
// Cleared on Netlist
|
||||
// AstModule::user1() -> bool. Set true __Vconfigure called
|
||||
// AstNodeModule::user1() -> bool. Set true __Vconfigure called
|
||||
AstUser1InUse m_inuser1;
|
||||
|
||||
// STATE
|
||||
AstModule* m_modp; // Current module
|
||||
typedef pair<AstScope*,AstModule*> ScopeModPair;
|
||||
AstNodeModule* m_modp; // Current module
|
||||
typedef pair<AstScope*,AstNodeModule*> ScopeModPair;
|
||||
vector<ScopeModPair> m_scopes; // Every scope by module
|
||||
V3LanguageWords m_words; // Reserved word detector
|
||||
int m_coverBins; // Coverage bin number
|
||||
|
|
@ -84,7 +84,7 @@ class EmitCSyms : EmitCBaseVisitor {
|
|||
emitInt();
|
||||
emitImp();
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
nameCheck(nodep);
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
|
|
@ -131,7 +131,7 @@ void EmitCSyms::emitInt() {
|
|||
|
||||
// for
|
||||
puts("\n// INCLUDE MODULE CLASSES\n");
|
||||
for (AstModule* nodep = v3Global.rootp()->modulesp(); nodep; nodep=nodep->nextp()->castModule()) {
|
||||
for (AstNodeModule* nodep = v3Global.rootp()->modulesp(); nodep; nodep=nodep->nextp()->castNodeModule()) {
|
||||
puts("#include \""+modClassName(nodep)+".h\"\n");
|
||||
}
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ void EmitCSyms::emitInt() {
|
|||
ofp()->putAlign(V3OutFile::AL_AUTO, sizeof(vluint64_t));
|
||||
puts("\n// SUBCELL STATE\n");
|
||||
for (vector<ScopeModPair>::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) {
|
||||
AstScope* scopep = it->first; AstModule* modp = it->second;
|
||||
AstScope* scopep = it->first; AstNodeModule* modp = it->second;
|
||||
if (modp->isTop()) {
|
||||
ofp()->printf("%-30s ", (modClassName(modp)+"*").c_str());
|
||||
puts(scopep->nameDotless()+"p;\n");
|
||||
|
|
@ -192,7 +192,7 @@ void EmitCSyms::emitImp() {
|
|||
|
||||
// Includes
|
||||
puts("#include \""+symClassName()+".h\"\n");
|
||||
for (AstModule* nodep = v3Global.rootp()->modulesp(); nodep; nodep=nodep->nextp()->castModule()) {
|
||||
for (AstNodeModule* nodep = v3Global.rootp()->modulesp(); nodep; nodep=nodep->nextp()->castNodeModule()) {
|
||||
puts("#include \""+modClassName(nodep)+".h\"\n");
|
||||
}
|
||||
|
||||
|
|
@ -207,7 +207,7 @@ void EmitCSyms::emitImp() {
|
|||
puts("\t// Setup submodule names\n");
|
||||
char comma=',';
|
||||
for (vector<ScopeModPair>::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) {
|
||||
AstScope* scopep = it->first; AstModule* modp = it->second;
|
||||
AstScope* scopep = it->first; AstNodeModule* modp = it->second;
|
||||
if (modp->isTop()) {
|
||||
} else {
|
||||
ofp()->printf("\t%c %-30s ", comma, scopep->nameDotless().c_str());
|
||||
|
|
@ -223,7 +223,7 @@ void EmitCSyms::emitImp() {
|
|||
puts("TOPp = topp;\n");
|
||||
puts("// Setup each module's pointers to their submodules\n");
|
||||
for (vector<ScopeModPair>::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) {
|
||||
AstScope* scopep = it->first; AstModule* modp = it->second;
|
||||
AstScope* scopep = it->first; AstNodeModule* modp = it->second;
|
||||
if (!modp->isTop()) {
|
||||
string arrow = scopep->name();
|
||||
string::size_type pos;
|
||||
|
|
@ -239,7 +239,7 @@ void EmitCSyms::emitImp() {
|
|||
puts("// Setup each module's pointer back to symbol table (for public functions)\n");
|
||||
puts("TOPp->__Vconfigure(this, true);\n");
|
||||
for (vector<ScopeModPair>::iterator it = m_scopes.begin(); it != m_scopes.end(); ++it) {
|
||||
AstScope* scopep = it->first; AstModule* modp = it->second;
|
||||
AstScope* scopep = it->first; AstNodeModule* modp = it->second;
|
||||
if (!modp->isTop()) {
|
||||
// first is used by AstCoverDecl's call to __vlCoverInsert
|
||||
bool first = !modp->user1();
|
||||
|
|
|
|||
|
|
@ -502,7 +502,7 @@ void V3EmitV::emitv() {
|
|||
EmitVFileVisitor visitor (v3Global.rootp(), &of);
|
||||
} else {
|
||||
// Process each module in turn
|
||||
for (AstModule* modp = v3Global.rootp()->modulesp(); modp; modp=modp->nextp()->castModule()) {
|
||||
for (AstNodeModule* modp = v3Global.rootp()->modulesp(); modp; modp=modp->nextp()->castNodeModule()) {
|
||||
V3OutVFile of (v3Global.opt.makeDir()
|
||||
+"/"+EmitCBaseVisitor::modClassName(modp)+"__Vout.v");
|
||||
of.putsHeader();
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ private:
|
|||
V3Graph m_graph; // Scoreboard of var usages/dependencies
|
||||
GateLogicVertex* m_logicVertexp; // Current statement being tracked, NULL=ignored
|
||||
AstScope* m_scopep; // Current scope being processed
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstActive* m_activep; // Current active
|
||||
bool m_activeReducible; // Is activation block reducible?
|
||||
bool m_inSenItem; // Underneath AstSenItem; any varrefs are clocks
|
||||
|
|
@ -316,7 +316,7 @@ private:
|
|||
consumedMove();
|
||||
replaceAssigns();
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
m_modp = nodep;
|
||||
m_activeReducible = true;
|
||||
nodep->iterateChildren(*this);
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ private:
|
|||
AstUser3InUse m_inuser3;
|
||||
|
||||
// STATE
|
||||
AstActive* m_activep; // Inside activate statement
|
||||
AstModule* m_topModp; // Top module
|
||||
AstActive* m_activep; // Inside activate statement
|
||||
AstNodeModule* m_topModp; // Top module
|
||||
AstScope* m_scopetopp; // Scope under TOPSCOPE
|
||||
|
||||
// METHODS
|
||||
|
|
@ -130,7 +130,7 @@ private:
|
|||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
GenClkRenameVisitor(AstTopScope* nodep, AstModule* topModp) {
|
||||
GenClkRenameVisitor(AstTopScope* nodep, AstNodeModule* topModp) {
|
||||
m_topModp = topModp;
|
||||
m_scopetopp = NULL;
|
||||
m_activep = NULL;
|
||||
|
|
@ -152,7 +152,7 @@ private:
|
|||
// STATE
|
||||
AstActive* m_activep; // Inside activate statement
|
||||
AstNodeAssign* m_assignp; // Inside assigndly statement
|
||||
AstModule* m_topModp; // Top module
|
||||
AstNodeModule* m_topModp; // Top module
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstTopScope* nodep, AstNUser*) {
|
||||
|
|
@ -164,7 +164,7 @@ private:
|
|||
GenClkRenameVisitor visitor (nodep, m_topModp);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
// Only track the top scopes, not lower level functions
|
||||
if (nodep->isTop()) {
|
||||
m_topModp = nodep;
|
||||
|
|
|
|||
|
|
@ -54,12 +54,12 @@ private:
|
|||
// NODE STATE
|
||||
// Cleared entire netlist
|
||||
// Input:
|
||||
// AstModule::user1p() // bool. True to inline this module (from InlineMarkVisitor)
|
||||
// AstNodeModule::user1p() // bool. True to inline this module (from InlineMarkVisitor)
|
||||
// Cleared each cell
|
||||
// AstVar::user2p() // AstVarRef*/AstConst* Points to signal this is a direct connect to
|
||||
|
||||
// STATE
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstCell* m_cellp; // Cell being cloned
|
||||
V3Double0 m_statCells; // Statistic tracking
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ private:
|
|||
// Iterate modules backwards, in bottom-up order. Required!
|
||||
nodep->iterateChildrenBackwards(*this);
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
if (m_cellp) {
|
||||
} else {
|
||||
m_modp = nodep;
|
||||
|
|
@ -118,7 +118,7 @@ private:
|
|||
// Clone original module
|
||||
if (debug()>=9) { nodep->dumpTree(cout,"inlcell:"); }
|
||||
//if (debug()>=9) { nodep->modp()->dumpTree(cout,"oldmod:"); }
|
||||
AstModule* newmodp = nodep->modp()->cloneTree(false);
|
||||
AstNodeModule* newmodp = nodep->modp()->cloneTree(false);
|
||||
if (debug()>=9) { newmodp->dumpTree(cout,"newmod:"); }
|
||||
// Clear var markings
|
||||
AstNode::user2ClearTree();
|
||||
|
|
@ -306,16 +306,16 @@ class InlineMarkVisitor : public AstNVisitor {
|
|||
private:
|
||||
// NODE STATE
|
||||
// Entire netlist
|
||||
// AstModule::user1() // OUTPUT: bool. User request to inline this module
|
||||
// AstModule::user2() // bool. Allowed to automatically inline module
|
||||
// AstModule::user3() // int. Number of cells referencing this module
|
||||
// AstNodeModule::user1() // OUTPUT: bool. User request to inline this module
|
||||
// AstNodeModule::user2() // bool. Allowed to automatically inline module
|
||||
// AstNodeModule::user3() // int. Number of cells referencing this module
|
||||
AstUser1InUse m_inuser1;
|
||||
AstUser2InUse m_inuser2;
|
||||
AstUser3InUse m_inuser3;
|
||||
|
||||
// STATE
|
||||
AstModule* m_modp; // Current module
|
||||
int m_stmtCnt; // Statements in module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
int m_stmtCnt; // Statements in module
|
||||
|
||||
// METHODS
|
||||
void cantInline(const char* reason) {
|
||||
|
|
@ -326,7 +326,7 @@ private:
|
|||
}
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
m_stmtCnt = 0;
|
||||
m_modp = nodep;
|
||||
m_modp->user2(true); // Allowed = true
|
||||
|
|
@ -427,9 +427,9 @@ void V3Inline::inlineAll(AstNetlist* nodep) {
|
|||
// Remove all modules that were inlined
|
||||
// V3Dead will also clean them up, but if we have debug on, it's a good
|
||||
// idea to avoid dumping the hugely exploded tree.
|
||||
AstModule* nextmodp;
|
||||
for (AstModule* modp = v3Global.rootp()->modulesp(); modp; modp=nextmodp) {
|
||||
nextmodp = modp->nextp()->castModule();
|
||||
AstNodeModule* nextmodp;
|
||||
for (AstNodeModule* modp = v3Global.rootp()->modulesp(); modp; modp=nextmodp) {
|
||||
nextmodp = modp->nextp()->castNodeModule();
|
||||
if (modp->user1p()) { // Was inlined
|
||||
modp->unlinkFrBack()->deleteTree(); modp=NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ private:
|
|||
AstUser1InUse m_inuser1;
|
||||
|
||||
// STATE
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstCell* m_cellp; // Current cell
|
||||
|
||||
static int debug() {
|
||||
|
|
@ -62,7 +62,7 @@ private:
|
|||
//int m_debug; int debug() { return m_debug; }
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
UINFO(4," MOD "<<nodep<<endl);
|
||||
//if (nodep->name() == "t_chg") m_debug = 9; else m_debug=0;
|
||||
m_modp = nodep;
|
||||
|
|
@ -232,7 +232,7 @@ public:
|
|||
//######################################################################
|
||||
// Inst class functions
|
||||
|
||||
void V3Inst::pinReconnectSimple(AstPin* pinp, AstCell* cellp, AstModule* modp) {
|
||||
void V3Inst::pinReconnectSimple(AstPin* pinp, AstCell* cellp, AstNodeModule* modp) {
|
||||
// If a pin connection is "simple" leave it as-is
|
||||
// Else create a intermediate wire to perform the interconnect
|
||||
// Note this module calles cloneTree() via new AstVar
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class V3Inst {
|
|||
public:
|
||||
static void instAll(AstNetlist* nodep);
|
||||
static void dearrayAll(AstNetlist* nodep);
|
||||
static void pinReconnectSimple(AstPin* nodep, AstCell* cellp, AstModule* modp);
|
||||
static void pinReconnectSimple(AstPin* nodep, AstCell* cellp, AstNodeModule* modp);
|
||||
};
|
||||
|
||||
#endif // Guard
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ private:
|
|||
nodep->deleteTree(); nodep=NULL;
|
||||
}
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
// Only track the top scopes, not lower level functions
|
||||
if (nodep->isTop()) nodep->iterateChildren(*this);
|
||||
}
|
||||
|
|
@ -162,7 +162,7 @@ private:
|
|||
}
|
||||
}
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
// Only track the top scopes, not lower level functions
|
||||
if (nodep->isTop()) nodep->iterateChildren(*this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class LinkVisitor : public AstNVisitor {
|
|||
private:
|
||||
// NODE STATE
|
||||
// Entire netlist:
|
||||
// AstModule::user1p() // V3SymTable* Module's Symbol table
|
||||
// AstNodeModule::user1p() // V3SymTable* Module's Symbol table
|
||||
// AstNodeFTask::user1p() // V3SymTable* Local Symbol table
|
||||
// AstBegin::user1p() // V3SymTable* Local Symbol table
|
||||
// AstVar::user2p() // bool True if port set for this variable
|
||||
|
|
@ -65,7 +65,7 @@ private:
|
|||
|
||||
// STATE
|
||||
// Below state needs to be preserved between each module call.
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstNodeFTask* m_ftaskp; // Current function/task
|
||||
IdState m_idState; // Id linking mode (find or resolve)
|
||||
int m_paramNum; // Parameter number, for position based connection
|
||||
|
|
@ -172,7 +172,7 @@ private:
|
|||
// VISITs
|
||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
||||
// Look at all modules, and store pointers to all module names
|
||||
for (AstModule* modp = v3Global.rootp()->modulesp(); modp; modp=modp->nextp()->castModule()) {
|
||||
for (AstNodeModule* modp = v3Global.rootp()->modulesp(); modp; modp=modp->nextp()->castNodeModule()) {
|
||||
symsFindNew(modp, NULL);
|
||||
}
|
||||
// And recurse...
|
||||
|
|
@ -185,7 +185,7 @@ private:
|
|||
nodep->checkTree();
|
||||
}
|
||||
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
// Module: Create sim table for entire module and iterate
|
||||
UINFO(2,"Link Module: "<<nodep<<endl);
|
||||
m_modp = nodep;
|
||||
|
|
|
|||
|
|
@ -56,12 +56,12 @@ public:
|
|||
|
||||
|
||||
class LinkCellsVertex : public V3GraphVertex {
|
||||
AstModule* m_modp;
|
||||
AstNodeModule* m_modp;
|
||||
public:
|
||||
LinkCellsVertex(V3Graph* graphp, AstModule* modp)
|
||||
LinkCellsVertex(V3Graph* graphp, AstNodeModule* modp)
|
||||
: V3GraphVertex(graphp), m_modp(modp) {}
|
||||
virtual ~LinkCellsVertex() {}
|
||||
AstModule* modp() const { return m_modp; }
|
||||
AstNodeModule* modp() const { return m_modp; }
|
||||
virtual string name() const { return modp()->name(); }
|
||||
};
|
||||
|
||||
|
|
@ -90,15 +90,15 @@ class LinkCellsVisitor : public AstNVisitor {
|
|||
private:
|
||||
// NODE STATE
|
||||
// Entire netlist:
|
||||
// AstModule::user1p() // V3GraphVertex* Vertex describing this module
|
||||
// AstNodeModule::user1p() // V3GraphVertex* Vertex describing this module
|
||||
// Allocated across all readFiles in V3Global::readFiles:
|
||||
// AstNode::user4p() // V3SymTable* Package and typedef symbol names
|
||||
AstUser1InUse m_inuser1;
|
||||
|
||||
// STATE
|
||||
// Below state needs to be preserved between each module call.
|
||||
AstModule* m_modp; // Current module
|
||||
V3SymTable m_mods; // Symbol table of all module names
|
||||
AstNodeModule* m_modp; // Current module
|
||||
V3SymTable m_mods; // Symbol table of all module names
|
||||
LinkCellsGraph m_graph; // Linked graph of all cell interconnects
|
||||
LibraryVertex* m_libVertexp; // Vertex at root of all libraries
|
||||
V3GraphVertex* m_topVertexp; // Vertex of top module
|
||||
|
|
@ -110,7 +110,7 @@ private:
|
|||
}
|
||||
|
||||
// METHODS
|
||||
V3GraphVertex* vertex(AstModule* nodep) {
|
||||
V3GraphVertex* vertex(AstNodeModule* nodep) {
|
||||
// Return corresponding vertex for this module
|
||||
if (!nodep->user1p()) {
|
||||
nodep->user1p(new LinkCellsVertex(&m_graph, nodep));
|
||||
|
|
@ -130,7 +130,7 @@ private:
|
|||
for (V3GraphVertex* itp = m_graph.verticesBeginp(); itp; itp=itp->verticesNextp()) {
|
||||
if (LinkCellsVertex* vvertexp = dynamic_cast<LinkCellsVertex*>(itp)) {
|
||||
// +1 so we leave level 1 for the new wrapper we'll make in a moment
|
||||
AstModule* modp = vvertexp->modp();
|
||||
AstNodeModule* modp = vvertexp->modp();
|
||||
modp->level(vvertexp->rank()+1);
|
||||
if (vvertexp == m_topVertexp && modp->level() != 2) {
|
||||
v3error("Specified --top-module '"<<v3Global.opt.topModule()<<"' isn't at the top level, it's under another cell.");
|
||||
|
|
@ -142,7 +142,7 @@ private:
|
|||
v3error("Specified --top-module '"<<v3Global.opt.topModule()<<"' was not found in design.");
|
||||
}
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
// Module: Pick up modnames, so we can resolve cells later
|
||||
m_modp = nodep;
|
||||
UINFO(2,"Link Module: "<<nodep<<endl);
|
||||
|
|
@ -171,7 +171,7 @@ private:
|
|||
UINFO(4,"Link Cell: "<<nodep<<endl);
|
||||
// Use findIdUpward instead of findIdFlat; it doesn't matter for now
|
||||
// but we might support modules-under-modules someday.
|
||||
AstModule* modp = m_mods.findIdUpward(nodep->modName())->castModule();
|
||||
AstNodeModule* modp = m_mods.findIdUpward(nodep->modName())->castNodeModule();
|
||||
if (!modp) {
|
||||
// Read-subfile
|
||||
V3Parse parser (v3Global.rootp());
|
||||
|
|
@ -180,7 +180,7 @@ private:
|
|||
// We've read new modules, grab new pointers to their names
|
||||
readModNames();
|
||||
// Check again
|
||||
modp = m_mods.findIdUpward(nodep->modName())->castModule();
|
||||
modp = m_mods.findIdUpward(nodep->modName())->castNodeModule();
|
||||
if (!modp) {
|
||||
nodep->v3error("Can't resolve module reference: "<<nodep->modName());
|
||||
}
|
||||
|
|
@ -250,7 +250,7 @@ private:
|
|||
// METHODS
|
||||
void readModNames() {
|
||||
// Look at all modules, and store pointers to all module names
|
||||
for (AstModule* nodep = v3Global.rootp()->modulesp(); nodep; nodep=nodep->nextp()->castModule()) {
|
||||
for (AstNodeModule* nodep = v3Global.rootp()->modulesp(); nodep; nodep=nodep->nextp()->castNodeModule()) {
|
||||
AstNode* foundp = m_mods.findIdUpward(nodep->name());
|
||||
if (foundp && foundp != nodep) {
|
||||
nodep->v3error("Duplicate declaration of module: "<<nodep->prettyName());
|
||||
|
|
|
|||
|
|
@ -106,16 +106,16 @@ public:
|
|||
|
||||
class LinkDotCellVertex : public LinkDotBaseVertex {
|
||||
// A real point in the hierarchy, corresponding to a instantiated module
|
||||
AstModule* m_modp; // Module
|
||||
AstNodeModule* m_modp; // Module
|
||||
AstCell* m_cellp; // Cell creating this vertex **NULL AT TOP**
|
||||
V3SymTable m_syms; // Symbol table of variable/task names for global lookup
|
||||
public:
|
||||
LinkDotCellVertex(V3Graph* graphp, AstCell* nodep)
|
||||
: LinkDotBaseVertex(graphp, ""), m_modp(nodep->modp()), m_cellp(nodep) {}
|
||||
LinkDotCellVertex(V3Graph* graphp, AstModule* nodep)
|
||||
LinkDotCellVertex(V3Graph* graphp, AstNodeModule* nodep)
|
||||
: LinkDotBaseVertex(graphp, ""), m_modp(nodep), m_cellp(NULL) {}
|
||||
virtual ~LinkDotCellVertex() {}
|
||||
AstModule* modp() const { return m_modp; } // May be NULL
|
||||
AstNodeModule* modp() const { return m_modp; } // May be NULL
|
||||
AstCell* cellp() const { return m_cellp; } // Is NULL at TOP
|
||||
virtual V3SymTable& syms() { return m_syms; }
|
||||
// We need to use origName as parameters may have renamed the modname
|
||||
|
|
@ -174,7 +174,7 @@ class LinkDotState {
|
|||
private:
|
||||
// NODE STATE
|
||||
// Cleared on Netlist
|
||||
// AstModule::user1p() -> LinkDotCellVertex*. Last cell that uses this module
|
||||
// AstNodeModule::user1p() -> LinkDotCellVertex*. Last cell that uses this module
|
||||
// AstVarScope::user2p() -> AstVarScope*. Base alias for this signal
|
||||
AstUser1InUse m_inuser1;
|
||||
AstUser2InUse m_inuser2;
|
||||
|
|
@ -209,7 +209,7 @@ public:
|
|||
bool forScopeCreation() const { return m_forScopeCreation; }
|
||||
|
||||
// METHODS
|
||||
LinkDotCellVertex* insertTopCell(AstModule* nodep, const string& scopename) {
|
||||
LinkDotCellVertex* insertTopCell(AstNodeModule* nodep, const string& scopename) {
|
||||
UINFO(9," INSERTcell "<<scopename<<" "<<nodep<<endl);
|
||||
LinkDotCellVertex* vxp = new LinkDotCellVertex(&m_graph, nodep);
|
||||
nodep->user1p(vxp);
|
||||
|
|
@ -254,10 +254,10 @@ public:
|
|||
UINFO(9," INSERTsym "<<name<<" "<<nodep<<endl);
|
||||
abovep->syms().insert(name, nodep);
|
||||
}
|
||||
bool existsModScope(AstModule* nodep) {
|
||||
bool existsModScope(AstNodeModule* nodep) {
|
||||
return nodep->user1p()!=NULL;
|
||||
}
|
||||
LinkDotCellVertex* findModScope(AstModule* nodep) {
|
||||
LinkDotCellVertex* findModScope(AstNodeModule* nodep) {
|
||||
LinkDotCellVertex* vxp = (LinkDotCellVertex*)(nodep->user1p());
|
||||
if (!vxp) nodep->v3fatalSrc("Module never assigned a vertex");
|
||||
return vxp;
|
||||
|
|
@ -385,7 +385,7 @@ private:
|
|||
// The first module in the list is always the top module (sorted before this is called).
|
||||
// This may not be the module with isTop() set, as early in the steps,
|
||||
// wrapTop may have not been created yet.
|
||||
AstModule* topmodp = nodep->modulesp();
|
||||
AstNodeModule* topmodp = nodep->modulesp();
|
||||
if (!topmodp) {
|
||||
nodep->v3error("No top level module found");
|
||||
} else {
|
||||
|
|
@ -401,7 +401,7 @@ private:
|
|||
m_inlineVxp = m_cellVxp;
|
||||
}
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
UINFO(8," "<<nodep<<endl);
|
||||
if (!m_cellVxp) {
|
||||
// Will be optimized away later
|
||||
|
|
@ -593,7 +593,7 @@ private:
|
|||
// METHODS
|
||||
|
||||
// VISITs
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
UINFO(8," "<<nodep<<endl);
|
||||
if (!m_statep->existsModScope(nodep)) {
|
||||
UINFO(5,"Dead module for "<<nodep<<endl);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
// Levelizing class functions
|
||||
|
||||
struct CmpLevel {
|
||||
inline bool operator () (const AstModule* lhsp, const AstModule* rhsp) const {
|
||||
inline bool operator () (const AstNodeModule* lhsp, const AstNodeModule* rhsp) const {
|
||||
return lhsp->level() < rhsp->level();
|
||||
}
|
||||
};
|
||||
|
|
@ -53,9 +53,11 @@ void V3LinkLevel::modSortByLevel() {
|
|||
|
||||
// level() was computed for us in V3LinkCells
|
||||
|
||||
vector<AstModule*> vec;
|
||||
AstModule* topp = NULL;
|
||||
for (AstModule* nodep = v3Global.rootp()->modulesp(); nodep; nodep=nodep->nextp()->castModule()) {
|
||||
typedef vector<AstNodeModule*> ModVec;
|
||||
|
||||
ModVec vec;
|
||||
AstNodeModule* topp = NULL;
|
||||
for (AstNodeModule* nodep = v3Global.rootp()->modulesp(); nodep; nodep=nodep->nextp()->castNodeModule()) {
|
||||
if (nodep->level()<=2) {
|
||||
if (topp) {
|
||||
nodep->v3warn(MULTITOP, "Unsupported: Multiple top level modules: "
|
||||
|
|
@ -67,13 +69,13 @@ void V3LinkLevel::modSortByLevel() {
|
|||
vec.push_back(nodep);
|
||||
}
|
||||
sort(vec.begin(), vec.end(), CmpLevel()); // Sort the vector
|
||||
for (vector<AstModule*>::iterator it = vec.begin(); it != vec.end(); ++it) {
|
||||
AstModule* nodep = *it;
|
||||
for (ModVec::iterator it = vec.begin(); it != vec.end(); ++it) {
|
||||
AstNodeModule* nodep = *it;
|
||||
nodep->unlinkFrBack();
|
||||
}
|
||||
if (v3Global.rootp()->modulesp()) v3Global.rootp()->v3fatalSrc("Unlink didn't work");
|
||||
for (vector<AstModule*>::iterator it = vec.begin(); it != vec.end(); ++it) {
|
||||
AstModule* nodep = *it;
|
||||
for (ModVec::iterator it = vec.begin(); it != vec.end(); ++it) {
|
||||
AstNodeModule* nodep = *it;
|
||||
v3Global.rootp()->addModulep(nodep);
|
||||
}
|
||||
}
|
||||
|
|
@ -84,9 +86,9 @@ void V3LinkLevel::modSortByLevel() {
|
|||
void V3LinkLevel::wrapTop(AstNetlist* netlistp) {
|
||||
UINFO(2,__FUNCTION__<<": "<<endl);
|
||||
// We do ONLY the top module
|
||||
AstModule* oldmodp = netlistp->modulesp();
|
||||
AstNodeModule* oldmodp = netlistp->modulesp();
|
||||
if (!oldmodp) netlistp->v3fatalSrc("No module found to process");
|
||||
AstModule* newmodp = new AstModule(oldmodp->fileline(), (string)"TOP_"+oldmodp->name());
|
||||
AstNodeModule* newmodp = new AstModule(oldmodp->fileline(), (string)"TOP_"+oldmodp->name());
|
||||
// Make the new module first in the list
|
||||
oldmodp->unlinkFrBackWithNext();
|
||||
newmodp->addNext(oldmodp);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ private:
|
|||
|
||||
// STATE
|
||||
// Below state needs to be preserved between each module call.
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstNodeFTask* m_ftaskp; // Function or task we're inside
|
||||
AstVAssert* m_assertp; // Current assertion
|
||||
int m_senitemCvtNum; // Temporary signal counter
|
||||
|
|
@ -67,7 +67,7 @@ private:
|
|||
}
|
||||
|
||||
// VISITs
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
// Module: Create sim table for entire module and iterate
|
||||
UINFO(8,"MODULE "<<nodep<<endl);
|
||||
m_modp = nodep;
|
||||
|
|
@ -362,7 +362,7 @@ public:
|
|||
class LinkBotupVisitor : public AstNVisitor {
|
||||
private:
|
||||
// STATE
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
|
||||
// METHODS
|
||||
static int debug() {
|
||||
|
|
@ -376,7 +376,7 @@ private:
|
|||
// Iterate modules backwards, in bottom-up order.
|
||||
nodep->iterateChildrenBackwards(*this);
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
m_modp = NULL;
|
||||
|
|
|
|||
|
|
@ -160,10 +160,6 @@ private:
|
|||
nodep->iterateChildren(*this);
|
||||
moveVars();
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
// Consumption/generation of a variable,
|
||||
nodep->iterateChildren(*this);
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep, AstNUser*) {
|
||||
UINFO(4," CFUNC "<<nodep<<endl);
|
||||
m_cfuncp = nodep;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ private:
|
|||
AstUser1InUse m_inuser1;
|
||||
|
||||
// STATE
|
||||
AstModule* m_modp;
|
||||
AstNodeModule* m_modp;
|
||||
V3LanguageWords m_words; // Reserved word detector
|
||||
|
||||
// METHODS
|
||||
|
|
@ -77,7 +77,7 @@ private:
|
|||
}
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
m_modp = NULL;
|
||||
|
|
|
|||
|
|
@ -246,8 +246,8 @@ private:
|
|||
// USER4 Cleared on each Logic stmt
|
||||
// AstVarScope::user4() -> VarUsage(gen/con/both). Where already encountered signal
|
||||
// Ordering (user3/4/5 cleared between forming and ordering)
|
||||
// AstScope::user1p() -> AstModule*. Module this scope is under
|
||||
// AstModule::user3() -> Number of routines created
|
||||
// AstScope::user1p() -> AstNodeModule*. Module this scope is under
|
||||
// AstNodeModule::user3() -> Number of routines created
|
||||
// Each call to V3Const::constify
|
||||
// AstNode::user4() Used by V3Const::constify, called below
|
||||
AstUser1InUse m_inuser1;
|
||||
|
|
@ -266,7 +266,7 @@ private:
|
|||
OrderLogicVertex* m_logicVxp; // Current statement being tracked, NULL=ignored
|
||||
AstTopScope* m_topScopep; // Current top scope being processed
|
||||
AstScope* m_scopetopp; // Scope under TOPSCOPE
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstScope* m_scopep; // Current scope being processed
|
||||
AstActive* m_activep; // Current activation block
|
||||
bool m_inSenTree; // Underneath AstSenItem; any varrefs are clocks
|
||||
|
|
@ -374,7 +374,7 @@ private:
|
|||
void processMoveLoopStmt(AstNode* newSubnodep);
|
||||
OrderLoopId processMoveLoopCurrent();
|
||||
|
||||
string cfuncName(AstModule* modp, AstSenTree* domainp, AstScope* scopep, AstNode* forWhatp) {
|
||||
string cfuncName(AstNodeModule* modp, AstSenTree* domainp, AstScope* scopep, AstNode* forWhatp) {
|
||||
modp->user3(1+modp->user3());
|
||||
int funcnum = modp->user3();
|
||||
string name = (domainp->hasCombo() ? "_combo"
|
||||
|
|
@ -473,7 +473,7 @@ private:
|
|||
AstNode::user3ClearTree();
|
||||
AstNode::user4ClearTree();
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
m_modp = NULL;
|
||||
|
|
@ -1387,7 +1387,7 @@ void OrderVisitor::processMoveOne(OrderMoveVertex* vertexp, OrderMoveDomScope* d
|
|||
<<" s="<<(void*)(scopep)<<" "<<lvertexp<<endl);
|
||||
AstSenTree* domainp = lvertexp->domainp();
|
||||
AstNode* nodep = lvertexp->nodep();
|
||||
AstModule* modp = scopep->user1p()->castNode()->castModule(); UASSERT(modp,"NULL"); // Stashed by visitor func
|
||||
AstNodeModule* modp = scopep->user1p()->castNode()->castNodeModule(); UASSERT(modp,"NULL"); // Stashed by visitor func
|
||||
if (nodep->castUntilStable()) {
|
||||
#ifdef NEW_ORDERING
|
||||
// Beginning of loop.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
class ParamVisitor : public AstNVisitor {
|
||||
private:
|
||||
// NODE STATE
|
||||
// AstModule::user4() // bool True if parameters numbered
|
||||
// AstNodeModule::user4() // bool True if parameters numbered
|
||||
// AstVar::user4() // int Global parameter number (for naming new module)
|
||||
// // (0=not processed, 1=iterated, but no number, 65+ parameter numbered)
|
||||
AstUser4InUse m_inuser4;
|
||||
|
|
@ -61,9 +61,9 @@ private:
|
|||
// STATE
|
||||
typedef std::map<AstVar*,AstVar*> VarCloneMap;
|
||||
struct ModInfo {
|
||||
AstModule* m_modp; // Module with specified name
|
||||
AstNodeModule* m_modp; // Module with specified name
|
||||
VarCloneMap m_cloneMap; // Map of old-varp -> new cloned varp
|
||||
ModInfo(AstModule* modp) { m_modp=modp; }
|
||||
ModInfo(AstNodeModule* modp) { m_modp=modp; }
|
||||
};
|
||||
typedef std::map<string,ModInfo> ModNameMap;
|
||||
ModNameMap m_modNameMap; // Hash of created module flavors by name
|
||||
|
|
@ -79,7 +79,7 @@ private:
|
|||
return level;
|
||||
}
|
||||
|
||||
void makeSmallNames(AstModule* modp) {
|
||||
void makeSmallNames(AstNodeModule* modp) {
|
||||
vector<int> usedLetter; usedLetter.resize(256);
|
||||
// Pass 1, assign first letter to each gparam's name
|
||||
for (AstNode* stmtp = modp->stmtsp(); stmtp; stmtp=stmtp->nextp()) {
|
||||
|
|
@ -93,7 +93,7 @@ private:
|
|||
}
|
||||
}
|
||||
}
|
||||
string paramSmallName(AstModule* modp, AstVar* varp) {
|
||||
string paramSmallName(AstNodeModule* modp, AstVar* varp) {
|
||||
if (varp->user4()<=1) {
|
||||
makeSmallNames(modp);
|
||||
}
|
||||
|
|
@ -122,7 +122,7 @@ private:
|
|||
// Modules must be done in top-down-order
|
||||
nodep->iterateChildren(*this);
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
UINFO(4," MOD "<<nodep<<endl);
|
||||
nodep->iterateChildren(*this);
|
||||
}
|
||||
|
|
@ -314,7 +314,7 @@ void ParamVisitor::visit(AstCell* nodep, AstNUser*) {
|
|||
|
||||
//
|
||||
// Already made this flavor?
|
||||
AstModule* modp = NULL;
|
||||
AstNodeModule* modp = NULL;
|
||||
ModNameMap::iterator iter = m_modNameMap.find(newname);
|
||||
if (iter != m_modNameMap.end()) modp = iter->second.m_modp;
|
||||
if (!modp) {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ struct V3ParseBisonYYSType {
|
|||
AstCase* casep;
|
||||
AstCaseItem* caseitemp;
|
||||
AstConst* constp;
|
||||
AstModule* modulep;
|
||||
AstNodeModule* modulep;
|
||||
AstNodeDType* dtypep;
|
||||
AstNodeFTask* ftaskp;
|
||||
AstNodeSenItem* senitemp;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ private:
|
|||
AstUser2InUse m_inuser2;
|
||||
|
||||
// STATE
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstCFunc* m_funcp; // Current block
|
||||
AstNode* m_stmtp; // Current statement
|
||||
AstWhile* m_inWhilep; // Inside while loop, special statement additions
|
||||
|
|
@ -144,7 +144,7 @@ private:
|
|||
}
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
UINFO(4," MOD "<<nodep<<endl);
|
||||
m_modp = nodep;
|
||||
m_funcp = NULL;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ private:
|
|||
AstUser2InUse m_inuser2;
|
||||
|
||||
// STATE, inside processing a single module
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstScope* m_scopep; // Current scope we are building
|
||||
// STATE, for passing down one level of hierarchy (may need save/restore)
|
||||
AstCell* m_aboveCellp; // Cell that instantiates this module
|
||||
|
|
@ -66,7 +66,7 @@ private:
|
|||
|
||||
// VISITORS
|
||||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
||||
AstModule* modp = nodep->topModulep();
|
||||
AstNodeModule* modp = nodep->topModulep();
|
||||
if (!modp) { nodep->v3error("No root module specified"); return; }
|
||||
// Operate starting at the top of the hierarchy
|
||||
AstNode::user2ClearTree();
|
||||
|
|
@ -74,7 +74,7 @@ private:
|
|||
m_aboveScopep = NULL;
|
||||
modp->accept(*this);
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
// Create required blocks and add to module
|
||||
string scopename = (!m_aboveScopep ? "TOP"
|
||||
: (m_aboveScopep->name()+"."+m_aboveCellp->name()));
|
||||
|
|
@ -94,9 +94,9 @@ private:
|
|||
{
|
||||
m_aboveCellp = cellp;
|
||||
m_aboveScopep = m_scopep;
|
||||
AstModule* modp = cellp->modp();
|
||||
AstNodeModule* modp = cellp->modp();
|
||||
if (!modp) cellp->v3fatalSrc("Unlinked mod");
|
||||
modp->accept(*this); // Recursive call to visit(AstModule)
|
||||
modp->accept(*this); // Recursive call to visit(AstNodeModule)
|
||||
}
|
||||
// Done, restore vars
|
||||
m_scopep = oldScopep;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ private:
|
|||
return level;
|
||||
}
|
||||
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
// Only do the top
|
||||
if (nodep->isTop()) {
|
||||
nodep->iterateChildren(*this);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ private:
|
|||
}
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
allNodes(nodep);
|
||||
if (!m_fast) {
|
||||
nodep->iterateChildren(*this);
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ private:
|
|||
V3Double0 m_statTablesCre; // Statistic tracking
|
||||
|
||||
// State cleared on each module
|
||||
AstModule* m_modp; // Current MODULE
|
||||
int m_modTables; // Number of tables created in this module
|
||||
AstNodeModule* m_modp; // Current MODULE
|
||||
int m_modTables; // Number of tables created in this module
|
||||
deque<AstVarScope*> m_modTableVscs; // All tables created
|
||||
|
||||
// State cleared on each scope
|
||||
|
|
@ -399,7 +399,7 @@ private:
|
|||
virtual void visit(AstNetlist* nodep, AstNUser*) {
|
||||
nodep->iterateChildren(*this);
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
m_modTables = 0;
|
||||
m_modTableVscs.clear();
|
||||
m_modp = nodep;
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ private:
|
|||
|
||||
// STATE
|
||||
TaskStateVisitor* m_statep; // Common state between visitors
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstScope* m_scopep; // Current scope
|
||||
InsertMode m_insMode; // How to insert
|
||||
AstNode* m_insStmtp; // Where to insert statement
|
||||
|
|
@ -632,7 +632,7 @@ private:
|
|||
}
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
m_modp = nodep;
|
||||
m_insStmtp = NULL;
|
||||
m_modNCalls = 0;
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ private:
|
|||
//AstUser4InUse In V3Hashed
|
||||
|
||||
// STATE
|
||||
AstModule* m_topModp; // Module to add variables to
|
||||
AstNodeModule* m_topModp; // Module to add variables to
|
||||
AstScope* m_highScopep; // Scope to add variables to
|
||||
AstCFunc* m_funcp; // C function adding to graph
|
||||
AstTraceInc* m_tracep; // Trace function adding to graph
|
||||
|
|
@ -583,7 +583,7 @@ private:
|
|||
assignActivity();
|
||||
putTracesIntoTree();
|
||||
}
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
if (nodep->isTop()) m_topModp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ private:
|
|||
// NODE STATE
|
||||
|
||||
// STATE
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstScope* m_scopetopp; // Current top scope
|
||||
AstCFunc* m_initFuncp; // Trace function being built
|
||||
AstCFunc* m_initSubFuncp; // Trace function being built (under m_init)
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ private:
|
|||
|
||||
// STATE
|
||||
int m_unique;
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
VarMap* m_lhsmapp; // LHS driver map
|
||||
AstSel* m_sel;
|
||||
|
||||
|
|
@ -262,7 +262,7 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
TristateExpander(AstModule* nodep, VarMap* lhsmapp) {
|
||||
TristateExpander(AstNodeModule* nodep, VarMap* lhsmapp) {
|
||||
m_modp = nodep;
|
||||
m_lhsmapp = lhsmapp;
|
||||
m_unique = 0;
|
||||
|
|
@ -287,7 +287,7 @@ private:
|
|||
AstUser2InUse m_inuser2;
|
||||
AstUser3InUse m_inuser3;
|
||||
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstCell* m_cellp; // current cell
|
||||
int m_unique;
|
||||
|
||||
|
|
@ -296,7 +296,7 @@ private:
|
|||
nodep->iterateChildrenBackwards(*this);
|
||||
}
|
||||
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
UINFO(9," MOD "<<nodep<<endl);
|
||||
m_unique = 0;
|
||||
VarMap* lhsmapp = new VarMap();
|
||||
|
|
@ -592,7 +592,7 @@ private:
|
|||
CONVERT_PINS
|
||||
};
|
||||
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
AstCell* m_cellp; // Current cell
|
||||
AstNodeFTask* m_ftaskp; // Current function/task
|
||||
States m_state;
|
||||
|
|
@ -606,7 +606,7 @@ private:
|
|||
nodep->iterateChildren(*this);
|
||||
}
|
||||
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
m_modp = nodep;
|
||||
nodep->iterateChildren(*this);
|
||||
m_modp = NULL;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ private:
|
|||
AstUser2InUse m_inuser2;
|
||||
|
||||
// STATE
|
||||
AstModule* m_modp; // Current module
|
||||
AstNodeModule* m_modp; // Current module
|
||||
bool m_constXCvt; // Convert X's
|
||||
V3Double0 m_statUnkVars; // Statistic tracking
|
||||
AstAssignW* m_assignwp; // Current assignment
|
||||
|
|
@ -146,7 +146,7 @@ private:
|
|||
}
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
virtual void visit(AstNodeModule* nodep, AstNUser*) {
|
||||
UINFO(4," MOD "<<nodep<<endl);
|
||||
m_modp = nodep;
|
||||
m_constXCvt = true;
|
||||
|
|
|
|||
|
|
@ -68,11 +68,6 @@ private:
|
|||
}
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstModule* nodep, AstNUser*) {
|
||||
UINFO(4," MOD "<<nodep<<endl);
|
||||
nodep->iterateChildren(*this);
|
||||
}
|
||||
|
||||
bool cantUnroll(AstNode* nodep, const char* reason) {
|
||||
if (m_generate) {
|
||||
nodep->v3error("Unsupported: Can't unroll generate for; "<<reason);
|
||||
|
|
|
|||
Loading…
Reference in New Issue