diff --git a/src/V3Ast.h b/src/V3Ast.h index ab8baf611..45f6e9ae6 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -131,6 +131,10 @@ public: static const char* const names[] = {"RD", "WR"}; return names[m_e]; } + const char* arrow() const { + static const char* const names[] = {"[RV] <-", "[LV] =>"}; + return names[m_e]; + } inline VAccess() : m_e{READ} {} // cppcheck-suppress noExplicitConstructor diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index f6c61dcc0..b5dc6d2b2 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -1453,12 +1453,8 @@ void AstVarScope::dump(std::ostream& str) const { void AstNodeVarRef::dump(std::ostream& str) const { this->AstNodeMath::dump(str); } void AstVarXRef::dump(std::ostream& str) const { this->AstNodeVarRef::dump(str); - if (packagep()) { str << " pkg=" << nodeAddr(packagep()); } - if (access().isWrite()) { - str << " [LV] => "; - } else { - str << " [RV] <- "; - } + if (packagep()) str << " pkg=" << nodeAddr(packagep()); + str << " " << access().arrow() << " "; str << ".=" << dotted() << " "; if (inlinedDots() != "") str << " inline.=" << inlinedDots() << " - "; if (varScopep()) { @@ -1471,12 +1467,8 @@ void AstVarXRef::dump(std::ostream& str) const { } void AstVarRef::dump(std::ostream& str) const { this->AstNodeVarRef::dump(str); - if (packagep()) { str << " pkg=" << nodeAddr(packagep()); } - if (access().isWrite()) { - str << " [LV] => "; - } else { - str << " [RV] <- "; - } + if (packagep()) str << " pkg=" << nodeAddr(packagep()); + str << " " << access().arrow() << " "; if (varScopep()) { varScopep()->dump(str); } else if (varp()) { diff --git a/src/V3Const.cpp b/src/V3Const.cpp index ed0e10b04..cc05c126c 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -314,7 +314,7 @@ private: // It was an expression, then got constified. In reality, the WordSel // must be wrapped in a Cond, that will be false. return (VN_IS(nodep->rhsp(), Const) && VN_IS(nodep->fromp(), NodeVarRef) - && !VN_CAST_CONST(nodep->fromp(), NodeVarRef)->access().isWrite() + && VN_CAST_CONST(nodep->fromp(), NodeVarRef)->access().isReadOnly() && (static_cast(VN_CAST_CONST(nodep->rhsp(), Const)->toUInt()) >= VN_CAST(nodep->fromp(), NodeVarRef)->varp()->widthWords())); } diff --git a/src/V3Gate.cpp b/src/V3Gate.cpp index 92fb406f8..e5a1ae68a 100644 --- a/src/V3Gate.cpp +++ b/src/V3Gate.cpp @@ -448,7 +448,7 @@ private: vvertexp->setIsClock(); // For SYNCASYNCNET varscp->user2(true); - } else if (m_activep && m_activep->hasClocked() && !nodep->access().isWrite()) { + } else if (m_activep && m_activep->hasClocked() && nodep->access().isReadOnly()) { if (varscp->user2()) { if (!vvertexp->rstAsyncNodep()) vvertexp->rstAsyncNodep(nodep); } else { diff --git a/src/V3Tristate.cpp b/src/V3Tristate.cpp index 1bcf41c3f..dad10cffc 100644 --- a/src/V3Tristate.cpp +++ b/src/V3Tristate.cpp @@ -1237,7 +1237,7 @@ class TristateVisitor : public TristateBaseVisitor { UINFO(9, " Ref-to-lvalue " << nodep << endl); m_tgraph.didProcess(nodep); mapInsertLhsVarRef(nodep); - } else if (!nodep->access().isWrite() + } else if (nodep->access().isReadOnly() // Not already processed, nor varref from visit(AstPin) creation && !nodep->user1p() // Reference to another tristate variable diff --git a/src/V3Unroll.cpp b/src/V3Unroll.cpp index a94de57ac..38fb4e602 100644 --- a/src/V3Unroll.cpp +++ b/src/V3Unroll.cpp @@ -451,7 +451,7 @@ private: } if (m_varModeReplace && nodep->varp() == m_forVarp && nodep->varScopep() == m_forVscp - && !nodep->access().isWrite()) { + && nodep->access().isReadOnly()) { AstNode* newconstp = m_varValuep->cloneTree(false); nodep->replaceWith(newconstp); pushDeletep(nodep);