diff --git a/src/V3Active.cpp b/src/V3Active.cpp index 987b058fa..44b6bf0a7 100644 --- a/src/V3Active.cpp +++ b/src/V3Active.cpp @@ -392,14 +392,14 @@ private: } virtual void visit(AstSenGate* nodep) { AstSenItem* subitemp = nodep->sensesp(); - UASSERT_OBJ(subitemp->edgeType() == AstEdgeType::ET_ANYEDGE - || subitemp->edgeType() == AstEdgeType::ET_POSEDGE - || subitemp->edgeType() == AstEdgeType::ET_NEGEDGE, + UASSERT_OBJ(subitemp->edgeType() == VEdgeType::ET_ANYEDGE + || subitemp->edgeType() == VEdgeType::ET_POSEDGE + || subitemp->edgeType() == VEdgeType::ET_NEGEDGE, nodep, "Strange activity type under SenGate"); iterateChildren(nodep); } virtual void visit(AstSenItem* nodep) { - if (nodep->edgeType() == AstEdgeType::ET_ANYEDGE) { + if (nodep->edgeType() == VEdgeType::ET_ANYEDGE) { m_itemCombo = true; // Delete the sensitivity // We'll add it as a generic COMBO SenItem in a moment. diff --git a/src/V3Assert.cpp b/src/V3Assert.cpp index dcdf99a23..9f1d695f8 100644 --- a/src/V3Assert.cpp +++ b/src/V3Assert.cpp @@ -44,10 +44,10 @@ private: AstNodeModule* m_modp; // Last module AstBegin* m_beginp; // Last begin unsigned m_modPastNum; // Module past numbering - V3Double0 m_statAsCover; // Statistic tracking - V3Double0 m_statAsPsl; // Statistic tracking - V3Double0 m_statAsFull; // Statistic tracking - V3Double0 m_statAsSV; // Statistic tracking + VDouble0 m_statAsCover; // Statistic tracking + VDouble0 m_statAsPsl; // Statistic tracking + VDouble0 m_statAsFull; // Statistic tracking + VDouble0 m_statAsSV; // Statistic tracking // METHODS string assertDisplayMessage(AstNode* nodep, const string& prefix, const string& message) { @@ -143,7 +143,7 @@ private: ifp = new AstIf(nodep->fileline(), propp, NULL, stmtsp); // It's more LIKELY that we'll take the NULL if clause // than the sim-killing else clause: - ifp->branchPred(AstBranchPred::BP_LIKELY); + ifp->branchPred(VBranchPred::BP_LIKELY); bodysp = newIfAssertOn(ifp); } else if (VN_IS(nodep, PslRestrict)) { // IEEE says simulator ignores these @@ -182,7 +182,7 @@ private: AstIf* ifp = new AstIf(nodep->fileline(), propp, passsp, failsp); AstNode* newp = ifp; - if (VN_IS(nodep, VAssert)) ifp->branchPred(AstBranchPred::BP_UNLIKELY); + if (VN_IS(nodep, VAssert)) ifp->branchPred(VBranchPred::BP_UNLIKELY); // // Install it nodep->replaceWith(newp); @@ -242,7 +242,7 @@ private: new AstLogNot(nodep->fileline(), ohot), newFireAssert(nodep, "'unique if' statement violated"), newifp); - checkifp->branchPred(AstBranchPred::BP_UNLIKELY); + checkifp->branchPred(VBranchPred::BP_UNLIKELY); nodep->replaceWith(checkifp); pushDeletep(nodep); } else { @@ -305,7 +305,7 @@ private: new AstLogNot(nodep->fileline(), ohot), newFireAssert(nodep, "synthesis parallel_case, but multiple matches found"), NULL); - ifp->branchPred(AstBranchPred::BP_UNLIKELY); + ifp->branchPred(VBranchPred::BP_UNLIKELY); nodep->addNotParallelp(ifp); } } diff --git a/src/V3Ast.h b/src/V3Ast.h index 172e50f78..94824d919 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -185,7 +185,7 @@ public: //###################################################################### -class AstEdgeType { +class VEdgeType { public: // REMEMBER to edit the strings below too enum en { @@ -213,7 +213,7 @@ public: }; return clocked[m_e]; } - AstEdgeType invert() const { + VEdgeType invert() const { switch (m_e) { case ET_ANYEDGE: return ET_ANYEDGE; case ET_BOTHEDGE: return ET_BOTHEDGE; @@ -223,7 +223,7 @@ public: case ET_LOWEDGE: return ET_HIGHEDGE; default: UASSERT_STATIC(0, "Inverting bad edgeType()"); }; - return AstEdgeType::ET_ILLEGAL; + return VEdgeType::ET_ILLEGAL; } const char* ascii() const { static const char* const names[] = { @@ -240,20 +240,20 @@ public: return names[m_e]; } // Return true iff this and the other have mutually exclusive transitions - bool exclusiveEdge(const AstEdgeType& other) const { + bool exclusiveEdge(const VEdgeType& other) const { switch (m_e) { - case AstEdgeType::ET_POSEDGE: + case VEdgeType::ET_POSEDGE: switch (other.m_e) { - case AstEdgeType::ET_NEGEDGE: // FALLTHRU - case AstEdgeType::ET_LOWEDGE: + case VEdgeType::ET_NEGEDGE: // FALLTHRU + case VEdgeType::ET_LOWEDGE: return true; default: {} } break; - case AstEdgeType::ET_NEGEDGE: + case VEdgeType::ET_NEGEDGE: switch (other.m_e) { - case AstEdgeType::ET_POSEDGE: // FALLTHRU - case AstEdgeType::ET_HIGHEDGE: + case VEdgeType::ET_POSEDGE: // FALLTHRU + case VEdgeType::ET_HIGHEDGE: return true; default: {} } @@ -262,15 +262,15 @@ public: } return false; } - inline AstEdgeType() : m_e(ET_ILLEGAL) {} + inline VEdgeType() : m_e(ET_ILLEGAL) {} // cppcheck-suppress noExplicitConstructor - inline AstEdgeType(en _e) : m_e(_e) {} - explicit inline AstEdgeType(int _e) : m_e(static_cast(_e)) {} + inline VEdgeType(en _e) : m_e(_e) {} + explicit inline VEdgeType(int _e) : m_e(static_cast(_e)) {} operator en() const { return m_e; } }; - inline bool operator==(AstEdgeType lhs, AstEdgeType rhs) { return (lhs.m_e == rhs.m_e); } - inline bool operator==(AstEdgeType lhs, AstEdgeType::en rhs) { return (lhs.m_e == rhs); } - inline bool operator==(AstEdgeType::en lhs, AstEdgeType rhs) { return (lhs == rhs.m_e); } + inline bool operator==(VEdgeType lhs, VEdgeType rhs) { return (lhs.m_e == rhs.m_e); } + inline bool operator==(VEdgeType lhs, VEdgeType::en rhs) { return (lhs.m_e == rhs); } + inline bool operator==(VEdgeType::en lhs, VEdgeType rhs) { return (lhs == rhs.m_e); } //###################################################################### @@ -613,7 +613,7 @@ public: //###################################################################### -class AstBranchPred { +class VBranchPred { public: enum en { BP_UNKNOWN=0, @@ -623,12 +623,15 @@ public: }; enum en m_e; // CONSTRUCTOR - note defaults to *UNKNOWN* - inline AstBranchPred() : m_e(BP_UNKNOWN) {} + inline VBranchPred() : m_e(BP_UNKNOWN) {} // cppcheck-suppress noExplicitConstructor - inline AstBranchPred(en _e) : m_e(_e) {} - explicit inline AstBranchPred(int _e) : m_e(static_cast(_e)) {} + inline VBranchPred(en _e) : m_e(_e) {} + explicit inline VBranchPred(int _e) : m_e(static_cast(_e)) {} operator en() const { return m_e; } - AstBranchPred invert() const { + bool unknown() const { return m_e == BP_UNKNOWN; } + bool likely() const { return m_e == BP_LIKELY; } + bool unlikely() const { return m_e == BP_UNLIKELY; } + VBranchPred invert() const { if (m_e==BP_UNLIKELY) return BP_LIKELY; else if (m_e==BP_LIKELY) return BP_UNLIKELY; else return m_e; @@ -638,14 +641,14 @@ public: "", "VL_LIKELY", "VL_UNLIKELY"}; return names[m_e]; } }; - inline bool operator==(AstBranchPred lhs, AstBranchPred rhs) { return (lhs.m_e == rhs.m_e); } - inline bool operator==(AstBranchPred lhs, AstBranchPred::en rhs) { return (lhs.m_e == rhs); } - inline bool operator==(AstBranchPred::en lhs, AstBranchPred rhs) { return (lhs == rhs.m_e); } - inline std::ostream& operator<<(std::ostream& os, const AstBranchPred& rhs) { return os<(_e)) {} + inline VVarAttrClocker(en _e) : m_e(_e) {} + explicit inline VVarAttrClocker(int _e) : m_e(static_cast(_e)) {} operator en() const { return m_e; } bool unknown() const { return m_e==CLOCKER_UNKNOWN; } - AstVarAttrClocker invert() const { + VVarAttrClocker invert() const { if (m_e==CLOCKER_YES) return CLOCKER_NO; else if (m_e==CLOCKER_NO) return CLOCKER_YES; else return m_e; @@ -671,10 +674,10 @@ public: "", "clker", "non_clker"}; return names[m_e]; } }; - inline bool operator==(AstVarAttrClocker lhs, AstVarAttrClocker rhs) { return (lhs.m_e == rhs.m_e); } - inline bool operator==(AstVarAttrClocker lhs, AstVarAttrClocker::en rhs) { return (lhs.m_e == rhs); } - inline bool operator==(AstVarAttrClocker::en lhs, AstVarAttrClocker rhs) { return (lhs == rhs.m_e); } - inline std::ostream& operator<<(std::ostream& os, const AstVarAttrClocker& rhs) { return os<(_e)) {} + inline VParseRefExp(en _e) : m_e(_e) {} + explicit inline VParseRefExp(int _e) : m_e(static_cast(_e)) {} operator en() const { return m_e; } const char* ascii() const { static const char* const names[] = { "", "TEXT", "PREDOT"}; return names[m_e]; } }; - inline bool operator==(AstParseRefExp lhs, AstParseRefExp rhs) { return (lhs.m_e == rhs.m_e); } - inline bool operator==(AstParseRefExp lhs, AstParseRefExp::en rhs) { return (lhs.m_e == rhs); } - inline bool operator==(AstParseRefExp::en lhs, AstParseRefExp rhs) { return (lhs == rhs.m_e); } - inline std::ostream& operator<<(std::ostream& os, const AstParseRefExp& rhs) { return os<= LO int m_lo; // LO union { @@ -834,7 +838,8 @@ inline std::ostream& operator<<(std::ostream& os, const VNumRange& rhs) { rhs.du //###################################################################### -struct VBasicTypeKey { +class VBasicTypeKey { +public: int m_width; // From AstNodeDType: Bit width of operation int m_widthMin; // From AstNodeDType: If unsized, bitwidth of minimum implementation AstNumeric m_numeric; // From AstNodeDType: Node is signed @@ -1754,7 +1759,7 @@ public: class AstNodeIf : public AstNodeStmt { private: - AstBranchPred m_branchPred; // Branch prediction as taken/untaken? + VBranchPred m_branchPred; // Branch prediction as taken/untaken? public: AstNodeIf(FileLine* fl, AstNode* condp, AstNode* ifsp, AstNode* elsesp) : AstNodeStmt(fl) { @@ -1772,8 +1777,8 @@ public: virtual int instrCount() const { return instrCountBranch(); } virtual V3Hash sameHash() const { return V3Hash(); } virtual bool same(const AstNode* samep) const { return true; } - void branchPred(AstBranchPred flag) { m_branchPred = flag; } - AstBranchPred branchPred() const { return m_branchPred; } + void branchPred(VBranchPred flag) { m_branchPred = flag; } + VBranchPred branchPred() const { return m_branchPred; } }; class AstNodeCase : public AstNodeStmt { diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index 3d732b21f..7be02cc65 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -1179,7 +1179,7 @@ private: bool m_noReset:1; // Do not do automated reset/randomization bool m_noSubst:1; // Do not substitute out references bool m_trace:1; // Trace this variable - AstVarAttrClocker m_attrClocker; + VVarAttrClocker m_attrClocker; MTaskIdSet m_mtaskIds; // MTaskID's that read or write this var void init() { @@ -1196,7 +1196,7 @@ private: m_isStatic = false; m_isPulldown = false; m_isPullup = false; m_isIfaceParent = false; m_isDpiOpenArray = false; m_noReset = false; m_noSubst = false; m_trace = false; - m_attrClocker = AstVarAttrClocker::CLOCKER_UNKNOWN; + m_attrClocker = VVarAttrClocker::CLOCKER_UNKNOWN; } public: AstVar(FileLine* fl, AstVarType type, const string& name, VFlagChildDType, AstNodeDType* dtp) @@ -1289,7 +1289,7 @@ public: void ansi(bool flag) { m_ansi = flag; } void declTyped(bool flag) { m_declTyped = flag; } void attrClockEn(bool flag) { m_attrClockEn = flag; } - void attrClocker(AstVarAttrClocker flag) { m_attrClocker = flag; } + void attrClocker(VVarAttrClocker flag) { m_attrClocker = flag; } void attrFileDescr(bool flag) { m_fileDescr = flag; } void attrScClocked(bool flag) { m_scClocked = flag; } void attrScBv(bool flag) { m_attrScBv = flag; } @@ -1374,7 +1374,7 @@ public: bool attrScClocked() const { return m_scClocked; } bool attrSFormat() const { return m_attrSFormat; } bool attrIsolateAssign() const { return m_attrIsolateAssign; } - AstVarAttrClocker attrClocker() const { return m_attrClocker; } + VVarAttrClocker attrClocker() const { return m_attrClocker; } virtual string verilogKwd() const; void propagateAttrFrom(AstVar* fromp) { // This is getting connected to fromp; keep attributes @@ -2010,10 +2010,11 @@ class AstParseRef : public AstNode { // Parents: math|stmt // Children: TEXT|DOT|SEL*|TASK|FUNC (or expression under sel) private: - AstParseRefExp m_expect; // Type we think it should resolve to - string m_name; + VParseRefExp m_expect; // Type we think it should resolve to + string m_name; public: - AstParseRef(FileLine* fl, AstParseRefExp expect, const string& name, AstNode* lhsp, AstNodeFTaskRef* ftaskrefp) + AstParseRef(FileLine* fl, VParseRefExp expect, const string& name, + AstNode* lhsp, AstNodeFTaskRef* ftaskrefp) : AstNode(fl), m_expect(expect), m_name(name) { setNOp1p(lhsp); setNOp2p(ftaskrefp); } ASTNODE_NODE_FUNCS(ParseRef) virtual void dump(std::ostream& str); @@ -2026,8 +2027,8 @@ public: virtual string emitVerilog() { V3ERROR_NA; return ""; } virtual string emitC() { V3ERROR_NA; return ""; } virtual void name(const string& name) { m_name = name; } - AstParseRefExp expect() const { return m_expect; } - void expect(AstParseRefExp exp) { m_expect = exp; } + VParseRefExp expect() const { return m_expect; } + void expect(VParseRefExp exp) { m_expect = exp; } // op1 = Components AstNode* lhsp() const { return op1p(); } // op1 = List of statements AstNode* ftaskrefp() const { return op2p(); } // op2 = Function/task reference @@ -2139,53 +2140,53 @@ class AstSenItem : public AstNodeSenItem { // Parents: SENTREE // Children: (optional) VARREF SENGATE private: - AstEdgeType m_edgeType; // Edge type + VEdgeType m_edgeType; // Edge type public: class Combo {}; // for creator type-overload selection class Illegal {}; // for creator type-overload selection class Initial {}; // for creator type-overload selection class Settle {}; // for creator type-overload selection class Never {}; // for creator type-overload selection - AstSenItem(FileLine* fl, AstEdgeType edgeType, AstNode* varrefp) + AstSenItem(FileLine* fl, VEdgeType edgeType, AstNode* varrefp) : AstNodeSenItem(fl), m_edgeType(edgeType) { setOp1p(varrefp); } AstSenItem(FileLine* fl, Combo) : AstNodeSenItem(fl) { - m_edgeType = AstEdgeType::ET_COMBO; + m_edgeType = VEdgeType::ET_COMBO; } AstSenItem(FileLine* fl, Illegal) : AstNodeSenItem(fl) { - m_edgeType = AstEdgeType::ET_ILLEGAL; + m_edgeType = VEdgeType::ET_ILLEGAL; } AstSenItem(FileLine* fl, Initial) : AstNodeSenItem(fl) { - m_edgeType = AstEdgeType::ET_INITIAL; + m_edgeType = VEdgeType::ET_INITIAL; } AstSenItem(FileLine* fl, Settle) : AstNodeSenItem(fl) { - m_edgeType = AstEdgeType::ET_SETTLE; + m_edgeType = VEdgeType::ET_SETTLE; } AstSenItem(FileLine* fl, Never) : AstNodeSenItem(fl) { - m_edgeType = AstEdgeType::ET_NEVER; + m_edgeType = VEdgeType::ET_NEVER; } ASTNODE_NODE_FUNCS(SenItem) virtual void dump(std::ostream& str); virtual V3Hash sameHash() const { return V3Hash(edgeType()); } virtual bool same(const AstNode* samep) const { return edgeType()==static_cast(samep)->edgeType(); } - AstEdgeType edgeType() const { return m_edgeType; } // * = Posedge/negedge - void edgeType(AstEdgeType type) { m_edgeType = type; editCountInc(); } // * = Posedge/negedge + VEdgeType edgeType() const { return m_edgeType; } // * = Posedge/negedge + void edgeType(VEdgeType type) { m_edgeType = type; editCountInc(); } // * = Posedge/negedge AstNode* sensp() const { return op1p(); } // op1 = Signal sensitized AstNodeVarRef* varrefp() const { return VN_CAST(op1p(), NodeVarRef); } // op1 = Signal sensitized // virtual bool isClocked() const { return edgeType().clockedStmt(); } - virtual bool isCombo() const { return edgeType()==AstEdgeType::ET_COMBO; } - virtual bool isInitial() const { return edgeType()==AstEdgeType::ET_INITIAL; } - virtual bool isIllegal() const { return edgeType()==AstEdgeType::ET_ILLEGAL; } - virtual bool isSettle() const { return edgeType()==AstEdgeType::ET_SETTLE; } - virtual bool isNever() const { return edgeType()==AstEdgeType::ET_NEVER; } + virtual bool isCombo() const { return edgeType()==VEdgeType::ET_COMBO; } + virtual bool isInitial() const { return edgeType()==VEdgeType::ET_INITIAL; } + virtual bool isIllegal() const { return edgeType()==VEdgeType::ET_ILLEGAL; } + virtual bool isSettle() const { return edgeType()==VEdgeType::ET_SETTLE; } + virtual bool isNever() const { return edgeType()==VEdgeType::ET_NEVER; } bool hasVar() const { return !(isCombo()||isInitial()||isSettle()||isNever()); } }; diff --git a/src/V3Branch.cpp b/src/V3Branch.cpp index 282e0d67c..6eee462c2 100644 --- a/src/V3Branch.cpp +++ b/src/V3Branch.cpp @@ -87,10 +87,10 @@ private: int elseUnlikely = m_unlikely; // Compute int likeness = ifLikely - ifUnlikely - (elseLikely - elseUnlikely); - if (likeness>0) { - nodep->branchPred(AstBranchPred::BP_LIKELY); - } else if (likeness<0) { - nodep->branchPred(AstBranchPred::BP_UNLIKELY); + if (likeness > 0) { + nodep->branchPred(VBranchPred::BP_LIKELY); + } else if (likeness < 0) { + nodep->branchPred(VBranchPred::BP_UNLIKELY); } // else leave unknown } m_likely = lastLikely; diff --git a/src/V3CCtors.cpp b/src/V3CCtors.cpp index e7d795858..3f7c9eeb8 100644 --- a/src/V3CCtors.cpp +++ b/src/V3CCtors.cpp @@ -134,7 +134,7 @@ void V3CCtors::evalAsserts() { AstNodeIf* ifp = new AstIf(varp->fileline(), newp, new AstCStmt(varp->fileline(), "Verilated::overWidthError(\""+varp->prettyName()+"\");")); - ifp->branchPred(AstBranchPred::BP_UNLIKELY); + ifp->branchPred(VBranchPred::BP_UNLIKELY); newp = ifp; funcp->addStmtsp(newp); } diff --git a/src/V3Case.cpp b/src/V3Case.cpp index 2b6871980..f3ef95fb4 100644 --- a/src/V3Case.cpp +++ b/src/V3Case.cpp @@ -129,8 +129,8 @@ private: AstUser3InUse m_inuser3; // STATE - V3Double0 m_statCaseFast; // Statistic tracking - V3Double0 m_statCaseSlow; // Statistic tracking + VDouble0 m_statCaseFast; // Statistic tracking + VDouble0 m_statCaseSlow; // Statistic tracking // Per-CASE int m_caseWidth; // Width of valueItems diff --git a/src/V3Clock.cpp b/src/V3Clock.cpp index 4b425f33e..17b4033ee 100644 --- a/src/V3Clock.cpp +++ b/src/V3Clock.cpp @@ -110,14 +110,14 @@ private: // HIGHEDGE: var // LOWEDGE: ~var AstNode* newp = NULL; - if (nodep->edgeType()==AstEdgeType::ET_ILLEGAL) { + if (nodep->edgeType()==VEdgeType::ET_ILLEGAL) { if (!v3Global.opt.bboxUnsup()) { nodep->v3error("Unsupported: Complicated event expression in sensitive activity list"); } return NULL; } AstVarScope* clkvscp = nodep->varrefp()->varScopep(); - if (nodep->edgeType()==AstEdgeType::ET_POSEDGE) { + if (nodep->edgeType() == VEdgeType::ET_POSEDGE) { AstVarScope* lastVscp = getCreateLastClk(clkvscp); newp = new AstAnd(nodep->fileline(), new AstVarRef(nodep->fileline(), @@ -125,23 +125,23 @@ private: new AstNot(nodep->fileline(), new AstVarRef(nodep->fileline(), lastVscp, false))); - } else if (nodep->edgeType()==AstEdgeType::ET_NEGEDGE) { + } else if (nodep->edgeType() == VEdgeType::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::ET_BOTHEDGE) { + } else if (nodep->edgeType() == VEdgeType::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::ET_HIGHEDGE) { + } else if (nodep->edgeType() == VEdgeType::ET_HIGHEDGE) { newp = new AstVarRef(nodep->fileline(), clkvscp, false); - } else if (nodep->edgeType()==AstEdgeType::ET_LOWEDGE) { + } else if (nodep->edgeType() == VEdgeType::ET_LOWEDGE) { newp = new AstNot(nodep->fileline(), new AstVarRef(nodep->fileline(), clkvscp, false)); diff --git a/src/V3Combine.cpp b/src/V3Combine.cpp index 803127309..3f3c32e8e 100644 --- a/src/V3Combine.cpp +++ b/src/V3Combine.cpp @@ -189,7 +189,7 @@ private: // STATE typedef enum {STATE_IDLE, STATE_HASH, STATE_DUP} CombineState; - V3Double0 m_statCombs; // Statistic tracking + VDouble0 m_statCombs; // Statistic tracking CombineState m_state; // Major state AstNodeModule* m_modp; // Current module AstCFunc* m_funcp; // Current function diff --git a/src/V3Const.cpp b/src/V3Const.cpp index e4b532c64..3a88883bc 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -1830,16 +1830,16 @@ private: || (!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::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 + if (( litemp->edgeType() == VEdgeType::ET_ANYEDGE) // ANY or {BOTH|POS|NEG} -> ANY + || (litemp->edgeType() == VEdgeType::ET_BOTHEDGE) // BOTH or {POS|NEG} -> BOTH + || (litemp->edgeType() == VEdgeType::ET_POSEDGE // POS or NEG -> BOTH + && ritemp->edgeType() == VEdgeType::ET_NEGEDGE) + || (litemp->edgeType() == ritemp->edgeType()) // Identical edges ) { // Fix edge of old node - if (litemp->edgeType()==AstEdgeType::ET_POSEDGE - && ritemp->edgeType()==AstEdgeType::ET_NEGEDGE) - litemp->edgeType(AstEdgeType::ET_BOTHEDGE); + if (litemp->edgeType() == VEdgeType::ET_POSEDGE + && ritemp->edgeType() == VEdgeType::ET_NEGEDGE) + litemp->edgeType(VEdgeType::ET_BOTHEDGE); // Remove redundant node ritemp->unlinkFrBack()->deleteTree(); VL_DANGLING(ritemp); VL_DANGLING(cmpp); // Try to collapse again diff --git a/src/V3CoverageJoin.cpp b/src/V3CoverageJoin.cpp index 9979b8440..192022956 100644 --- a/src/V3CoverageJoin.cpp +++ b/src/V3CoverageJoin.cpp @@ -50,7 +50,7 @@ private: // STATE ToggleList m_toggleps; // List of of all AstCoverToggle's - V3Double0 m_statToggleJoins; // Statistic tracking + VDouble0 m_statToggleJoins; // Statistic tracking // METHODS VL_DEBUG_FUNC; // Declare debug() diff --git a/src/V3Delayed.cpp b/src/V3Delayed.cpp index c5c403122..f37b2e060 100644 --- a/src/V3Delayed.cpp +++ b/src/V3Delayed.cpp @@ -102,7 +102,7 @@ private: bool m_inInitial; // True in initial blocks typedef std::map,AstVar*> VarMap; VarMap m_modVarMap; // Table of new var names created under module - V3Double0 m_statSharedSet;// Statistic tracking + VDouble0 m_statSharedSet; // Statistic tracking typedef std::map ScopeVecMap; ScopeVecMap m_scopeVecMap; // Next var number for each scope diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index 688a6036c..1d334355c 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -505,11 +505,11 @@ public: } virtual void visit(AstNodeIf* nodep) { puts("if ("); - if (nodep->branchPred() != AstBranchPred::BP_UNKNOWN) { + if (!nodep->branchPred().unknown()) { puts(nodep->branchPred().ascii()); puts("("); } iterateAndNextNull(nodep->condp()); - if (nodep->branchPred() != AstBranchPred::BP_UNKNOWN) puts(")"); + if (!nodep->branchPred().unknown()) puts(")"); puts(") {\n"); iterateAndNextNull(nodep->ifsp()); if (nodep->elsesp()) { diff --git a/src/V3File.cpp b/src/V3File.cpp index ba04a981e..efb0c7008 100644 --- a/src/V3File.cpp +++ b/src/V3File.cpp @@ -299,11 +299,11 @@ void V3File::createMakeDir() { } //###################################################################### -// V3InFilterImp +// VInFilterImp -class V3InFilterImp { +class VInFilterImp { typedef std::map FileContentsMap; - typedef V3InFilter::StrList StrList; + typedef VInFilter::StrList StrList; FileContentsMap m_contentsMap; // Cache of file contents bool m_readEof; // Received EOF on read @@ -518,7 +518,7 @@ private: } protected: - friend class V3InFilter; + friend class VInFilter; // Read file contents and return it bool readWholefile(const string& filename, StrList& outl) { FileContentsMap::iterator it = m_contentsMap.find(filename); @@ -550,7 +550,7 @@ protected: return out; } // CONSTRUCTORS - explicit V3InFilterImp(const string& command) { + explicit VInFilterImp(const string& command) { m_readEof = false; m_pid = 0; m_pidExited = false; @@ -559,17 +559,17 @@ protected: m_readFd = 0; start(command); } - ~V3InFilterImp() { stop(); } + ~VInFilterImp() { stop(); } }; //###################################################################### -// V3InFilter +// VInFilter // Just dispatch to the implementation -V3InFilter::V3InFilter(const string& command) { m_impp = new V3InFilterImp(command); } -V3InFilter::~V3InFilter() { if (m_impp) delete m_impp; m_impp = NULL; } +VInFilter::VInFilter(const string& command) { m_impp = new VInFilterImp(command); } +VInFilter::~VInFilter() { if (m_impp) delete m_impp; m_impp = NULL; } -bool V3InFilter::readWholefile(const string& filename, V3InFilter::StrList& outl) { +bool VInFilter::readWholefile(const string& filename, VInFilter::StrList& outl) { if (!m_impp) v3fatalSrc("readWholefile on invalid filter"); return m_impp->readWholefile(filename, outl); } diff --git a/src/V3File.h b/src/V3File.h index 2ba197974..91800d195 100644 --- a/src/V3File.h +++ b/src/V3File.h @@ -73,23 +73,23 @@ public: }; //============================================================================ -// V3InFilter: Read a input file, possibly filtering it, and caching contents +// VInFilter: Read a input file, possibly filtering it, and caching contents -class V3InFilterImp; +class VInFilterImp; -class V3InFilter { +class VInFilter { public: // TYPES typedef std::list StrList; private: - V3InFilterImp* m_impp; + VInFilterImp* m_impp; // CONSTRUCTORS - VL_UNCOPYABLE(V3InFilter); + VL_UNCOPYABLE(VInFilter); public: - explicit V3InFilter(const string& command); - ~V3InFilter(); + explicit VInFilter(const string& command); + ~VInFilter(); // METHODS // Read file contents and return it. Return true on success. diff --git a/src/V3Gate.cpp b/src/V3Gate.cpp index 55d8ce26d..53c1215ef 100644 --- a/src/V3Gate.cpp +++ b/src/V3Gate.cpp @@ -326,10 +326,10 @@ private: bool m_activeReducible; // Is activation block reducible? bool m_inSenItem; // Underneath AstSenItem; any varrefs are clocks bool m_inSlow; // Inside a slow structure - V3Double0 m_statSigs; // Statistic tracking - V3Double0 m_statRefs; // Statistic tracking - V3Double0 m_statDedupLogic; // Statistic tracking - V3Double0 m_statAssignMerged; // Statistic tracking + VDouble0 m_statSigs; // Statistic tracking + VDouble0 m_statRefs; // Statistic tracking + VDouble0 m_statDedupLogic; // Statistic tracking + VDouble0 m_statAssignMerged; // Statistic tracking // METHODS void iterateNewStmt(AstNode* nodep, const char* nonReducibleReason, const char* consumeReason) { @@ -1147,7 +1147,7 @@ private: // NODE STATE // AstVarScope::user2p -> bool: already visited // AstUser2InUse m_inuser2; (Allocated for use in GateVisitor) - V3Double0 m_numDeduped; // Statistic tracking + VDouble0 m_numDeduped; // Statistic tracking GateDedupeVarVisitor m_varVisitor; // Looks for a dupe of the logic int m_depth; // Iteration depth @@ -1228,7 +1228,7 @@ public: void dedupeTree(GateVarVertex* vvertexp) { vvertexp->accept(*this); } - V3Double0 numDeduped() { return m_numDeduped; } + VDouble0 numDeduped() { return m_numDeduped; } }; //---------------------------------------------------------------------- @@ -1268,7 +1268,7 @@ private: AstActive* m_activep; GateLogicVertex* m_logicvp; V3Graph* m_graphp; - V3Double0 m_numMergedAssigns; // Statistic tracking + VDouble0 m_numMergedAssigns; // Statistic tracking // assemble two Sel into one if possible @@ -1377,7 +1377,7 @@ public: void mergeAssignsTree(GateVarVertex* vvertexp) { vvertexp->accept(*this); } - V3Double0 numMergedAssigns() { return m_numMergedAssigns; } + VDouble0 numMergedAssigns() { return m_numMergedAssigns; } }; @@ -1580,7 +1580,7 @@ void GateVisitor::decomposeClkVectors() { for (V3GraphVertex* itp = m_graph.verticesBeginp(); itp; itp=itp->verticesNextp()) { if (GateVarVertex* vertp = dynamic_cast(itp)) { AstVarScope* vsp = vertp->varScp(); - if (vsp->varp()->attrClocker() == AstVarAttrClocker::CLOCKER_YES) { + if (vsp->varp()->attrClocker() == VVarAttrClocker::CLOCKER_YES) { if (vsp->varp()->width() > 1) { UINFO(9,"Clocker > 1 bit, not decomposing: "< ModVec; ModVec m_allMods; // All modules, in top-down order. @@ -495,7 +495,7 @@ private: // STATE AstNodeModule* m_modp; // Current module - V3Double0 m_statCells; // Statistic tracking + VDouble0 m_statCells; // Statistic tracking // METHODS VL_DEBUG_FUNC; // Declare debug() diff --git a/src/V3InstrCount.cpp b/src/V3InstrCount.cpp index bbce14127..521d4d3d8 100644 --- a/src/V3InstrCount.cpp +++ b/src/V3InstrCount.cpp @@ -179,13 +179,13 @@ private: m_instrCount = 0; iterateAndNextNull(nodep->ifsp()); uint32_t ifCount = m_instrCount; - if (nodep->branchPred() == AstBranchPred::BP_UNLIKELY) ifCount = 0; + if (nodep->branchPred().unlikely()) ifCount = 0; UINFO(8, "elsesp:\n"); m_instrCount = 0; iterateAndNextNull(nodep->elsesp()); uint32_t elseCount = m_instrCount; - if (nodep->branchPred() == AstBranchPred::BP_LIKELY) elseCount = 0; + if (nodep->branchPred().likely()) elseCount = 0; if (ifCount >= elseCount) { m_instrCount = savedCount + ifCount; diff --git a/src/V3Life.cpp b/src/V3Life.cpp index 8317d28db..580d391e6 100644 --- a/src/V3Life.cpp +++ b/src/V3Life.cpp @@ -50,8 +50,8 @@ class LifeState { // STATE public: - V3Double0 m_statAssnDel; // Statistic tracking - V3Double0 m_statAssnCon; // Statistic tracking + VDouble0 m_statAssnDel; // Statistic tracking + VDouble0 m_statAssnCon; // Statistic tracking std::vector m_unlinkps; public: diff --git a/src/V3LifePost.cpp b/src/V3LifePost.cpp index 59265a909..a5740eb4f 100644 --- a/src/V3LifePost.cpp +++ b/src/V3LifePost.cpp @@ -146,7 +146,7 @@ private: // // local to the current MTask. const ExecMTask* m_execMTaskp; // Current ExecMTask being processed, // // or NULL for serial code. - V3Double0 m_statAssnDel; // Statistic tracking + VDouble0 m_statAssnDel; // Statistic tracking bool m_tracingCall; // Currently tracing a CCall to a CFunc // Map each varscope to one or more locations where it's accessed. diff --git a/src/V3LinkCells.cpp b/src/V3LinkCells.cpp index ff0d243ec..6bd3bddbf 100644 --- a/src/V3LinkCells.cpp +++ b/src/V3LinkCells.cpp @@ -105,7 +105,7 @@ private: AstUser2InUse m_inuser2; // STATE - V3InFilter* m_filterp; // Parser filter + VInFilter* m_filterp; // Parser filter V3ParseSym* m_parseSymp; // Parser symbol table // Below state needs to be preserved between each module call. @@ -397,7 +397,7 @@ private: // Create any not already connected AstPin* newp = new AstPin(nodep->fileline(), 0, portp->name(), new AstParseRef(nodep->fileline(), - AstParseRefExp::PX_TEXT, + VParseRefExp::PX_TEXT, portp->name(), NULL, NULL)); newp->svImplicit(true); nodep->addPinsp(newp); @@ -480,7 +480,7 @@ private: public: // CONSTRUCTORS - LinkCellsVisitor(AstNetlist* nodep, V3InFilter* filterp, V3ParseSym* parseSymp) + LinkCellsVisitor(AstNetlist* nodep, VInFilter* filterp, V3ParseSym* parseSymp) : m_mods(nodep) { m_filterp = filterp; m_parseSymp = parseSymp; @@ -495,7 +495,7 @@ public: //###################################################################### // Link class functions -void V3LinkCells::link(AstNetlist* nodep, V3InFilter* filterp, V3ParseSym* parseSymp) { +void V3LinkCells::link(AstNetlist* nodep, VInFilter* filterp, V3ParseSym* parseSymp) { UINFO(4,__FUNCTION__<<": "<v3fatalSrc("Unhandled VParseRefExp"); } // Lookup VSymEnt* foundp; diff --git a/src/V3LinkParse.cpp b/src/V3LinkParse.cpp index 6a979b9f9..db5cae1e2 100644 --- a/src/V3LinkParse.cpp +++ b/src/V3LinkParse.cpp @@ -305,12 +305,12 @@ private: } else if (nodep->attrType() == AstAttrType::VAR_CLOCKER) { UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable"); - m_varp->attrClocker(AstVarAttrClocker::CLOCKER_YES); + m_varp->attrClocker(VVarAttrClocker::CLOCKER_YES); nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep); } else if (nodep->attrType() == AstAttrType::VAR_NO_CLOCKER) { UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable"); - m_varp->attrClocker(AstVarAttrClocker::CLOCKER_NO); + m_varp->attrClocker(VVarAttrClocker::CLOCKER_NO); nodep->unlinkFrBack()->deleteTree(); VL_DANGLING(nodep); } } diff --git a/src/V3Localize.cpp b/src/V3Localize.cpp index 358927545..04281dd49 100644 --- a/src/V3Localize.cpp +++ b/src/V3Localize.cpp @@ -107,8 +107,8 @@ private: AstUser4InUse m_inuser4; // STATE - V3Double0 m_statLocVars; // Statistic tracking - AstCFunc* m_cfuncp; // Current active function + VDouble0 m_statLocVars; // Statistic tracking + AstCFunc* m_cfuncp; // Current active function std::vector m_varps; // List of variables to consider for deletion // METHODS diff --git a/src/V3Order.cpp b/src/V3Order.cpp index cf4dc8d13..ba62c5694 100644 --- a/src/V3Order.cpp +++ b/src/V3Order.cpp @@ -279,7 +279,7 @@ private: if (AstVarRef* varrefp = VN_CAST(nodep->rhsp(), VarRef)) { this->visit(varrefp); m_rightClkWidth = varrefp->width(); - if (varrefp->varp()->attrClocker() == AstVarAttrClocker::CLOCKER_YES) { + if (varrefp->varp()->attrClocker() == VVarAttrClocker::CLOCKER_YES) { if (m_inClocked) { varrefp->v3warn(CLKDATA, "Clock used as data (on rhs of assignment) in sequential block " <prettyNameQ()<lhsp(), VarRef); - if (lhsp && (lhsp->varp()->attrClocker() == AstVarAttrClocker::CLOCKER_UNKNOWN)) { - lhsp->varp()->attrClocker(AstVarAttrClocker::CLOCKER_YES); // mark as clocker + if (lhsp && (lhsp->varp()->attrClocker() == VVarAttrClocker::CLOCKER_UNKNOWN)) { + lhsp->varp()->attrClocker(VVarAttrClocker::CLOCKER_YES); // mark as clocker m_newClkMarked = true; // enable a further run since new clocker is marked UINFO(5, "node is newly marked as clocker by assignment "<varp()->attrClocker() == AstVarAttrClocker::CLOCKER_YES) { + if (m_inAss && nodep->varp()->attrClocker() == VVarAttrClocker::CLOCKER_YES) { if (m_inClocked) { nodep->v3warn(CLKDATA, "Clock used as data (on rhs of assignment) in sequential block " @@ -395,7 +395,7 @@ private: VL_DEBUG_FUNC; // Declare debug() virtual void visit(AstNodeAssign* nodep) { if (const AstVarRef* varrefp = VN_CAST(nodep->lhsp(), VarRef)) { - if (varrefp->varp()->attrClocker() == AstVarAttrClocker::CLOCKER_YES) { + if (varrefp->varp()->attrClocker() == VVarAttrClocker::CLOCKER_YES) { m_clkAss = true; UINFO(6, "node was marked as clocker "<varp()->attrClocker() - != AstVarAttrClocker::CLOCKER_YES)) { + != VVarAttrClocker::CLOCKER_YES)) { con = false; UINFO(4, "nodep used as clock_enable "<nodep()<varp()->attrClocker() - == AstVarAttrClocker::CLOCKER_YES) { + == VVarAttrClocker::CLOCKER_YES) { new OrderEdge(&m_graph, m_logicVxp, varVxp, WEIGHT_NORMAL); } else { new OrderComboCutEdge(&m_graph, m_logicVxp, varVxp); diff --git a/src/V3Parse.h b/src/V3Parse.h index 59083f1fe..da165ed94 100644 --- a/src/V3Parse.h +++ b/src/V3Parse.h @@ -28,7 +28,7 @@ #include "V3Global.h" class AstNetlist; -class V3InFilter; +class VInFilter; class V3ParseImp; class V3ParseSym; @@ -42,7 +42,7 @@ private: VL_UNCOPYABLE(V3Parse); public: // We must allow reading multiple files into one parser - V3Parse(AstNetlist* rootp, V3InFilter* filterp, V3ParseSym* symp); + V3Parse(AstNetlist* rootp, VInFilter* filterp, V3ParseSym* symp); ~V3Parse(); // METHODS diff --git a/src/V3ParseImp.cpp b/src/V3ParseImp.cpp index c1f65f1e7..a7abebbdc 100644 --- a/src/V3ParseImp.cpp +++ b/src/V3ParseImp.cpp @@ -285,7 +285,7 @@ void V3ParseImp::lexFile(const string& modname) { //====================================================================== // V3Parse functions -V3Parse::V3Parse(AstNetlist* rootp, V3InFilter* filterp, V3ParseSym* symp) { +V3Parse::V3Parse(AstNetlist* rootp, VInFilter* filterp, V3ParseSym* symp) { m_impp = new V3ParseImp(rootp, filterp, symp); } V3Parse::~V3Parse() { diff --git a/src/V3ParseImp.h b/src/V3ParseImp.h index 438af7941..eefa45a5c 100644 --- a/src/V3ParseImp.h +++ b/src/V3ParseImp.h @@ -99,7 +99,7 @@ struct V3ParseBisonYYSType { class V3ParseImp { // MEMBERS AstNetlist* m_rootp; // Root of the design - V3InFilter* m_filterp; // Reading filter + VInFilter* m_filterp; // Reading filter V3ParseSym* m_symp; // Symbol table V3Lexer* m_lexerp; // Current FlexLexer @@ -219,7 +219,7 @@ public: public: // CONSTRUCTORS - V3ParseImp(AstNetlist* rootp, V3InFilter* filterp, V3ParseSym* parserSymp) + V3ParseImp(AstNetlist* rootp, VInFilter* filterp, V3ParseSym* parserSymp) : m_rootp(rootp), m_filterp(filterp), m_symp(parserSymp) { m_fileline = NULL; m_lexerp = NULL; diff --git a/src/V3PreProc.cpp b/src/V3PreProc.cpp index 55149c181..249f73821 100644 --- a/src/V3PreProc.cpp +++ b/src/V3PreProc.cpp @@ -46,7 +46,7 @@ //************************************************************************* -class V3Define { +class VDefine { // Define class. One for each define. //string m_name; // Name of the define (list is keyed by this) FileLine* m_fileline; // Where it was declared @@ -54,7 +54,7 @@ class V3Define { string m_params; // Parameters bool m_cmdline; // Set on command line, don't `undefineall public: - V3Define(FileLine* fl, const string& value, const string& params, bool cmdline) + VDefine(FileLine* fl, const string& value, const string& params, bool cmdline) : m_fileline(fl), m_value(value), m_params(params), m_cmdline(cmdline) {} FileLine* fileline() const { return m_fileline; } string value() const { return m_value; } @@ -64,7 +64,7 @@ public: //************************************************************************* -class V3DefineRef { +class VDefineRef { // One for each pending define substitution string m_name; // Define last name being defined string m_params; // Define parameter list for next expansion @@ -80,9 +80,9 @@ public: int parenLevel() const { return m_parenLevel; } void parenLevel(int value) { m_parenLevel = value; } std::vector& args() { return m_args; } - V3DefineRef(const string& name, const string& params) + VDefineRef(const string& name, const string& params) : m_name(name), m_params(params), m_parenLevel(0) {} - ~V3DefineRef() {} + ~VDefineRef() {} }; //************************************************************************* @@ -106,8 +106,8 @@ public: class V3PreProcImp : public V3PreProc { public: // TYPES - typedef std::map DefinesMap; - typedef V3InFilter::StrList StrList; + typedef std::map DefinesMap; + typedef VInFilter::StrList StrList; // debug() -> see V3PreShellImp::debug; use --debugi-V3PreShell @@ -156,7 +156,7 @@ public: string m_strify; ///< Text to be stringified // For defines - std::stack m_defRefs; ///< Pending define substitution + std::stack m_defRefs; ///< Pending define substitution std::stack m_ifdefStack; ///< Stack of true/false emitting evaluations unsigned m_defDepth; ///< How many `defines deep bool m_defPutJoin; ///< Insert `` after substitution @@ -179,7 +179,7 @@ public: private: // Internal methods void endOfOneFile(); - string defineSubst(V3DefineRef* refp); + string defineSubst(VDefineRef* refp); bool defExists(const string& name); string defValue(const string& name); @@ -227,7 +227,7 @@ private: public: // METHODS, called from upper level shell - void openFile(FileLine* fl, V3InFilter* filterp, const string& filename); + void openFile(FileLine* fl, VInFilter* filterp, const string& filename); bool isEof() const { return m_lexp->curStreamp()->m_eof; } string getline(); void insertUnreadback(const string& text) { m_lineCmt += text; } @@ -341,7 +341,7 @@ void V3PreProcImp::define(FileLine* fl, const string& name, const string& value, } undef(name); } - m_defines.insert(make_pair(name, V3Define(fl, value, params, cmdline))); + m_defines.insert(make_pair(name, VDefine(fl, value, params, cmdline))); } string V3PreProcImp::removeDefines(const string& text) { @@ -557,7 +557,7 @@ string V3PreProcImp::trimWhitespace(const string& strg, bool trailing) { return out; } -string V3PreProcImp::defineSubst(V3DefineRef* refp) { +string V3PreProcImp::defineSubst(VDefineRef* refp) { // Substitute out defines in a define reference. // (We also need to call here on non-param defines to handle `") // We could push the define text back into the lexer, but that's slow @@ -746,7 +746,7 @@ string V3PreProcImp::defineSubst(V3DefineRef* refp) { //********************************************************************** // Parser routines -void V3PreProcImp::openFile(FileLine* fl, V3InFilter* filterp, const string& filename) { +void V3PreProcImp::openFile(FileLine* fl, VInFilter* filterp, const string& filename) { // Open a new file, possibly overriding the current one which is active. V3File::addSrcDepend(filename); @@ -1121,7 +1121,7 @@ int V3PreProcImp::getStateToken() { goto next_tok; } else { if (m_defRefs.empty()) fatalSrc("Shouldn't be in DEFPAREN w/o active defref"); - V3DefineRef* refp = &(m_defRefs.top()); + VDefineRef* refp = &(m_defRefs.top()); error(string("Expecting ( to begin argument list for define reference `")+refp->name()+"\n"); statePop(); goto next_tok; @@ -1129,7 +1129,7 @@ int V3PreProcImp::getStateToken() { } case ps_DEFARG: { if (m_defRefs.empty()) fatalSrc("Shouldn't be in DEFARG w/o active defref"); - V3DefineRef* refp = &(m_defRefs.top()); + VDefineRef* refp = &(m_defRefs.top()); refp->nextarg(refp->nextarg()+m_lexp->m_defValue); m_lexp->m_defValue = ""; UINFO(4,"defarg++ "<nextarg()<nextarg(refp->nextarg()+m_lexp->m_defValue+out); m_lexp->m_defValue = ""; } @@ -1404,7 +1404,7 @@ int V3PreProcImp::getStateToken() { // The CURRENT macro needs the paren saved, it's not a // property of the child macro if (!m_defRefs.empty()) m_defRefs.top().parenLevel(m_lexp->m_parenLevel); - m_defRefs.push(V3DefineRef(name, params)); + m_defRefs.push(VDefineRef(name, params)); statePush(ps_DEFPAREN); m_lexp->pushStateDefArg(0); goto next_tok; diff --git a/src/V3PreProc.h b/src/V3PreProc.h index 069a9c512..0422d0e5f 100644 --- a/src/V3PreProc.h +++ b/src/V3PreProc.h @@ -34,7 +34,7 @@ // Compatibility with Verilog-Perl's preprocessor #define fatalSrc(msg) v3fatalSrc(msg) -class V3InFilter; +class VInFilter; class VSpellCheck; class V3PreProc { @@ -58,7 +58,7 @@ public: // ACCESSORS // Insert given file into this point in input stream - virtual void openFile(FileLine* fileline, V3InFilter* filterp, const string& filename) = 0; + virtual void openFile(FileLine* fileline, VInFilter* filterp, const string& filename) = 0; virtual string getline() = 0; // Return next line/lines. (Null if done.) virtual bool isEof() const = 0; // Return true on EOF. virtual void insertUnreadback(const string& text) = 0; diff --git a/src/V3PreShell.cpp b/src/V3PreShell.cpp index 7f0101cd3..cea995786 100644 --- a/src/V3PreShell.cpp +++ b/src/V3PreShell.cpp @@ -41,8 +41,8 @@ protected: friend class V3PreShell; static V3PreShellImp s_preImp; - static V3PreProc* s_preprocp; - static V3InFilter* s_filterp; + static V3PreProc* s_preprocp; + static VInFilter* s_filterp; //--------------------------------------- // METHODS @@ -93,7 +93,7 @@ protected: } } - bool preproc(FileLine* fl, const string& modname, V3InFilter* filterp, V3ParseImp* parsep, + bool preproc(FileLine* fl, const string& modname, VInFilter* filterp, V3ParseImp* parsep, const string& errmsg) { // "" for no error debug(true); // Recheck if debug on - first check was before command line passed @@ -134,7 +134,7 @@ protected: } private: - string preprocOpen(FileLine* fl, V3InFilter* filterp, + string preprocOpen(FileLine* fl, VInFilter* filterp, const string& modname, const string& lastpath, const string& errmsg) { // Error message or "" to suppress // Returns filename if successful @@ -162,7 +162,7 @@ public: V3PreShellImp V3PreShellImp::s_preImp; V3PreProc* V3PreShellImp::s_preprocp = NULL; -V3InFilter* V3PreShellImp::s_filterp = NULL; +VInFilter* V3PreShellImp::s_filterp = NULL; //###################################################################### // Perl class functions @@ -170,7 +170,7 @@ V3InFilter* V3PreShellImp::s_filterp = NULL; void V3PreShell::boot(char** env) { V3PreShellImp::s_preImp.boot(env); } -bool V3PreShell::preproc(FileLine* fl, const string& modname, V3InFilter* filterp, +bool V3PreShell::preproc(FileLine* fl, const string& modname, VInFilter* filterp, V3ParseImp* parsep, const string& errmsg) { return V3PreShellImp::s_preImp.preproc(fl, modname, filterp, parsep, errmsg); } diff --git a/src/V3PreShell.h b/src/V3PreShell.h index 798264b48..97bedcef2 100644 --- a/src/V3PreShell.h +++ b/src/V3PreShell.h @@ -28,7 +28,7 @@ #include "V3FileLine.h" class V3ParseImp; -class V3InFilter; +class VInFilter; class VSpellCheck; //============================================================================ @@ -37,7 +37,7 @@ class V3PreShell { // Static class for calling preprocessor public: static void boot(char** env); - static bool preproc(FileLine* fl, const string& modname, V3InFilter* filterp, + static bool preproc(FileLine* fl, const string& modname, VInFilter* filterp, V3ParseImp* parsep, const string& errmsg); static void preprocInclude(FileLine* fl, const string& modname); static void defineCmdLine(const string& name, const string& value); diff --git a/src/V3Reloop.cpp b/src/V3Reloop.cpp index 0a0dc5ac8..1d6685b58 100644 --- a/src/V3Reloop.cpp +++ b/src/V3Reloop.cpp @@ -58,8 +58,8 @@ private: AstUser1InUse m_inuser1; // STATE - V3Double0 m_statReloops; // Statistic tracking - V3Double0 m_statReItems; // Statistic tracking + VDouble0 m_statReloops; // Statistic tracking + VDouble0 m_statReItems; // Statistic tracking AstCFunc* m_cfuncp; // Current block AssVec m_mgAssignps; // List of assignments merging diff --git a/src/V3Scope.cpp b/src/V3Scope.cpp index 4010cafee..abf488701 100644 --- a/src/V3Scope.cpp +++ b/src/V3Scope.cpp @@ -249,10 +249,10 @@ private: if (m_aboveCellp && !m_aboveCellp->isTrace()) varscp->trace(false); nodep->user1p(varscp); if (v3Global.opt.isClocker(varscp->prettyName())) { - nodep->attrClocker(AstVarAttrClocker::CLOCKER_YES); + nodep->attrClocker(VVarAttrClocker::CLOCKER_YES); } if (v3Global.opt.isNoClocker(varscp->prettyName())) { - nodep->attrClocker(AstVarAttrClocker::CLOCKER_NO); + nodep->attrClocker(VVarAttrClocker::CLOCKER_NO); } UASSERT_OBJ(m_scopep, nodep, "No scope for var"); m_varScopes.insert(make_pair(make_pair(nodep, m_scopep), varscp)); diff --git a/src/V3Split.cpp b/src/V3Split.cpp index aa497aabd..34a3b701f 100644 --- a/src/V3Split.cpp +++ b/src/V3Split.cpp @@ -263,7 +263,7 @@ protected: SplitPliVertex* m_pliVertexp; // Element specifying PLI ordering V3Graph m_graph; // Scoreboard of var usages/dependencies bool m_inDly; // Inside ASSIGNDLY - V3Double0 m_statSplits; // Statistic tracking + VDouble0 m_statSplits; // Statistic tracking // CONSTRUCTORS public: diff --git a/src/V3SplitAs.cpp b/src/V3SplitAs.cpp index 721114794..6df0aefdd 100644 --- a/src/V3SplitAs.cpp +++ b/src/V3SplitAs.cpp @@ -146,8 +146,8 @@ private: AstUser1InUse m_inuser1; // STATE - V3Double0 m_statSplits; // Statistic tracking - AstVarScope* m_splitVscp; // Variable we want to split + VDouble0 m_statSplits; // Statistic tracking + AstVarScope* m_splitVscp; // Variable we want to split // METHODS void splitAlways(AstAlways* nodep) { diff --git a/src/V3Stats.cpp b/src/V3Stats.cpp index 3875266a6..fd8f5034e 100644 --- a/src/V3Stats.cpp +++ b/src/V3Stats.cpp @@ -49,22 +49,22 @@ private: bool m_fast; AstCFunc* m_cfuncp; // Current CFUNC - V3Double0 m_statInstrLong; // Instruction count + VDouble0 m_statInstrLong; // Instruction count bool m_counting; // Currently counting double m_instrs; // Current instr count (for determining branch direction) bool m_tracingCall; // Iterating into a CCall to a CFunc - std::vector m_statTypeCount; // Nodes of given type - V3Double0 m_statAbove[AstType::_ENUM_END][AstType::_ENUM_END]; // Nodes of given type - V3Double0 m_statPred[AstBranchPred::_ENUM_END]; // Nodes of given type - V3Double0 m_statInstr; // Instruction count - V3Double0 m_statInstrFast; // Instruction count, non-slow() eval functions only - std::vector m_statVarWidths; // Variables of given width - std::vector m_statVarWidthNames; // Var names of given width - V3Double0 m_statVarArray; // Statistic tracking - V3Double0 m_statVarBytes; // Statistic tracking - V3Double0 m_statVarClock; // Statistic tracking - V3Double0 m_statVarScpBytes; // Statistic tracking + std::vector m_statTypeCount; // Nodes of given type + VDouble0 m_statAbove[AstType::_ENUM_END][AstType::_ENUM_END]; // Nodes of given type + VDouble0 m_statPred[VBranchPred::_ENUM_END]; // Nodes of given type + VDouble0 m_statInstr; // Instruction count + VDouble0 m_statInstrFast; // Instruction count, non-slow() eval functions only + std::vector m_statVarWidths; // Variables of given width + std::vector m_statVarWidthNames; // Var names of given width + VDouble0 m_statVarArray; // Statistic tracking + VDouble0 m_statVarBytes; // Statistic tracking + VDouble0 m_statVarClock; // Statistic tracking + VDouble0 m_statVarScpBytes; // Statistic tracking // METHODS VL_DEBUG_FUNC; // Declare debug() @@ -140,7 +140,7 @@ private: // Need to do even if !m_counting because maybe determining upstream if/else double ifInstrs = 0.0; double elseInstrs = 0.0; - if (nodep->branchPred() != AstBranchPred::BP_UNLIKELY) { // Check if + if (nodep->branchPred() != VBranchPred::BP_UNLIKELY) { // Check if double prevInstr = m_instrs; bool prevCounting = m_counting; { @@ -152,7 +152,7 @@ private: m_instrs = prevInstr; m_counting = prevCounting; } - if (nodep->branchPred() != AstBranchPred::BP_LIKELY) { // Check else + if (nodep->branchPred() != VBranchPred::BP_LIKELY) { // Check else double prevInstr = m_instrs; bool prevCounting = m_counting; { @@ -258,8 +258,8 @@ public: V3Stats::addStat(m_stage, string("Node count, ")+AstType(type).ascii(), count); } } - for (int type=0; type m_entryps; // Nodes to delete when we are finished int m_ops; // Number of operators on assign rhs int m_assignStep; // Assignment number to determine var lifetime - V3Double0 m_statSubsts; // Statistic tracking + VDouble0 m_statSubsts; // Statistic tracking enum { SUBST_MAX_OPS_SUBST = 30, // Maximum number of ops to substitute in SUBST_MAX_OPS_NA = 9999 }; // Not allowed to substitute diff --git a/src/V3Table.cpp b/src/V3Table.cpp index 12d479509..94fc88ea4 100644 --- a/src/V3Table.cpp +++ b/src/V3Table.cpp @@ -75,7 +75,7 @@ private: // STATE double m_totalBytes; // Total bytes in tables created - V3Double0 m_statTablesCre; // Statistic tracking + VDouble0 m_statTablesCre; // Statistic tracking // State cleared on each module AstNodeModule* m_modp; // Current MODULE diff --git a/src/V3Trace.cpp b/src/V3Trace.cpp index 4f535304b..ccb8a72c1 100644 --- a/src/V3Trace.cpp +++ b/src/V3Trace.cpp @@ -190,9 +190,9 @@ private: bool m_finding; // Pass one of algorithm? int m_funcNum; // Function number being built - V3Double0 m_statChgSigs; // Statistic tracking - V3Double0 m_statUniqSigs; // Statistic tracking - V3Double0 m_statUniqCodes;// Statistic tracking + VDouble0 m_statChgSigs; // Statistic tracking + VDouble0 m_statUniqSigs; // Statistic tracking + VDouble0 m_statUniqCodes; // Statistic tracking // METHODS VL_DEBUG_FUNC; // Declare debug() @@ -501,7 +501,7 @@ private: else condp = selp; } AstIf* ifp = new AstIf(fl, condp, NULL, NULL); - ifp->branchPred(AstBranchPred::BP_UNLIKELY); + ifp->branchPred(VBranchPred::BP_UNLIKELY); m_chgFuncp->addStmtsp(ifp); lastactp = &actset; ifnodep = ifp; diff --git a/src/V3TraceDecl.cpp b/src/V3TraceDecl.cpp index d1be9c725..61e168ac2 100644 --- a/src/V3TraceDecl.cpp +++ b/src/V3TraceDecl.cpp @@ -53,8 +53,8 @@ private: AstNode* m_traValuep; // Signal being traced's value to trace in it string m_traShowname; // Signal being traced's component name - V3Double0 m_statSigs; // Statistic tracking - V3Double0 m_statIgnSigs; // Statistic tracking + VDouble0 m_statSigs; // Statistic tracking + VDouble0 m_statIgnSigs; // Statistic tracking // METHODS VL_DEBUG_FUNC; // Declare debug() diff --git a/src/V3Tristate.cpp b/src/V3Tristate.cpp index 238b147e1..7bb657b26 100644 --- a/src/V3Tristate.cpp +++ b/src/V3Tristate.cpp @@ -356,7 +356,7 @@ class TristateVisitor : public TristateBaseVisitor { TristateGraph m_tgraph; // Logic graph // STATS - V3Double0 m_statTriSigs; // stat tracking + VDouble0 m_statTriSigs; // stat tracking // METHODS string dbgState() { diff --git a/src/V3Unknown.cpp b/src/V3Unknown.cpp index 48b7ef27e..b8523e9ec 100644 --- a/src/V3Unknown.cpp +++ b/src/V3Unknown.cpp @@ -59,7 +59,7 @@ private: // STATE AstNodeModule* m_modp; // Current module bool m_constXCvt; // Convert X's - V3Double0 m_statUnkVars; // Statistic tracking + VDouble0 m_statUnkVars; // Statistic tracking AstAssignW* m_assignwp; // Current assignment AstAssignDly* m_assigndlyp; // Current assignment @@ -135,7 +135,7 @@ private: (new AstAssign(fl, prep, new AstVarRef(fl, varp, false)))), NULL); - newp->branchPred(AstBranchPred::BP_LIKELY); + newp->branchPred(VBranchPred::BP_LIKELY); if (debug()>=9) newp->dumpTree(cout, " _new: "); abovep->addNextStmt(newp, abovep); prep->user2p(newp); // Save so we may LogAnd it next time diff --git a/src/V3Unroll.cpp b/src/V3Unroll.cpp index f2680df10..9bcf93a0f 100644 --- a/src/V3Unroll.cpp +++ b/src/V3Unroll.cpp @@ -56,8 +56,8 @@ private: bool m_varAssignHit; // Assign var hit bool m_generate; // Expand single generate For loop string m_beginName; // What name to give begin iterations - V3Double0 m_statLoops; // Statistic tracking - V3Double0 m_statIters; // Statistic tracking + VDouble0 m_statLoops; // Statistic tracking + VDouble0 m_statIters; // Statistic tracking // METHODS VL_DEBUG_FUNC; // Declare debug() diff --git a/src/Verilator.cpp b/src/Verilator.cpp index c4b4fe566..95c5dc2f4 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -118,7 +118,7 @@ void V3Global::readFiles() { // AstNode::user4p() // VSymEnt* Package and typedef symbol names AstUser4InUse inuser4; - V3InFilter filter (v3Global.opt.pipeFilter()); + VInFilter filter (v3Global.opt.pipeFilter()); V3ParseSym parseSyms (v3Global.rootp()); // Symbol table must be common across all parsing V3Parse parser (v3Global.rootp(), &filter, &parseSyms); diff --git a/src/verilog.y b/src/verilog.y index 06a99cb05..64724d425 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -2265,10 +2265,10 @@ cellparamItemE: // IEEE: named_parameter_assignment + empty /* empty: ',,' is legal */ { $$ = new AstPin(CRELINE(), PINNUMINC(), "", NULL); } | yP_DOTSTAR { $$ = new AstPin($1,PINNUMINC(),".*",NULL); } | '.' idSVKwd { $$ = new AstPin($2,PINNUMINC(), *$2, - new AstParseRef($2,AstParseRefExp::PX_TEXT,*$2,NULL,NULL)); + new AstParseRef($2,VParseRefExp::PX_TEXT,*$2,NULL,NULL)); $$->svImplicit(true);} | '.' idAny { $$ = new AstPin($2,PINNUMINC(), *$2, - new AstParseRef($2,AstParseRefExp::PX_TEXT,*$2,NULL,NULL)); + new AstParseRef($2,VParseRefExp::PX_TEXT,*$2,NULL,NULL)); $$->svImplicit(true);} | '.' idAny '(' ')' { $$ = new AstPin($2,PINNUMINC(),*$2,NULL); } // // mintypmax is expanded here, as it might be a UDP or gate primitive @@ -2289,8 +2289,8 @@ cellpinItemE: // IEEE: named_port_connection + empty // Note empty can match either () or (,); V3LinkCells cleans up () /* empty: ',,' is legal */ { $$ = new AstPin(CRELINE(), PINNUMINC(), "", NULL); } | yP_DOTSTAR { $$ = new AstPin($1,PINNUMINC(),".*",NULL); } - | '.' idSVKwd { $$ = new AstPin($2,PINNUMINC(),*$2,new AstParseRef($2,AstParseRefExp::PX_TEXT,*$2,NULL,NULL)); $$->svImplicit(true);} - | '.' idAny { $$ = new AstPin($2,PINNUMINC(),*$2,new AstParseRef($2,AstParseRefExp::PX_TEXT,*$2,NULL,NULL)); $$->svImplicit(true);} + | '.' idSVKwd { $$ = new AstPin($2,PINNUMINC(),*$2,new AstParseRef($2,VParseRefExp::PX_TEXT,*$2,NULL,NULL)); $$->svImplicit(true);} + | '.' idAny { $$ = new AstPin($2,PINNUMINC(),*$2,new AstParseRef($2,VParseRefExp::PX_TEXT,*$2,NULL,NULL)); $$->svImplicit(true);} | '.' idAny '(' ')' { $$ = new AstPin($2,PINNUMINC(),*$2,NULL); } // // mintypmax is expanded here, as it might be a UDP or gate primitive | '.' idAny '(' expr ')' { $$ = new AstPin($2,PINNUMINC(),*$2,$4); } @@ -2352,16 +2352,16 @@ senitem: // IEEE: part of event_expression, non-'OR' ',' terms ; senitemVar: - idClassSel { $$ = new AstSenItem($1->fileline(),AstEdgeType::ET_ANYEDGE,$1); } + idClassSel { $$ = new AstSenItem($1->fileline(), VEdgeType::ET_ANYEDGE, $1); } ; senitemEdge: // IEEE: part of event_expression - 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); } + yPOSEDGE idClassSel { $$ = new AstSenItem($1, VEdgeType::ET_POSEDGE, $2); } + | yNEGEDGE idClassSel { $$ = new AstSenItem($1, VEdgeType::ET_NEGEDGE, $2); } + | yEDGE idClassSel { $$ = new AstSenItem($1, VEdgeType::ET_BOTHEDGE, $2); } + | yPOSEDGE '(' idClassSel ')' { $$ = new AstSenItem($1, VEdgeType::ET_POSEDGE, $3); } + | yNEGEDGE '(' idClassSel ')' { $$ = new AstSenItem($1, VEdgeType::ET_NEGEDGE, $3); } + | yEDGE '(' idClassSel ')' { $$ = new AstSenItem($1, VEdgeType::ET_BOTHEDGE, $3); } //UNSUP yIFF... ; @@ -3854,7 +3854,7 @@ idDottedMore: // id below includes: // enum_identifier idArrayed: // IEEE: id + select - id { $$ = new AstParseRef($1,AstParseRefExp::PX_TEXT,*$1,NULL,NULL); } + id { $$ = new AstParseRef($1,VParseRefExp::PX_TEXT,*$1,NULL,NULL); } // // IEEE: id + part_select_range/constant_part_select_range | idArrayed '[' expr ']' { $$ = new AstSelBit($2,$1,$3); } // Or AstArraySel, don't know yet. | idArrayed '[' constExpr ':' constExpr ']' { $$ = new AstSelExtract($2,$1,$3,$5); } diff --git a/test_regress/driver.pl b/test_regress/driver.pl index 4b7cfadb3..8e81d2b85 100755 --- a/test_regress/driver.pl +++ b/test_regress/driver.pl @@ -408,6 +408,7 @@ sub sprint_summary { my $pct = int(100*($self->{left_cnt} / $self->{all_cnt}) + 0.999); my $eta = ($self->{all_cnt} * ($delta / (($self->{all_cnt} - $self->{left_cnt})+0.001))) - $delta; + $eta = 0 if $delta < 10; my $out = ""; $out .= "Left $leftmsg " if $self->{left_cnt}; $out .= "Passed $self->{ok_cnt}";