mirror of
https://github.com/verilator/verilator.git
synced 2025-07-31 07:56:10 +00:00
Internals: Add enum prefixes to reduce MSVC macro conflicts
This commit is contained in:
parent
634816d378
commit
b1872a8e21
@ -333,15 +333,15 @@ private:
|
||||
}
|
||||
virtual void visit(AstSenGate* nodep, AstNUser*) {
|
||||
AstSenItem* subitemp = nodep->sensesp();
|
||||
if (subitemp->edgeType() != AstEdgeType::ANYEDGE
|
||||
&& subitemp->edgeType() != AstEdgeType::POSEDGE
|
||||
&& subitemp->edgeType() != AstEdgeType::NEGEDGE) {
|
||||
if (subitemp->edgeType() != AstEdgeType::ET_ANYEDGE
|
||||
&& subitemp->edgeType() != AstEdgeType::ET_POSEDGE
|
||||
&& subitemp->edgeType() != AstEdgeType::ET_NEGEDGE) {
|
||||
nodep->v3fatalSrc("Strange activity type under SenGate");
|
||||
}
|
||||
nodep->iterateChildren(*this);
|
||||
}
|
||||
virtual void visit(AstSenItem* nodep, AstNUser*) {
|
||||
if (nodep->edgeType() == AstEdgeType::ANYEDGE) {
|
||||
if (nodep->edgeType() == AstEdgeType::ET_ANYEDGE) {
|
||||
m_itemCombo = true;
|
||||
// Delete the sensitivity
|
||||
// We'll add it as a generic COMBO SenItem in a moment.
|
||||
|
@ -60,7 +60,7 @@ private:
|
||||
+"\\n");
|
||||
}
|
||||
void replaceDisplay(AstDisplay* nodep, const string& prefix) {
|
||||
nodep->displayType(AstDisplayType::WRITE);
|
||||
nodep->displayType(AstDisplayType::DT_WRITE);
|
||||
nodep->fmtp()->text(assertDisplayMessage(nodep, prefix, nodep->fmtp()->text()));
|
||||
AstNode* timesp = nodep->fmtp()->exprsp(); if (timesp) timesp->unlinkFrBack();
|
||||
timesp = timesp->addNext(new AstTime(nodep->fileline()));
|
||||
@ -95,7 +95,7 @@ private:
|
||||
}
|
||||
|
||||
AstNode* newFireAssert(AstNode* nodep, const string& message) {
|
||||
AstDisplay* dispp = new AstDisplay (nodep->fileline(), AstDisplayType::ERROR, message, NULL, NULL);
|
||||
AstDisplay* dispp = new AstDisplay (nodep->fileline(), AstDisplayType::DT_ERROR, message, NULL, NULL);
|
||||
AstNode* bodysp = dispp;
|
||||
replaceDisplay(dispp, "%%Error"); // Convert to standard DISPLAY format
|
||||
bodysp->addNext(new AstStop (nodep->fileline()));
|
||||
@ -134,7 +134,7 @@ private:
|
||||
if (stmtsp) bodysp = bodysp->addNext(stmtsp);
|
||||
AstIf* ifp = new AstIf (nodep->fileline(), propp, bodysp, NULL);
|
||||
bodysp = ifp;
|
||||
if (nodep->castPslAssert()) ifp->branchPred(AstBranchPred::UNLIKELY);
|
||||
if (nodep->castPslAssert()) ifp->branchPred(AstBranchPred::BP_UNLIKELY);
|
||||
//
|
||||
AstNode* newp = new AstAlways (nodep->fileline(),
|
||||
sentreep,
|
||||
@ -166,7 +166,7 @@ private:
|
||||
|
||||
AstIf* ifp = new AstIf (nodep->fileline(), propp, passsp, failsp);
|
||||
AstNode* newp = ifp;
|
||||
if (nodep->castVAssert()) ifp->branchPred(AstBranchPred::UNLIKELY);
|
||||
if (nodep->castVAssert()) ifp->branchPred(AstBranchPred::BP_UNLIKELY);
|
||||
//
|
||||
// Install it
|
||||
nodep->replaceWith(newp);
|
||||
@ -215,7 +215,7 @@ private:
|
||||
new AstLogNot (nodep->fileline(), ohot),
|
||||
newFireAssert(nodep, "synthesis parallel_case, but multiple matches found"),
|
||||
NULL);
|
||||
ifp->branchPred(AstBranchPred::UNLIKELY);
|
||||
ifp->branchPred(AstBranchPred::BP_UNLIKELY);
|
||||
nodep->addNotParallelp(ifp);
|
||||
}
|
||||
}
|
||||
@ -226,12 +226,12 @@ private:
|
||||
virtual void visit(AstDisplay* nodep, AstNUser*) {
|
||||
nodep->iterateChildren(*this);
|
||||
// Replace the special types with standard text
|
||||
if (nodep->displayType()==AstDisplayType::INFO) {
|
||||
if (nodep->displayType()==AstDisplayType::DT_INFO) {
|
||||
replaceDisplay(nodep, "-Info");
|
||||
} else if (nodep->displayType()==AstDisplayType::WARNING) {
|
||||
} else if (nodep->displayType()==AstDisplayType::DT_WARNING) {
|
||||
replaceDisplay(nodep, "%%Warning");
|
||||
} else if (nodep->displayType()==AstDisplayType::ERROR
|
||||
|| nodep->displayType()==AstDisplayType::FATAL) {
|
||||
} else if (nodep->displayType()==AstDisplayType::DT_ERROR
|
||||
|| nodep->displayType()==AstDisplayType::DT_FATAL) {
|
||||
replaceDisplay(nodep, "%%Error");
|
||||
}
|
||||
}
|
||||
|
89
src/V3Ast.h
89
src/V3Ast.h
@ -81,7 +81,7 @@ public:
|
||||
class AstCFuncType {
|
||||
public:
|
||||
enum en {
|
||||
NORMAL,
|
||||
FT_NORMAL,
|
||||
TRACE_INIT,
|
||||
TRACE_INIT_SUB,
|
||||
TRACE_FULL,
|
||||
@ -110,19 +110,19 @@ public:
|
||||
// REMEMBER to edit the strings below too
|
||||
enum en {
|
||||
// These must be in general -> most specific order, as we sort by it in V3Const::visit AstSenTre
|
||||
ILLEGAL,
|
||||
ET_ILLEGAL,
|
||||
// Involving a variable
|
||||
ANYEDGE, // Default for sensitivities; rip them out
|
||||
BOTHEDGE, // POSEDGE | NEGEDGE
|
||||
POSEDGE,
|
||||
NEGEDGE,
|
||||
HIGHEDGE, // Is high now (latches)
|
||||
LOWEDGE, // Is low now (latches)
|
||||
ET_ANYEDGE, // Default for sensitivities; rip them out
|
||||
ET_BOTHEDGE, // POSEDGE | NEGEDGE
|
||||
ET_POSEDGE,
|
||||
ET_NEGEDGE,
|
||||
ET_HIGHEDGE, // Is high now (latches)
|
||||
ET_LOWEDGE, // Is low now (latches)
|
||||
// Not involving anything
|
||||
COMBO, // Sensitive to all combo inputs to this block
|
||||
INITIAL, // User initial statements
|
||||
SETTLE, // Like combo but for initial wire resolutions after initial statement
|
||||
NEVER // Never occurs (optimized away)
|
||||
ET_COMBO, // Sensitive to all combo inputs to this block
|
||||
ET_INITIAL, // User initial statements
|
||||
ET_SETTLE, // Like combo but for initial wire resolutions after initial statement
|
||||
ET_NEVER // Never occurs (optimized away)
|
||||
};
|
||||
enum en m_e;
|
||||
bool clockedStmt() const {
|
||||
@ -134,15 +134,15 @@ public:
|
||||
}
|
||||
AstEdgeType invert() const {
|
||||
switch (m_e) {
|
||||
case ANYEDGE: return ANYEDGE;
|
||||
case BOTHEDGE: return BOTHEDGE;
|
||||
case POSEDGE: return NEGEDGE;
|
||||
case NEGEDGE: return POSEDGE;
|
||||
case HIGHEDGE: return LOWEDGE;
|
||||
case LOWEDGE: return HIGHEDGE;
|
||||
case ET_ANYEDGE: return ET_ANYEDGE;
|
||||
case ET_BOTHEDGE: return ET_BOTHEDGE;
|
||||
case ET_POSEDGE: return ET_NEGEDGE;
|
||||
case ET_NEGEDGE: return ET_POSEDGE;
|
||||
case ET_HIGHEDGE: return ET_LOWEDGE;
|
||||
case ET_LOWEDGE: return ET_HIGHEDGE;
|
||||
default: UASSERT_STATIC(0,"Inverting bad edgeType()");
|
||||
};
|
||||
return AstEdgeType::ILLEGAL;
|
||||
return AstEdgeType::ET_ILLEGAL;
|
||||
}
|
||||
const char* ascii() const {
|
||||
static const char* names[] = {
|
||||
@ -172,7 +172,7 @@ public:
|
||||
class AstAttrType {
|
||||
public:
|
||||
enum en {
|
||||
BITS, // V3Const converts to constant
|
||||
EXPR_BITS, // V3Const converts to constant
|
||||
//
|
||||
VAR_BASE, // V3LinkResolve creates for AstPreSel, V3LinkParam removes
|
||||
VAR_CLOCK, // V3LinkParse moves to AstVar::attrScClocked
|
||||
@ -185,7 +185,7 @@ public:
|
||||
enum en m_e;
|
||||
const char* ascii() const {
|
||||
static const char* names[] = {
|
||||
"BITS", "VAR_BASE",
|
||||
"EXPR_BITS", "VAR_BASE",
|
||||
"VAR_CLOCK", "VAR_CLOCK_ENABLE", "VAR_PUBLIC", "VAR_PUBLIC_FLAT",
|
||||
"VAR_ISOLATE_ASSIGNMENTS", "VAR_SFORMAT"
|
||||
};
|
||||
@ -335,20 +335,20 @@ public:
|
||||
class AstBranchPred {
|
||||
public:
|
||||
enum en {
|
||||
UNKNOWN=0,
|
||||
LIKELY,
|
||||
UNLIKELY,
|
||||
BP_UNKNOWN=0,
|
||||
BP_LIKELY,
|
||||
BP_UNLIKELY,
|
||||
_ENUM_END
|
||||
};
|
||||
enum en m_e;
|
||||
// CONSTRUCTOR - note defaults to *UNKNOWN*
|
||||
inline AstBranchPred () : m_e(UNKNOWN) {}
|
||||
inline AstBranchPred () : m_e(BP_UNKNOWN) {}
|
||||
inline AstBranchPred (en _e) : m_e(_e) {}
|
||||
explicit inline AstBranchPred (int _e) : m_e(static_cast<en>(_e)) {}
|
||||
operator en () const { return m_e; }
|
||||
AstBranchPred invert() const {
|
||||
if (m_e==UNLIKELY) return LIKELY;
|
||||
else if (m_e==LIKELY) return UNLIKELY;
|
||||
if (m_e==BP_UNLIKELY) return BP_LIKELY;
|
||||
else if (m_e==BP_LIKELY) return BP_UNLIKELY;
|
||||
else return m_e;
|
||||
}
|
||||
const char* ascii() const {
|
||||
@ -366,9 +366,9 @@ public:
|
||||
class AstCaseType {
|
||||
public:
|
||||
enum en {
|
||||
CASE,
|
||||
CASEX,
|
||||
CASEZ
|
||||
CT_CASE,
|
||||
CT_CASEX,
|
||||
CT_CASEZ
|
||||
};
|
||||
enum en m_e;
|
||||
inline AstCaseType () {}
|
||||
@ -385,20 +385,20 @@ public:
|
||||
class AstDisplayType {
|
||||
public:
|
||||
enum en {
|
||||
DISPLAY,
|
||||
WRITE,
|
||||
INFO,
|
||||
ERROR,
|
||||
WARNING,
|
||||
FATAL
|
||||
DT_DISPLAY,
|
||||
DT_WRITE,
|
||||
DT_INFO,
|
||||
DT_ERROR,
|
||||
DT_WARNING,
|
||||
DT_FATAL
|
||||
};
|
||||
enum en m_e;
|
||||
inline AstDisplayType () {}
|
||||
inline AstDisplayType (en _e) : m_e(_e) {}
|
||||
explicit inline AstDisplayType (int _e) : m_e(static_cast<en>(_e)) {}
|
||||
operator en () const { return m_e; }
|
||||
bool addNewline() const { return m_e!=WRITE; }
|
||||
bool needScopeTracking() const { return m_e!=DISPLAY && m_e!=WRITE; }
|
||||
bool addNewline() const { return m_e!=DT_WRITE; }
|
||||
bool needScopeTracking() const { return m_e!=DT_DISPLAY && m_e!=DT_WRITE; }
|
||||
const char* ascii() const {
|
||||
static const char* names[] = {
|
||||
"display","write","info","error","warning","fatal"};
|
||||
@ -413,15 +413,14 @@ public:
|
||||
class AstParseRefExp {
|
||||
public:
|
||||
enum en {
|
||||
NONE, // Used in V3LinkParse only
|
||||
VAR_MEM,
|
||||
VAR_ANY,
|
||||
TASK,
|
||||
FUNC,
|
||||
_ENUM_END
|
||||
PX_NONE, // Used in V3LinkParse only
|
||||
PX_VAR_MEM,
|
||||
PX_VAR_ANY,
|
||||
PX_TASK,
|
||||
PX_FUNC
|
||||
};
|
||||
enum en m_e;
|
||||
inline AstParseRefExp() : m_e(NONE) {}
|
||||
inline AstParseRefExp() : m_e(PX_NONE) {}
|
||||
inline AstParseRefExp (en _e) : m_e(_e) {}
|
||||
explicit inline AstParseRefExp (int _e) : m_e(static_cast<en>(_e)) {}
|
||||
operator en () const { return m_e; }
|
||||
|
@ -1172,19 +1172,19 @@ public:
|
||||
}
|
||||
AstSenItem(FileLine* fl, Combo)
|
||||
: AstNodeSenItem(fl) {
|
||||
m_edgeType = AstEdgeType::COMBO;
|
||||
m_edgeType = AstEdgeType::ET_COMBO;
|
||||
}
|
||||
AstSenItem(FileLine* fl, Initial)
|
||||
: AstNodeSenItem(fl) {
|
||||
m_edgeType = AstEdgeType::INITIAL;
|
||||
m_edgeType = AstEdgeType::ET_INITIAL;
|
||||
}
|
||||
AstSenItem(FileLine* fl, Settle)
|
||||
: AstNodeSenItem(fl) {
|
||||
m_edgeType = AstEdgeType::SETTLE;
|
||||
m_edgeType = AstEdgeType::ET_SETTLE;
|
||||
}
|
||||
AstSenItem(FileLine* fl, Never)
|
||||
: AstNodeSenItem(fl) {
|
||||
m_edgeType = AstEdgeType::NEVER;
|
||||
m_edgeType = AstEdgeType::ET_NEVER;
|
||||
}
|
||||
ASTNODE_NODE_FUNCS(SenItem, SENITEM)
|
||||
virtual void dump(ostream& str);
|
||||
@ -1197,10 +1197,10 @@ public:
|
||||
AstNodeVarRef* varrefp() const { return op1p()->castNodeVarRef(); } // op1 = Signal sensitized
|
||||
//
|
||||
virtual bool isClocked() const { return edgeType().clockedStmt(); }
|
||||
virtual bool isCombo() const { return edgeType()==AstEdgeType::COMBO; }
|
||||
virtual bool isInitial() const { return edgeType()==AstEdgeType::INITIAL; }
|
||||
virtual bool isSettle() const { return edgeType()==AstEdgeType::SETTLE; }
|
||||
virtual bool isNever() const { return edgeType()==AstEdgeType::NEVER; }
|
||||
virtual bool isCombo() const { return edgeType()==AstEdgeType::ET_COMBO; }
|
||||
virtual bool isInitial() const { return edgeType()==AstEdgeType::ET_INITIAL; }
|
||||
virtual bool isSettle() const { return edgeType()==AstEdgeType::ET_SETTLE; }
|
||||
virtual bool isNever() const { return edgeType()==AstEdgeType::ET_NEVER; }
|
||||
bool hasVar() const { return !(isCombo()||isInitial()||isSettle()||isNever()); }
|
||||
};
|
||||
|
||||
@ -1515,8 +1515,8 @@ public:
|
||||
virtual string verilogKwd() const { return casez()?"casez":casex()?"casex":"case"; }
|
||||
virtual bool same(AstNode* samep) const {
|
||||
return m_casex==samep->castCase()->m_casex; }
|
||||
bool casex() const { return m_casex==AstCaseType::CASEX; }
|
||||
bool casez() const { return m_casex==AstCaseType::CASEZ; }
|
||||
bool casex() const { return m_casex==AstCaseType::CT_CASEX; }
|
||||
bool casez() const { return m_casex==AstCaseType::CT_CASEZ; }
|
||||
bool fullPragma() const { return m_fullPragma; }
|
||||
void fullPragma(bool flag) { m_fullPragma=flag; }
|
||||
bool parallelPragma() const { return m_parallelPragma; }
|
||||
@ -3294,7 +3294,7 @@ private:
|
||||
public:
|
||||
AstCFunc(FileLine* fl, const string& name, AstScope* scopep, const string& rtnType="")
|
||||
: AstNode(fl) {
|
||||
m_funcType = AstCFuncType::NORMAL;
|
||||
m_funcType = AstCFuncType::FT_NORMAL;
|
||||
m_scopep = scopep;
|
||||
m_name = name;
|
||||
m_rtnType = rtnType;
|
||||
@ -3331,7 +3331,7 @@ public:
|
||||
AstScope* scopep() const { return m_scopep; }
|
||||
void scopep(AstScope* nodep) { m_scopep = nodep; }
|
||||
string rtnTypeVoid() const { return ((m_rtnType=="") ? "void" : m_rtnType); }
|
||||
bool dontCombine() const { return m_dontCombine || funcType()!=AstCFuncType::NORMAL; }
|
||||
bool dontCombine() const { return m_dontCombine || funcType()!=AstCFuncType::FT_NORMAL; }
|
||||
void dontCombine(bool flag) { m_dontCombine = flag; }
|
||||
bool skipDecl() const { return m_skipDecl; }
|
||||
void skipDecl(bool flag) { m_skipDecl = flag; }
|
||||
|
@ -76,9 +76,9 @@ private:
|
||||
// Compute
|
||||
int likeness = ifLikely - ifUnlikely - (elseLikely - elseUnlikely);
|
||||
if (likeness>0) {
|
||||
nodep->branchPred(AstBranchPred::LIKELY);
|
||||
nodep->branchPred(AstBranchPred::BP_LIKELY);
|
||||
} else if (likeness<0) {
|
||||
nodep->branchPred(AstBranchPred::UNLIKELY);
|
||||
nodep->branchPred(AstBranchPred::BP_UNLIKELY);
|
||||
} // else leave unknown
|
||||
}
|
||||
m_likely = lastLikely;
|
||||
|
@ -52,7 +52,7 @@ private:
|
||||
AstUser2InUse m_inuser2;
|
||||
|
||||
// TYPES
|
||||
enum CleanState { UNKNOWN, CLEAN, DIRTY };
|
||||
enum CleanState { CS_UNKNOWN, CS_CLEAN, CS_DIRTY };
|
||||
|
||||
// STATE
|
||||
AstNodeModule* m_modp;
|
||||
@ -93,15 +93,15 @@ private:
|
||||
}
|
||||
bool isClean(AstNode* nodep) {
|
||||
CleanState clstate = getCleanState(nodep);
|
||||
if (clstate==CLEAN) return true;
|
||||
if (clstate==DIRTY) return false;
|
||||
if (clstate==CS_CLEAN) return true;
|
||||
if (clstate==CS_DIRTY) return false;
|
||||
nodep->v3fatalSrc("Unknown clean state on node: "+nodep->prettyTypeName());
|
||||
return false;
|
||||
}
|
||||
void setClean(AstNode* nodep, bool isClean) {
|
||||
computeCppWidth (nodep); // Just to be sure it's in widthMin
|
||||
bool wholeUint = ((nodep->widthMin() % VL_WORDSIZE) == 0); //32,64,...
|
||||
setCleanState(nodep, ((isClean||wholeUint) ? CLEAN:DIRTY));
|
||||
setCleanState(nodep, ((isClean||wholeUint) ? CS_CLEAN:CS_DIRTY));
|
||||
}
|
||||
|
||||
// Operate on nodes
|
||||
|
@ -123,7 +123,7 @@ private:
|
||||
// LOWEDGE: ~var
|
||||
AstNode* newp = NULL;
|
||||
AstVarScope* clkvscp = nodep->varrefp()->varScopep();
|
||||
if (nodep->edgeType()==AstEdgeType::POSEDGE) {
|
||||
if (nodep->edgeType()==AstEdgeType::ET_POSEDGE) {
|
||||
AstVarScope* lastVscp = getCreateLastClk(clkvscp);
|
||||
newp = new AstAnd(nodep->fileline(),
|
||||
new AstVarRef(nodep->fileline(),
|
||||
@ -131,23 +131,23 @@ private:
|
||||
new AstNot(nodep->fileline(),
|
||||
new AstVarRef(nodep->fileline(),
|
||||
lastVscp, false)));
|
||||
} else if (nodep->edgeType()==AstEdgeType::NEGEDGE) {
|
||||
} else if (nodep->edgeType()==AstEdgeType::ET_NEGEDGE) {
|
||||
AstVarScope* lastVscp = getCreateLastClk(clkvscp);
|
||||
newp = new AstAnd(nodep->fileline(),
|
||||
new AstNot(nodep->fileline(),
|
||||
new AstVarRef(nodep->fileline(),
|
||||
nodep->varrefp()->varScopep(), false)),
|
||||
new AstVarRef(nodep->fileline(), lastVscp, false));
|
||||
} else if (nodep->edgeType()==AstEdgeType::BOTHEDGE) {
|
||||
} else if (nodep->edgeType()==AstEdgeType::ET_BOTHEDGE) {
|
||||
AstVarScope* lastVscp = getCreateLastClk(clkvscp);
|
||||
newp = new AstXor(nodep->fileline(),
|
||||
new AstVarRef(nodep->fileline(),
|
||||
nodep->varrefp()->varScopep(), false),
|
||||
new AstVarRef(nodep->fileline(), lastVscp, false));
|
||||
} else if (nodep->edgeType()==AstEdgeType::HIGHEDGE) {
|
||||
} else if (nodep->edgeType()==AstEdgeType::ET_HIGHEDGE) {
|
||||
newp = new AstVarRef(nodep->fileline(),
|
||||
clkvscp, false);
|
||||
} else if (nodep->edgeType()==AstEdgeType::LOWEDGE) {
|
||||
} else if (nodep->edgeType()==AstEdgeType::ET_LOWEDGE) {
|
||||
newp = new AstNot(nodep->fileline(),
|
||||
new AstVarRef(nodep->fileline(),
|
||||
clkvscp, false));
|
||||
@ -506,7 +506,7 @@ private:
|
||||
ifstmtp->addNext(new AstIf(fl,
|
||||
new AstLt (fl, new AstConst(fl, 100),
|
||||
new AstVarRef(fl, countVarp, false)),
|
||||
(new AstDisplay (fl, AstDisplayType::DISPLAY,
|
||||
(new AstDisplay (fl, AstDisplayType::DT_DISPLAY,
|
||||
"%%Error: Verilated model didn't converge", NULL, NULL))
|
||||
->addNext(new AstStop (fl)),
|
||||
NULL));
|
||||
|
@ -1106,7 +1106,7 @@ private:
|
||||
|
||||
virtual void visit(AstAttrOf* nodep, AstNUser*) {
|
||||
// Don't iterate children, don't want to loose VarRef.
|
||||
if (nodep->attrType()==AstAttrType::BITS) {
|
||||
if (nodep->attrType()==AstAttrType::EXPR_BITS) {
|
||||
if (!nodep->fromp() || !nodep->fromp()->widthMin()) nodep->v3fatalSrc("Unsized expression");
|
||||
V3Number num (nodep->fileline(), 32, nodep->fromp()->widthMin());
|
||||
replaceNum(nodep, num); nodep=NULL;
|
||||
@ -1278,16 +1278,16 @@ private:
|
||||
if ((litemp->varrefp() && ritemp->varrefp() && litemp->varrefp()->sameTree(ritemp->varrefp()))
|
||||
|| (!litemp->varrefp() && !ritemp->varrefp())) {
|
||||
// We've sorted in the order ANY, BOTH, POS, NEG, so we don't need to try opposite orders
|
||||
if (( litemp->edgeType()==AstEdgeType::ANYEDGE) // ANY or {BOTH|POS|NEG} -> ANY
|
||||
|| (litemp->edgeType()==AstEdgeType::BOTHEDGE) // BOTH or {POS|NEG} -> BOTH
|
||||
|| (litemp->edgeType()==AstEdgeType::POSEDGE // POS or NEG -> BOTH
|
||||
&& ritemp->edgeType()==AstEdgeType::NEGEDGE)
|
||||
if (( litemp->edgeType()==AstEdgeType::ET_ANYEDGE) // ANY or {BOTH|POS|NEG} -> ANY
|
||||
|| (litemp->edgeType()==AstEdgeType::ET_BOTHEDGE) // BOTH or {POS|NEG} -> BOTH
|
||||
|| (litemp->edgeType()==AstEdgeType::ET_POSEDGE // POS or NEG -> BOTH
|
||||
&& ritemp->edgeType()==AstEdgeType::ET_NEGEDGE)
|
||||
|| (litemp->edgeType()==ritemp->edgeType()) // Identical edges
|
||||
) {
|
||||
// Fix edge of old node
|
||||
if (litemp->edgeType()==AstEdgeType::POSEDGE
|
||||
&& ritemp->edgeType()==AstEdgeType::NEGEDGE)
|
||||
litemp->edgeType(AstEdgeType::BOTHEDGE);
|
||||
if (litemp->edgeType()==AstEdgeType::ET_POSEDGE
|
||||
&& ritemp->edgeType()==AstEdgeType::ET_NEGEDGE)
|
||||
litemp->edgeType(AstEdgeType::ET_BOTHEDGE);
|
||||
// Remove redundant node
|
||||
ritemp->unlinkFrBack()->deleteTree(); ritemp=NULL; cmpp=NULL;
|
||||
// Try to collapse again
|
||||
|
@ -166,7 +166,7 @@ private:
|
||||
}
|
||||
}
|
||||
// Not really any way the user could do this, and we'd need to come up with some return value
|
||||
//newfuncp->addStmtsp(new AstDisplay (newfuncp->fileline(), AstDisplayType::DISPLAY,
|
||||
//newfuncp->addStmtsp(new AstDisplay (newfuncp->fileline(), AstDisplayType::DT_DISPLAY,
|
||||
// string("%%Error: ")+name+"() called with bad scope", NULL));
|
||||
//newfuncp->addStmtsp(new AstStop (newfuncp->fileline()));
|
||||
if (debug()>=9) newfuncp->dumpTree(cout," newfunc: ");
|
||||
|
@ -371,11 +371,11 @@ public:
|
||||
}
|
||||
virtual void visit(AstNodeIf* nodep, AstNUser*) {
|
||||
puts("if (");
|
||||
if (nodep->branchPred() != AstBranchPred::UNKNOWN) {
|
||||
if (nodep->branchPred() != AstBranchPred::BP_UNKNOWN) {
|
||||
puts(nodep->branchPred().ascii()); puts("(");
|
||||
}
|
||||
nodep->condp()->iterateAndNext(*this);
|
||||
if (nodep->branchPred() != AstBranchPred::UNKNOWN) puts(")");
|
||||
if (nodep->branchPred() != AstBranchPred::BP_UNKNOWN) puts(")");
|
||||
puts(") {\n");
|
||||
nodep->ifsp()->iterateAndNext(*this);
|
||||
if (nodep->elsesp()) {
|
||||
|
@ -41,10 +41,10 @@ int V3Error::s_warnCount = 0;
|
||||
int V3Error::s_debugDefault = 0;
|
||||
int V3Error::s_tellManual = 0;
|
||||
ostringstream V3Error::s_errorStr; // Error string being formed
|
||||
V3ErrorCode V3Error::s_errorCode = V3ErrorCode::FATAL;
|
||||
bool V3Error::s_describedEachWarn[V3ErrorCode::MAX];
|
||||
V3ErrorCode V3Error::s_errorCode = V3ErrorCode::EC_FATAL;
|
||||
bool V3Error::s_describedEachWarn[V3ErrorCode::_ENUM_MAX];
|
||||
bool V3Error::s_describedWarnings = false;
|
||||
bool V3Error::s_pretendError[V3ErrorCode::MAX];
|
||||
bool V3Error::s_pretendError[V3ErrorCode::_ENUM_MAX];
|
||||
|
||||
struct v3errorIniter {
|
||||
v3errorIniter() { V3Error::init(); }
|
||||
@ -56,13 +56,13 @@ v3errorIniter v3errorInit;
|
||||
|
||||
V3ErrorCode::V3ErrorCode(const char* msgp) {
|
||||
// Return error encoding for given string, or ERROR, which is a bad code
|
||||
for (int codei=V3ErrorCode::FIRST_WARN; codei<V3ErrorCode::MAX; codei++) {
|
||||
for (int codei=V3ErrorCode::EC_FIRST_WARN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
|
||||
V3ErrorCode code = (V3ErrorCode)codei;
|
||||
if (0==strcasecmp(msgp,code.ascii())) {
|
||||
m_e = code; return;
|
||||
}
|
||||
}
|
||||
m_e = V3ErrorCode::ERROR;
|
||||
m_e = V3ErrorCode::EC_ERROR;
|
||||
}
|
||||
|
||||
//######################################################################
|
||||
@ -73,7 +73,7 @@ FileLine::FileLine(FileLine::EmptySecret) {
|
||||
m_filename="COMMAND_LINE";
|
||||
|
||||
m_warnOn=0;
|
||||
for (int codei=V3ErrorCode::MIN; codei<V3ErrorCode::MAX; codei++) {
|
||||
for (int codei=V3ErrorCode::EC_MIN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
|
||||
V3ErrorCode code = (V3ErrorCode)codei;
|
||||
warnOff(code, code.defaultsOff());
|
||||
}
|
||||
@ -107,7 +107,7 @@ void FileLine::lineDirective(const char* textp) {
|
||||
|
||||
bool FileLine::warnOff(const string& msg, bool flag) {
|
||||
V3ErrorCode code (msg.c_str());
|
||||
if (code < V3ErrorCode::FIRST_WARN) {
|
||||
if (code < V3ErrorCode::EC_FIRST_WARN) {
|
||||
return false;
|
||||
} else {
|
||||
warnOff(code, flag);
|
||||
@ -116,7 +116,7 @@ bool FileLine::warnOff(const string& msg, bool flag) {
|
||||
}
|
||||
|
||||
void FileLine::warnLintOff(bool flag) {
|
||||
for (int codei=V3ErrorCode::FIRST_WARN; codei<V3ErrorCode::MAX; codei++) {
|
||||
for (int codei=V3ErrorCode::EC_FIRST_WARN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
|
||||
V3ErrorCode code = (V3ErrorCode)codei;
|
||||
if (code.lintError()) warnOff(code, flag);
|
||||
}
|
||||
@ -180,7 +180,7 @@ bool FileLine::warnIsOff(V3ErrorCode code) const {
|
||||
|
||||
void FileLine::modifyStateInherit(const FileLine* fromp) {
|
||||
// Any warnings that are off in "from", become off in "this".
|
||||
for (int codei=V3ErrorCode::FIRST_WARN; codei<V3ErrorCode::MAX; codei++) {
|
||||
for (int codei=V3ErrorCode::EC_FIRST_WARN; codei<V3ErrorCode::_ENUM_MAX; codei++) {
|
||||
V3ErrorCode code = (V3ErrorCode)codei;
|
||||
if (fromp->warnIsOff(code)) {
|
||||
this->warnOff(code, true);
|
||||
@ -242,13 +242,13 @@ void FileLine::deleteAllRemaining() {
|
||||
// V3Error class functions
|
||||
|
||||
void V3Error::init() {
|
||||
for (int i=0; i<V3ErrorCode::MAX; i++) {
|
||||
for (int i=0; i<V3ErrorCode::_ENUM_MAX; i++) {
|
||||
s_describedEachWarn[i] = false;
|
||||
s_pretendError[i] = V3ErrorCode(i).pretendError();
|
||||
}
|
||||
|
||||
if (string(V3ErrorCode(V3ErrorCode::MAX).ascii()) != " MAX") {
|
||||
v3fatalSrc("Enum table in V3ErrorCode::ascii() is munged");
|
||||
if (string(V3ErrorCode(V3ErrorCode::_ENUM_MAX).ascii()) != " MAX") {
|
||||
v3fatalSrc("Enum table in V3ErrorCode::EC_ascii() is munged");
|
||||
}
|
||||
}
|
||||
|
||||
@ -288,22 +288,22 @@ void V3Error::abortIfWarnings() {
|
||||
}
|
||||
|
||||
bool V3Error::isError(V3ErrorCode code) {
|
||||
if (code==V3ErrorCode::SUPPRESS) return false;
|
||||
else if (code==V3ErrorCode::INFO) return false;
|
||||
else if (code==V3ErrorCode::FATAL) return true;
|
||||
else if (code==V3ErrorCode::FATALSRC) return true;
|
||||
else if (code==V3ErrorCode::ERROR) return true;
|
||||
else if (code<V3ErrorCode::FIRST_WARN
|
||||
if (code==V3ErrorCode::EC_SUPPRESS) return false;
|
||||
else if (code==V3ErrorCode::EC_INFO) return false;
|
||||
else if (code==V3ErrorCode::EC_FATAL) return true;
|
||||
else if (code==V3ErrorCode::EC_FATALSRC) return true;
|
||||
else if (code==V3ErrorCode::EC_ERROR) return true;
|
||||
else if (code<V3ErrorCode::EC_FIRST_WARN
|
||||
|| s_pretendError[code]) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
string V3Error::msgPrefix(V3ErrorCode code) {
|
||||
if (code==V3ErrorCode::SUPPRESS) return "-arning-suppressed: ";
|
||||
else if (code==V3ErrorCode::INFO) return "-Info: ";
|
||||
else if (code==V3ErrorCode::FATAL) return "%Error: ";
|
||||
else if (code==V3ErrorCode::FATALSRC) return "%Error: Internal Error: ";
|
||||
else if (code==V3ErrorCode::ERROR) return "%Error: ";
|
||||
if (code==V3ErrorCode::EC_SUPPRESS) return "-arning-suppressed: ";
|
||||
else if (code==V3ErrorCode::EC_INFO) return "-Info: ";
|
||||
else if (code==V3ErrorCode::EC_FATAL) return "%Error: ";
|
||||
else if (code==V3ErrorCode::EC_FATALSRC) return "%Error: Internal Error: ";
|
||||
else if (code==V3ErrorCode::EC_ERROR) return "%Error: ";
|
||||
else if (isError(code)) return "%Error-"+(string)code.ascii()+": ";
|
||||
else return "%Warning-"+(string)code.ascii()+": ";
|
||||
}
|
||||
@ -336,29 +336,29 @@ string V3Error::v3sform (const char* format, ...) {
|
||||
}
|
||||
|
||||
void V3Error::suppressThisWarning() {
|
||||
if (s_errorCode>=V3ErrorCode::FIRST_WARN) {
|
||||
if (s_errorCode>=V3ErrorCode::EC_FIRST_WARN) {
|
||||
V3Stats::addStatSum(string("Warnings, Suppressed ")+s_errorCode.ascii(), 1);
|
||||
s_errorCode=V3ErrorCode::SUPPRESS;
|
||||
s_errorCode=V3ErrorCode::EC_SUPPRESS;
|
||||
}
|
||||
}
|
||||
|
||||
void V3Error::v3errorEnd (ostringstream& sstr) {
|
||||
#ifdef __COVERITY__
|
||||
if (s_errorCode==V3ErrorCode::FATAL) __coverity_panic__(x);
|
||||
if (s_errorCode==V3ErrorCode::EC_FATAL) __coverity_panic__(x);
|
||||
#endif
|
||||
if (s_errorCode!=V3ErrorCode::SUPPRESS
|
||||
if (s_errorCode!=V3ErrorCode::EC_SUPPRESS
|
||||
// On debug, show only non default-off warning to prevent pages of warnings
|
||||
|| (debug() && !s_errorCode.defaultsOff())) {
|
||||
cerr<<msgPrefix()<<sstr.str();
|
||||
if (sstr.str()[sstr.str().length()-1] != '\n') {
|
||||
cerr<<endl;
|
||||
}
|
||||
if (s_errorCode!=V3ErrorCode::SUPPRESS
|
||||
&& s_errorCode!=V3ErrorCode::INFO) {
|
||||
if (s_errorCode!=V3ErrorCode::EC_SUPPRESS
|
||||
&& s_errorCode!=V3ErrorCode::EC_INFO) {
|
||||
if (!s_describedEachWarn[s_errorCode]
|
||||
&& !s_pretendError[s_errorCode]) {
|
||||
s_describedEachWarn[s_errorCode] = true;
|
||||
if (s_errorCode>=V3ErrorCode::FIRST_WARN && !s_describedWarnings) {
|
||||
if (s_errorCode>=V3ErrorCode::EC_FIRST_WARN && !s_describedWarnings) {
|
||||
cerr<<msgPrefix()<<"Use \"/* verilator lint_off "<<s_errorCode.ascii()
|
||||
<<" */\" and lint_on around source to disable this message."<<endl;
|
||||
s_describedWarnings = true;
|
||||
@ -380,8 +380,8 @@ void V3Error::v3errorEnd (ostringstream& sstr) {
|
||||
}
|
||||
if (isError(s_errorCode)) incErrors();
|
||||
else incWarnings();
|
||||
if (s_errorCode==V3ErrorCode::FATAL
|
||||
|| s_errorCode==V3ErrorCode::FATALSRC) {
|
||||
if (s_errorCode==V3ErrorCode::EC_FATAL
|
||||
|| s_errorCode==V3ErrorCode::EC_FATALSRC) {
|
||||
static bool inFatal = false;
|
||||
if (!inFatal) {
|
||||
inFatal = true;
|
||||
|
@ -34,13 +34,13 @@
|
||||
class V3ErrorCode {
|
||||
public:
|
||||
enum en {
|
||||
MIN=0, // Keep first
|
||||
EC_MIN=0, // Keep first
|
||||
//
|
||||
SUPPRESS, // Warning suppressed by user
|
||||
INFO, // General information out
|
||||
FATAL, // Kill the program
|
||||
FATALSRC, // Kill the program, for internal source errors
|
||||
ERROR, // General error out, can't suppress
|
||||
EC_SUPPRESS, // Warning suppressed by user
|
||||
EC_INFO, // General information out
|
||||
EC_FATAL, // Kill the program
|
||||
EC_FATALSRC, // Kill the program, for internal source errors
|
||||
EC_ERROR, // General error out, can't suppress
|
||||
// Boolean information we track per-line, but aren't errors
|
||||
I_COVERAGE, // Coverage is on/off from /*verilator coverage_on/off*/
|
||||
I_TRACING, // Tracing is on/off from /*verilator tracing_on/off*/
|
||||
@ -49,7 +49,7 @@ public:
|
||||
E_TASKNSVAR, // Error: Task I/O not simple
|
||||
E_BLKLOOPINIT, // Error: Delayed assignment to array inside for loops
|
||||
// Warning codes:
|
||||
FIRST_WARN, // Just a code so the program knows where to start warnings
|
||||
EC_FIRST_WARN, // Just a code so the program knows where to start warnings
|
||||
//
|
||||
BLKANDNBLK, // Blocked and non-blocking assignments to same variable
|
||||
CASEINCOMPLETE, // Case statement has missing values
|
||||
@ -77,7 +77,7 @@ public:
|
||||
VARHIDDEN, // Hiding variable
|
||||
WIDTH, // Width mismatch
|
||||
WIDTHCONCAT, // Unsized numbers/parameters in concatenations
|
||||
MAX
|
||||
_ENUM_MAX
|
||||
// ***Add new elements below also***
|
||||
};
|
||||
enum en m_e;
|
||||
@ -115,7 +115,7 @@ public:
|
||||
// Later -Werror- options may make more of these.
|
||||
bool pretendError() const { return ( m_e==BLKANDNBLK || m_e==IMPURE || m_e==MODDUP || m_e==SYMRSVDWORD); }
|
||||
// Warnings to mention manual
|
||||
bool mentionManual() const { return ( m_e==FATALSRC || pretendError() ); }
|
||||
bool mentionManual() const { return ( m_e==EC_FATALSRC || pretendError() ); }
|
||||
|
||||
// Warnings that are lint only
|
||||
bool lintError() const { return ( m_e==CASEINCOMPLETE || m_e==CASEOVERLAP
|
||||
@ -138,8 +138,8 @@ class V3Error {
|
||||
// Base class for any object that wants debugging and error reporting
|
||||
private:
|
||||
static bool s_describedWarnings; // Told user how to disable warns
|
||||
static bool s_describedEachWarn[V3ErrorCode::MAX]; // Told user specifics about this warning
|
||||
static bool s_pretendError[V3ErrorCode::MAX]; // Pretend this warning is an error
|
||||
static bool s_describedEachWarn[V3ErrorCode::_ENUM_MAX]; // Told user specifics about this warning
|
||||
static bool s_pretendError[V3ErrorCode::_ENUM_MAX]; // Pretend this warning is an error
|
||||
static int s_debugDefault; // Default debugging level
|
||||
static int s_errCount; // Error count
|
||||
static int s_warnCount; // Error count
|
||||
@ -189,11 +189,11 @@ inline void v3errorEnd(ostringstream& sstr) { V3Error::v3errorEnd(sstr); }
|
||||
// Careful, you can't put () around msg, as you would in most macro definitions
|
||||
#define v3warnCode(code,msg) v3errorEnd(((V3Error::v3errorPrep(code)<<msg),V3Error::v3errorStr()));
|
||||
#define v3warn(code,msg) v3warnCode(V3ErrorCode::code,msg)
|
||||
#define v3info(msg) v3warn(INFO,msg)
|
||||
#define v3fatal(msg) v3warn(FATAL,msg)
|
||||
#define v3error(msg) v3warn(ERROR,msg)
|
||||
#define v3info(msg) v3warn(EC_INFO,msg)
|
||||
#define v3fatal(msg) v3warn(EC_FATAL,msg)
|
||||
#define v3error(msg) v3warn(EC_ERROR,msg)
|
||||
// Use this instead of fatal() to mention the source code line.
|
||||
#define v3fatalSrc(msg) v3warn(FATALSRC,__FILE__<<":"<<dec<<__LINE__<<": "<<msg)
|
||||
#define v3fatalSrc(msg) v3warn(EC_FATALSRC,__FILE__<<":"<<dec<<__LINE__<<": "<<msg)
|
||||
|
||||
#define UINFO(level,stmsg) {if(debug()>=(level)) { cout<<"- "<<V3Error::lineStr(__FILE__,__LINE__)<<stmsg; }}
|
||||
#define UINFONL(level,stmsg) {if(debug()>=(level)) { cout<<stmsg; } }
|
||||
@ -225,7 +225,7 @@ class FileLine {
|
||||
// File and line number of an object, mostly for error reporting
|
||||
int m_lineno;
|
||||
string m_filename;
|
||||
bitset<V3ErrorCode::MAX> m_warnOn;
|
||||
bitset<V3ErrorCode::_ENUM_MAX> m_warnOn;
|
||||
static FileLine s_defaultFileLine;
|
||||
struct EmptySecret {};
|
||||
protected:
|
||||
|
@ -69,9 +69,9 @@ private:
|
||||
}
|
||||
|
||||
void checkExpected(AstNode* nodep) {
|
||||
if (m_exp != AstParseRefExp::NONE) {
|
||||
if (m_exp != AstParseRefExp::PX_NONE) {
|
||||
nodep->v3fatalSrc("Tree syntax error: Not expecting "<<nodep->type()<<" under a "<<nodep->backp()->type());
|
||||
m_exp = AstParseRefExp::NONE;
|
||||
m_exp = AstParseRefExp::PX_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,9 +84,9 @@ private:
|
||||
// Due to a need to get the arguments, the ParseRefs are under here,
|
||||
// rather than the NodeFTaskRef under the ParseRef.
|
||||
if (nodep->namep()) {
|
||||
m_exp = AstParseRefExp::FUNC;
|
||||
m_exp = AstParseRefExp::PX_FUNC;
|
||||
nodep->namep()->accept(*this); // No next, we don't want to do the edit
|
||||
m_exp = AstParseRefExp::NONE;
|
||||
m_exp = AstParseRefExp::PX_NONE;
|
||||
if (!m_baseTextp) nodep->v3fatalSrc("No TEXT found to indicate function name");
|
||||
nodep->name(m_baseTextp->text());
|
||||
nodep->dotted(m_dotText);
|
||||
@ -112,14 +112,14 @@ private:
|
||||
// Process lower nodes
|
||||
m_dotText = "";
|
||||
m_baseTextp = NULL;
|
||||
if (m_exp == AstParseRefExp::FUNC) {
|
||||
if (m_exp == AstParseRefExp::PX_FUNC) {
|
||||
lhsp->accept(*this);
|
||||
// Return m_dotText to invoker
|
||||
} else if (nodep->expect() == AstParseRefExp::VAR_MEM
|
||||
|| nodep->expect() == AstParseRefExp::VAR_ANY) {
|
||||
} else if (nodep->expect() == AstParseRefExp::PX_VAR_MEM
|
||||
|| nodep->expect() == AstParseRefExp::PX_VAR_ANY) {
|
||||
m_exp = nodep->expect();
|
||||
lhsp->accept(*this);
|
||||
m_exp = AstParseRefExp::NONE;
|
||||
m_exp = AstParseRefExp::PX_NONE;
|
||||
if (!m_baseTextp) nodep->v3fatalSrc("No TEXT found to indicate function name");
|
||||
if (m_dotText == "") {
|
||||
AstNode* newp = new AstVarRef(nodep->fileline(), m_baseTextp->text(), false); // lvalue'ness computed later
|
||||
@ -133,7 +133,7 @@ private:
|
||||
}
|
||||
nodep->deleteTree(); nodep=NULL;
|
||||
}
|
||||
if (m_exp != AstParseRefExp::FUNC) { // Fuctions need to look at the name themself
|
||||
if (m_exp != AstParseRefExp::PX_FUNC) { // Fuctions need to look at the name themself
|
||||
m_dotText = oldText;
|
||||
m_inModDot = oldDot;
|
||||
m_exp = oldExp;
|
||||
@ -177,14 +177,14 @@ private:
|
||||
nodep->v3error("Unsupported: Non-constant inside []'s in the cell part of a dotted reference");
|
||||
}
|
||||
// And pass up m_dotText
|
||||
} else if (m_exp==AstParseRefExp::FUNC) {
|
||||
} else if (m_exp==AstParseRefExp::PX_FUNC) {
|
||||
nodep->v3error("Syntax Error: Range selection '[]' is not allowed as part of function names");
|
||||
} else {
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
AstParseRefExp lastExp = m_exp;
|
||||
AstText* lasttextp = m_baseTextp;
|
||||
{
|
||||
m_exp = AstParseRefExp::NONE;
|
||||
m_exp = AstParseRefExp::PX_NONE;
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
}
|
||||
m_baseTextp = lasttextp;
|
||||
@ -198,16 +198,16 @@ private:
|
||||
nodep->user1(true); // Process only once.
|
||||
if (m_inModDot) { // Already under dot, so this is {modulepart} DOT {modulepart}
|
||||
nodep->v3error("Syntax Error: Range ':', '+:' etc are not allowed in the cell part of a dotted reference");
|
||||
} else if (m_exp==AstParseRefExp::FUNC) {
|
||||
} else if (m_exp==AstParseRefExp::PX_FUNC) {
|
||||
nodep->v3error("Syntax Error: Range ':', '+:' etc are not allowed as part of function names");
|
||||
} else if (m_exp==AstParseRefExp::VAR_MEM) {
|
||||
} else if (m_exp==AstParseRefExp::PX_VAR_MEM) {
|
||||
nodep->v3error("Syntax Error: Range ':', '+:' etc are not allowed when expecting memory reference");
|
||||
} else {
|
||||
nodep->lhsp()->iterateAndNext(*this);
|
||||
AstParseRefExp lastExp = m_exp;
|
||||
AstText* lasttextp = m_baseTextp;
|
||||
{
|
||||
m_exp = AstParseRefExp::NONE;
|
||||
m_exp = AstParseRefExp::PX_NONE;
|
||||
nodep->rhsp()->iterateAndNext(*this);
|
||||
nodep->thsp()->iterateAndNext(*this);
|
||||
}
|
||||
@ -219,7 +219,7 @@ private:
|
||||
virtual void visit(AstText* nodep, AstNUser*) {
|
||||
if (!nodep->user1()) {
|
||||
nodep->user1(true); // Process only once.
|
||||
if (m_exp != AstParseRefExp::NONE) {
|
||||
if (m_exp != AstParseRefExp::PX_NONE) {
|
||||
UINFO(7," "<<nodep<<endl);
|
||||
if (m_inModDot) { // Dotted part, just pass up
|
||||
m_dotText = nodep->text();
|
||||
@ -339,7 +339,7 @@ public:
|
||||
// CONSTUCTORS
|
||||
LinkParseVisitor(AstNetlist* rootp) {
|
||||
m_inModDot = false;
|
||||
m_exp = AstParseRefExp::NONE;
|
||||
m_exp = AstParseRefExp::PX_NONE;
|
||||
m_baseTextp = NULL;
|
||||
m_varp = NULL;
|
||||
rootp->accept(*this);
|
||||
|
@ -324,10 +324,10 @@ private:
|
||||
nodep->iterateChildren(*this);
|
||||
if (nodep->filep()) expectDescriptor(nodep, nodep->filep()->castNodeVarRef());
|
||||
if (!m_assertp
|
||||
&& (nodep->displayType() == AstDisplayType::INFO
|
||||
|| nodep->displayType() == AstDisplayType::WARNING
|
||||
|| nodep->displayType() == AstDisplayType::ERROR
|
||||
|| nodep->displayType() == AstDisplayType::FATAL)) {
|
||||
&& (nodep->displayType() == AstDisplayType::DT_INFO
|
||||
|| nodep->displayType() == AstDisplayType::DT_WARNING
|
||||
|| nodep->displayType() == AstDisplayType::DT_ERROR
|
||||
|| nodep->displayType() == AstDisplayType::DT_FATAL)) {
|
||||
nodep->v3error(nodep->verilogKwd()+" only allowed under an assertion.");
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ string V3Options::allArgsString() {
|
||||
|
||||
V3LangCode::V3LangCode (const char* textp) {
|
||||
// Return code for given string, or ERROR, which is a bad code
|
||||
for (int codei=V3LangCode::L_ERROR; codei<V3LangCode::MAX; ++codei) {
|
||||
for (int codei=V3LangCode::L_ERROR; codei<V3LangCode::_ENUM_END; ++codei) {
|
||||
V3LangCode code = (V3LangCode)codei;
|
||||
if (0==strcasecmp(textp,code.ascii())) {
|
||||
m_e = code; return;
|
||||
@ -762,7 +762,7 @@ void V3Options::parseOptsList(FileLine* fl, int argc, char** argv) {
|
||||
else if ( !strncmp (sw, "-Werror-",strlen("-Werror-")) ) {
|
||||
string msg = sw+strlen("-Werror-");
|
||||
V3ErrorCode code (msg.c_str());
|
||||
if (code == V3ErrorCode::ERROR) {
|
||||
if (code == V3ErrorCode::EC_ERROR) {
|
||||
if (!isFuture(msg)) {
|
||||
fl->v3fatal("Unknown warning specified: "<<sw);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
L1800_2005,
|
||||
L1800_2009,
|
||||
// ***Add new elements below also***
|
||||
MAX
|
||||
_ENUM_END
|
||||
};
|
||||
const char* ascii() const {
|
||||
const char* names[] = {
|
||||
|
@ -73,7 +73,7 @@ enum OrderLoopId {
|
||||
|
||||
struct OrderVEdgeType {
|
||||
enum en {
|
||||
UNKNOWN = 0,
|
||||
VERTEX_UNKNOWN = 0,
|
||||
VERTEX_INPUTS,
|
||||
VERTEX_SETTLE,
|
||||
VERTEX_LOGIC,
|
||||
|
@ -125,9 +125,9 @@ private:
|
||||
} else {
|
||||
// See which path we want to take
|
||||
bool takeElse = false;
|
||||
if (!nodep->elsesp() || (nodep->branchPred()==AstBranchPred::LIKELY)) {
|
||||
if (!nodep->elsesp() || (nodep->branchPred()==AstBranchPred::BP_LIKELY)) {
|
||||
// Always take the if
|
||||
} else if (!nodep->ifsp() || (nodep->branchPred()==AstBranchPred::UNLIKELY)) {
|
||||
} else if (!nodep->ifsp() || (nodep->branchPred()==AstBranchPred::BP_UNLIKELY)) {
|
||||
// Always take the else
|
||||
} else {
|
||||
// Take the longer path
|
||||
|
@ -458,7 +458,7 @@ private:
|
||||
else condp = selp;
|
||||
}
|
||||
AstIf* ifp = new AstIf (fl, condp, NULL, NULL);
|
||||
ifp->branchPred(AstBranchPred::UNLIKELY);
|
||||
ifp->branchPred(AstBranchPred::BP_UNLIKELY);
|
||||
m_chgFuncp->addStmtsp(ifp);
|
||||
lastactp = &actset;
|
||||
ifnodep = ifp;
|
||||
|
@ -92,7 +92,7 @@ public:
|
||||
return new AstText(fileline, newtext);
|
||||
}
|
||||
AstDisplay* createDisplayError(FileLine* fileline) {
|
||||
AstDisplay* nodep = new AstDisplay(fileline,AstDisplayType::ERROR, "", NULL,NULL);
|
||||
AstDisplay* nodep = new AstDisplay(fileline,AstDisplayType::DT_ERROR, "", NULL,NULL);
|
||||
nodep->addNext(new AstStop(fileline));
|
||||
return nodep;
|
||||
}
|
||||
@ -1711,16 +1711,16 @@ senitem<senitemp>: // IEEE: part of event_expression, non-'OR' ',' terms
|
||||
;
|
||||
|
||||
senitemVar<senitemp>:
|
||||
idClassSel { $$ = new AstSenItem(CRELINE(),AstEdgeType::ANYEDGE,$1); }
|
||||
idClassSel { $$ = new AstSenItem(CRELINE(),AstEdgeType::ET_ANYEDGE,$1); }
|
||||
;
|
||||
|
||||
senitemEdge<senitemp>: // IEEE: part of event_expression
|
||||
yPOSEDGE idClassSel { $$ = new AstSenItem($1,AstEdgeType::POSEDGE,$2); }
|
||||
| yNEGEDGE idClassSel { $$ = new AstSenItem($1,AstEdgeType::NEGEDGE,$2); }
|
||||
| yEDGE idClassSel { $$ = new AstSenItem($1,AstEdgeType::BOTHEDGE,$2); }
|
||||
| yPOSEDGE '(' idClassSel ')' { $$ = new AstSenItem($1,AstEdgeType::POSEDGE,$3); }
|
||||
| yNEGEDGE '(' idClassSel ')' { $$ = new AstSenItem($1,AstEdgeType::NEGEDGE,$3); }
|
||||
| yEDGE '(' idClassSel ')' { $$ = new AstSenItem($1,AstEdgeType::BOTHEDGE,$3); }
|
||||
yPOSEDGE idClassSel { $$ = new AstSenItem($1,AstEdgeType::ET_POSEDGE,$2); }
|
||||
| yNEGEDGE idClassSel { $$ = new AstSenItem($1,AstEdgeType::ET_NEGEDGE,$2); }
|
||||
| yEDGE idClassSel { $$ = new AstSenItem($1,AstEdgeType::ET_BOTHEDGE,$2); }
|
||||
| yPOSEDGE '(' idClassSel ')' { $$ = new AstSenItem($1,AstEdgeType::ET_POSEDGE,$3); }
|
||||
| yNEGEDGE '(' idClassSel ')' { $$ = new AstSenItem($1,AstEdgeType::ET_NEGEDGE,$3); }
|
||||
| yEDGE '(' idClassSel ')' { $$ = new AstSenItem($1,AstEdgeType::ET_BOTHEDGE,$3); }
|
||||
//UNSUP yIFF...
|
||||
;
|
||||
|
||||
@ -1922,9 +1922,9 @@ unique_priorityE<uniqstate>: // IEEE: unique_priority + empty
|
||||
;
|
||||
|
||||
caseStart<casep>: // IEEE: part of case_statement
|
||||
yCASE '(' expr ')' { $$ = GRAMMARP->m_caseAttrp = new AstCase($1,AstCaseType::CASE,$3,NULL); }
|
||||
| yCASEX '(' expr ')' { $$ = GRAMMARP->m_caseAttrp = new AstCase($1,AstCaseType::CASEX,$3,NULL); }
|
||||
| yCASEZ '(' expr ')' { $$ = GRAMMARP->m_caseAttrp = new AstCase($1,AstCaseType::CASEZ,$3,NULL); }
|
||||
yCASE '(' expr ')' { $$ = GRAMMARP->m_caseAttrp = new AstCase($1,AstCaseType::CT_CASE,$3,NULL); }
|
||||
| yCASEX '(' expr ')' { $$ = GRAMMARP->m_caseAttrp = new AstCase($1,AstCaseType::CT_CASEX,$3,NULL); }
|
||||
| yCASEZ '(' expr ')' { $$ = GRAMMARP->m_caseAttrp = new AstCase($1,AstCaseType::CT_CASEZ,$3,NULL); }
|
||||
;
|
||||
|
||||
caseAttrE:
|
||||
@ -1981,16 +1981,16 @@ for_step<nodep>: // IEEE: for_step
|
||||
// Functions/tasks
|
||||
|
||||
taskRef<ftaskrefp>: // IEEE: part of tf_call
|
||||
idDotted { $$ = new AstTaskRef(CRELINE(),new AstParseRef($1->fileline(), AstParseRefExp::TASK, $1),NULL);}
|
||||
| idDotted '(' list_of_argumentsE ')' { $$ = new AstTaskRef(CRELINE(),new AstParseRef($1->fileline(), AstParseRefExp::TASK, $1),$3);}
|
||||
//UNSUP: package_scopeIdFollows idDotted { $$ = new AstTaskRef(CRELINE(),new AstParseRef($2->fileline(), AstParseRefExp::TASK, $2),NULL);}
|
||||
//UNSUP: package_scopeIdFollows idDotted '(' list_of_argumentsE ')' { $$ = new AstTaskRef(CRELINE(),new AstParseRef($2->fileline(), AstParseRefExp::TASK, $2),$4);}
|
||||
idDotted { $$ = new AstTaskRef(CRELINE(),new AstParseRef($1->fileline(), AstParseRefExp::PX_TASK, $1),NULL);}
|
||||
| idDotted '(' list_of_argumentsE ')' { $$ = new AstTaskRef(CRELINE(),new AstParseRef($1->fileline(), AstParseRefExp::PX_TASK, $1),$3);}
|
||||
//UNSUP: package_scopeIdFollows idDotted { $$ = new AstTaskRef(CRELINE(),new AstParseRef($2->fileline(), AstParseRefExp::PX_TASK, $2),NULL);}
|
||||
//UNSUP: package_scopeIdFollows idDotted '(' list_of_argumentsE ')' { $$ = new AstTaskRef(CRELINE(),new AstParseRef($2->fileline(), AstParseRefExp::PX_TASK, $2),$4);}
|
||||
//UNSUP: idDotted is really just id to allow dotted method calls
|
||||
;
|
||||
|
||||
funcRef<ftaskrefp>: // IEEE: part of tf_call
|
||||
idDotted '(' list_of_argumentsE ')' { $$ = new AstFuncRef($2,new AstParseRef($1->fileline(), AstParseRefExp::FUNC, $1), $3); }
|
||||
| package_scopeIdFollows idDotted '(' list_of_argumentsE ')' { $$ = new AstFuncRef($3,new AstParseRef($2->fileline(), AstParseRefExp::FUNC, $2), $4); $$->packagep($1); }
|
||||
idDotted '(' list_of_argumentsE ')' { $$ = new AstFuncRef($2,new AstParseRef($1->fileline(), AstParseRefExp::PX_FUNC, $1), $3); }
|
||||
| package_scopeIdFollows idDotted '(' list_of_argumentsE ')' { $$ = new AstFuncRef($3,new AstParseRef($2->fileline(), AstParseRefExp::PX_FUNC, $2), $4); $$->packagep($1); }
|
||||
//UNSUP: idDotted is really just id to allow dotted method calls
|
||||
;
|
||||
|
||||
@ -2030,22 +2030,22 @@ system_t_call<nodep>: // IEEE: system_tf_call (as task)
|
||||
| yD_SFORMAT '(' expr ',' str commaEListE ')' { $$ = new AstSFormat($1,$3,*$5,$6); }
|
||||
| yD_SWRITE '(' expr ',' str commaEListE ')' { $$ = new AstSFormat($1,$3,*$5,$6); }
|
||||
//
|
||||
| yD_DISPLAY parenE { $$ = new AstDisplay($1,AstDisplayType::DISPLAY,"", NULL,NULL); }
|
||||
| yD_DISPLAY '(' str commaEListE ')' { $$ = new AstDisplay($1,AstDisplayType::DISPLAY,*$3,NULL,$4); }
|
||||
| yD_DISPLAY parenE { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY,"", NULL,NULL); }
|
||||
| yD_DISPLAY '(' str commaEListE ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY,*$3,NULL,$4); }
|
||||
| yD_WRITE parenE { $$ = NULL; } // NOP
|
||||
| yD_WRITE '(' str commaEListE ')' { $$ = new AstDisplay($1,AstDisplayType::WRITE, *$3,NULL,$4); }
|
||||
| yD_FDISPLAY '(' idClassSel ')' { $$ = new AstDisplay($1,AstDisplayType::DISPLAY,"",$3,NULL); }
|
||||
| yD_FDISPLAY '(' idClassSel ',' str commaEListE ')' { $$ = new AstDisplay($1,AstDisplayType::DISPLAY,*$5,$3,$6); }
|
||||
| yD_FWRITE '(' idClassSel ',' str commaEListE ')' { $$ = new AstDisplay($1,AstDisplayType::WRITE, *$5,$3,$6); }
|
||||
| yD_INFO parenE { $$ = new AstDisplay($1,AstDisplayType::INFO, "", NULL,NULL); }
|
||||
| yD_INFO '(' str commaEListE ')' { $$ = new AstDisplay($1,AstDisplayType::INFO, *$3,NULL,$4); }
|
||||
| yD_WARNING parenE { $$ = new AstDisplay($1,AstDisplayType::WARNING,"", NULL,NULL); }
|
||||
| yD_WARNING '(' str commaEListE ')' { $$ = new AstDisplay($1,AstDisplayType::WARNING,*$3,NULL,$4); }
|
||||
| yD_WRITE '(' str commaEListE ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, *$3,NULL,$4); }
|
||||
| yD_FDISPLAY '(' idClassSel ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY,"",$3,NULL); }
|
||||
| yD_FDISPLAY '(' idClassSel ',' str commaEListE ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY,*$5,$3,$6); }
|
||||
| yD_FWRITE '(' idClassSel ',' str commaEListE ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, *$5,$3,$6); }
|
||||
| yD_INFO parenE { $$ = new AstDisplay($1,AstDisplayType::DT_INFO, "", NULL,NULL); }
|
||||
| yD_INFO '(' str commaEListE ')' { $$ = new AstDisplay($1,AstDisplayType::DT_INFO, *$3,NULL,$4); }
|
||||
| yD_WARNING parenE { $$ = new AstDisplay($1,AstDisplayType::DT_WARNING,"", NULL,NULL); }
|
||||
| yD_WARNING '(' str commaEListE ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WARNING,*$3,NULL,$4); }
|
||||
| yD_ERROR parenE { $$ = GRAMMARP->createDisplayError($1); }
|
||||
| yD_ERROR '(' str commaEListE ')' { $$ = new AstDisplay($1,AstDisplayType::ERROR, *$3,NULL,$4); $$->addNext(new AstStop($1)); }
|
||||
| yD_FATAL parenE { $$ = new AstDisplay($1,AstDisplayType::FATAL, "", NULL,NULL); $$->addNext(new AstStop($1)); }
|
||||
| yD_FATAL '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::FATAL, "", NULL,NULL); $$->addNext(new AstStop($1)); if ($3) $3->deleteTree(); }
|
||||
| yD_FATAL '(' expr ',' str commaEListE ')' { $$ = new AstDisplay($1,AstDisplayType::FATAL, *$5,NULL,$6); $$->addNext(new AstStop($1)); if ($3) $3->deleteTree(); }
|
||||
| yD_ERROR '(' str commaEListE ')' { $$ = new AstDisplay($1,AstDisplayType::DT_ERROR, *$3,NULL,$4); $$->addNext(new AstStop($1)); }
|
||||
| yD_FATAL parenE { $$ = new AstDisplay($1,AstDisplayType::DT_FATAL, "", NULL,NULL); $$->addNext(new AstStop($1)); }
|
||||
| yD_FATAL '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::DT_FATAL, "", NULL,NULL); $$->addNext(new AstStop($1)); if ($3) $3->deleteTree(); }
|
||||
| yD_FATAL '(' expr ',' str commaEListE ')' { $$ = new AstDisplay($1,AstDisplayType::DT_FATAL, *$5,NULL,$6); $$->addNext(new AstStop($1)); if ($3) $3->deleteTree(); }
|
||||
//
|
||||
| yD_READMEMB '(' expr ',' varRefMem ')' { $$ = new AstReadMem($1,false,$3,$5,NULL,NULL); }
|
||||
| yD_READMEMB '(' expr ',' varRefMem ',' expr ')' { $$ = new AstReadMem($1,false,$3,$5,$7,NULL); }
|
||||
@ -2062,7 +2062,7 @@ system_f_call<nodep>: // IEEE: system_tf_call (as func)
|
||||
| yaD_DPI parenE { $$ = new AstFuncRef($<fl>1,*$1,NULL); }
|
||||
| yaD_DPI '(' exprList ')' { $$ = new AstFuncRef($2,*$1,$3); }
|
||||
//
|
||||
| yD_BITS '(' expr ')' { $$ = new AstAttrOf($1,AstAttrType::BITS,$3); }
|
||||
| yD_BITS '(' expr ')' { $$ = new AstAttrOf($1,AstAttrType::EXPR_BITS,$3); }
|
||||
| yD_C '(' cStrList ')' { $$ = (v3Global.opt.ignc() ? NULL : new AstUCFunc($1,$3)); }
|
||||
| yD_CLOG2 '(' expr ')' { $$ = new AstCLog2($1,$3); }
|
||||
| yD_COUNTONES '(' expr ')' { $$ = new AstCountOnes($1,$3); }
|
||||
@ -2786,12 +2786,12 @@ variable_lvalueConcList<nodep>: // IEEE: part of variable_lvalue: '{' variable_l
|
||||
|
||||
// VarRef to a Memory
|
||||
varRefMem<parserefp>:
|
||||
idDotted { $$ = new AstParseRef($1->fileline(), AstParseRefExp::VAR_MEM, $1); }
|
||||
idDotted { $$ = new AstParseRef($1->fileline(), AstParseRefExp::PX_VAR_MEM, $1); }
|
||||
;
|
||||
|
||||
// VarRef to dotted, and/or arrayed, and/or bit-ranged variable
|
||||
idClassSel<parserefp>: // Misc Ref to dotted, and/or arrayed, and/or bit-ranged variable
|
||||
idDotted { $$ = new AstParseRef($1->fileline(), AstParseRefExp::VAR_ANY, $1); }
|
||||
idDotted { $$ = new AstParseRef($1->fileline(), AstParseRefExp::PX_VAR_ANY, $1); }
|
||||
// // IEEE: [ implicit_class_handle . | package_scope ] hierarchical_variable_identifier select
|
||||
//UNSUP yTHIS '.' idDotted { UNSUP }
|
||||
//UNSUP ySUPER '.' idDotted { UNSUP }
|
||||
@ -3005,7 +3005,7 @@ vltOffFront<errcodeen>:
|
||||
| yVLT_TRACING_OFF { $$ = V3ErrorCode::I_TRACING; }
|
||||
| yVLT_LINT_OFF yVLT_D_MSG yaID__ETC
|
||||
{ $$ = V3ErrorCode((*$3).c_str());
|
||||
if ($$ == V3ErrorCode::ERROR) { $1->v3error("Unknown Error Code: "<<*$3<<endl); } }
|
||||
if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown Error Code: "<<*$3<<endl); } }
|
||||
;
|
||||
|
||||
//**********************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user