diff --git a/src/V3Ast.h b/src/V3Ast.h index 5bd63e855..4b433236a 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -786,8 +786,8 @@ public: } string prettyName() const { return verilogKwd(); } bool isAny() const { return m_e != NONE; } - // Looks like inout - "ish" because not identical to being an INOUT - bool isInoutish() const { return m_e == INOUT; } + bool isInout() const { return m_e == INOUT; } + bool isInoutOrRef() const { return m_e == INOUT || m_e == REF || m_e == CONSTREF; } bool isInput() const { return m_e == INPUT; } bool isNonOutput() const { return m_e == INPUT || m_e == INOUT || m_e == REF || m_e == CONSTREF; diff --git a/src/V3AstNodeOther.h b/src/V3AstNodeOther.h index 86e2de882..9ac6180b4 100644 --- a/src/V3AstNodeOther.h +++ b/src/V3AstNodeOther.h @@ -2060,7 +2060,8 @@ public: bool isAnsi() const { return m_ansi; } bool isContinuously() const { return m_isContinuously; } bool isDeclTyped() const { return m_declTyped; } - bool isInoutish() const { return m_direction.isInoutish(); } + bool isInout() const { return m_direction.isInout(); } + bool isInoutOrRef() const { return m_direction.isInoutOrRef(); } bool isInput() const { return m_direction.isInput(); } bool isNonOutput() const { return m_direction.isNonOutput(); } bool isReadOnly() const VL_MT_SAFE { return m_direction.isReadOnly(); } diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index fbb5eb3de..6137f0c74 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -535,7 +535,7 @@ string AstVar::vlEnumType() const { string AstVar::vlEnumDir() const { string out; - if (isInoutish()) { + if (isInout()) { out = "VLVD_INOUT"; } else if (isWritable()) { out = "VLVD_OUT"; @@ -2448,7 +2448,7 @@ int AstVarRef::instrCount() const { void AstVar::dump(std::ostream& str) const { this->AstNode::dump(str); if (isSc()) str << " [SC]"; - if (isPrimaryIO()) str << (isInoutish() ? " [PIO]" : (isWritable() ? " [PO]" : " [PI]")); + if (isPrimaryIO()) str << (isInout() ? " [PIO]" : (isWritable() ? " [PO]" : " [PI]")); if (isIO()) str << " " << direction().ascii(); if (isConst()) str << " [CONST]"; if (isPullup()) str << " [PULLUP]"; @@ -2649,7 +2649,7 @@ bool AstNodeFTask::getPurityRecurse() const { // or any write reference to a variable that isn't an automatic function local. for (AstNode* stmtp = this->stmtsp(); stmtp; stmtp = stmtp->nextp()) { if (const AstVar* const varp = VN_CAST(stmtp, Var)) { - if (varp->isInoutish() || varp->isRef()) return false; + if (varp->isInoutOrRef()) return false; } if (!stmtp->isPure()) return false; if (stmtp->exists([](const AstNodeVarRef* const varrefp) { diff --git a/src/V3EmitCBase.cpp b/src/V3EmitCBase.cpp index 7f9d33cea..15177d6ec 100644 --- a/src/V3EmitCBase.cpp +++ b/src/V3EmitCBase.cpp @@ -192,7 +192,7 @@ void EmitCBaseVisitorConst::emitVarDecl(const AstVar* nodep, bool asRef) { if (nodep->attrScClocked() && nodep->isReadOnly()) { putns(nodep, "sc_core::sc_in_clk "); } else { - if (nodep->isInoutish()) { + if (nodep->isInout()) { putns(nodep, "sc_core::sc_inout<"); } else if (nodep->isWritable()) { putns(nodep, "sc_core::sc_out<"); @@ -213,7 +213,7 @@ void EmitCBaseVisitorConst::emitVarDecl(const AstVar* nodep, bool asRef) { emitDeclArrayBrackets(nodep); puts(";\n"); } else if (nodep->isIO() && basicp && !basicp->isOpaque()) { - if (nodep->isInoutish()) { + if (nodep->isInout()) { putns(nodep, "VL_INOUT"); } else if (nodep->isWritable()) { putns(nodep, "VL_OUT"); diff --git a/src/V3EmitCImp.cpp b/src/V3EmitCImp.cpp index 5df77cf92..544c82d7c 100644 --- a/src/V3EmitCImp.cpp +++ b/src/V3EmitCImp.cpp @@ -733,7 +733,7 @@ class EmitCTrace final : EmitCFunc { puts("," + cvtToStr(enumNum)); // Direction - if (nodep->declDirection().isInoutish()) { + if (nodep->declDirection().isInout()) { puts(", VerilatedTraceSigDirection::INOUT"); } else if (nodep->declDirection().isWritable()) { puts(", VerilatedTraceSigDirection::OUTPUT"); diff --git a/src/V3Fork.cpp b/src/V3Fork.cpp index aa9aafff4..30dc0fa82 100644 --- a/src/V3Fork.cpp +++ b/src/V3Fork.cpp @@ -433,7 +433,7 @@ class DynScopeVisitor final : public VNVisitor { nodep->v3warn( E_UNSUPPORTED, "Unsupported: Writing to a captured " - << (nodep->varp()->isInoutish() ? "inout" : "output") << " variable in a " + << (nodep->varp()->isInout() ? "inout" : "output") << " variable in a " << (VN_IS(nodep->backp(), AssignDly) ? "non-blocking assignment" : "fork") << " after a timing control"); } diff --git a/src/V3Inst.cpp b/src/V3Inst.cpp index d8c810180..0d69913aa 100644 --- a/src/V3Inst.cpp +++ b/src/V3Inst.cpp @@ -67,7 +67,7 @@ class InstVisitor final : public VNVisitor { AstNodeExpr* const exprp = VN_AS(nodep->exprp(), NodeExpr)->cloneTree(false); UASSERT_OBJ(exprp->width() == nodep->modVarp()->width(), nodep, "Width mismatch, should have been handled in pinReconnectSimple"); - if (nodep->modVarp()->isInoutish()) { + if (nodep->modVarp()->isInout()) { nodep->v3fatalSrc("Unsupported: Verilator is a 2-state simulator"); } else if (nodep->modVarp()->isWritable()) { AstNodeExpr* const rhsp = new AstVarXRef{exprp->fileline(), nodep->modVarp(), @@ -558,7 +558,7 @@ public: // Important to add statement next to cell, in case there is a // generate with same named cell cellp->addNextHere(newvarp); - if (pinVarp->isInoutish()) { + if (pinVarp->isInout()) { pinVarp->v3fatalSrc("Unsupported: Inout connections to pins must be" " direct one-to-one connection (without any expression)"); } else if (pinVarp->isWritable()) { diff --git a/src/V3SplitVar.cpp b/src/V3SplitVar.cpp index 23847a076..b09a7a95b 100644 --- a/src/V3SplitVar.cpp +++ b/src/V3SplitVar.cpp @@ -775,7 +775,7 @@ public: const std::pair dim = nodep->dtypep()->dimensions(false); UINFO(7, nodep->prettyNameQ() << " pub:" << nodep->isSigPublic() << " pri:" << nodep->isPrimaryIO() - << " io:" << nodep->isInoutish() << " typ:" << nodep->varType() << "\n"); + << " io:" << nodep->isInout() << " typ:" << nodep->varType() << "\n"); const char* reason = nullptr; // Public variable cannot be split. // at least one unpacked dimension must exist diff --git a/src/V3Task.cpp b/src/V3Task.cpp index b2603a1cd..f7b810765 100644 --- a/src/V3Task.cpp +++ b/src/V3Task.cpp @@ -515,7 +515,7 @@ class TaskVisitor final : public VNVisitor { pinp->v3fatalSrc("ref argument should have caused non-inline of function"); } } - } else if (portp->isInoutish()) { + } else if (portp->isInout()) { // if (debug() >= 9) pinp->dumpTree("-pinrsize- "); AstVarScope* const newvscp @@ -900,7 +900,7 @@ class TaskVisitor final : public VNVisitor { if (portp->isNonOutput()) { std::string frName - = portp->isInoutish() && portp->basicp()->isDpiPrimitive() + = portp->isInout() && portp->basicp()->isDpiPrimitive() && portp->dtypep()->skipRefp()->arrayUnpackedElements() == 1 ? "*" : ""; diff --git a/src/V3Tristate.cpp b/src/V3Tristate.cpp index 6663c879e..c47eea9a5 100644 --- a/src/V3Tristate.cpp +++ b/src/V3Tristate.cpp @@ -23,7 +23,7 @@ // Over each module, from child to parent: // Build a graph, connecting signals together so we can propagate tristates // Variable becomes tristate with -// VAR->isInoutish +// VAR->isInout // VAR->isPullup/isPulldown (converted to AstPullup/AstPulldown // BufIf0/1 // All variables on the LHS need to become tristate when there is: @@ -1779,7 +1779,7 @@ class TristateVisitor final : public TristateBaseVisitor { nodep->addNextHere(newp); // We'll iterate on the new AstPull later } - if (nodep->isInoutish() + if (nodep->isInout() //|| varp->isOutput() // Note unconnected output only changes behavior vs. previous // versions and causes outputs that don't come from anywhere to diff --git a/src/V3Undriven.cpp b/src/V3Undriven.cpp index 0c518ebcd..1794d06da 100644 --- a/src/V3Undriven.cpp +++ b/src/V3Undriven.cpp @@ -504,7 +504,7 @@ class UndrivenVisitor final : public VNVisitorConst { } void visit(AstPin* nodep) override { VL_RESTORER(m_inInoutPin); - m_inInoutPin = nodep->modVarp()->isInoutish(); + m_inInoutPin = nodep->modVarp()->isInout(); iterateChildrenConst(nodep); }