From 519cc7d61c948920648ec4ebf6c5d819aa5608c3 Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Mon, 2 Aug 2021 13:51:18 +0100 Subject: [PATCH] Internals: Remove code duplication from V3Order No functional change --- src/V3Order.cpp | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/src/V3Order.cpp b/src/V3Order.cpp index 0ea3e82c0..93ad38651 100644 --- a/src/V3Order.cpp +++ b/src/V3Order.cpp @@ -259,41 +259,23 @@ private: bool m_newClkMarked; // Flag for deciding whether a new run is needed bool m_inAss = false; // Currently inside of a assignment int m_childClkWidth = 0; // If in hasClk, width of clock signal in child - int m_rightClkWidth = 0; // Clk width on the RHS // METHODS VL_DEBUG_FUNC; // Declare debug() virtual void visit(AstNodeAssign* nodep) override { m_hasClk = false; - if (AstVarRef* varrefp = VN_CAST(nodep->rhsp(), VarRef)) { - this->visit(varrefp); - m_rightClkWidth = varrefp->width(); - if (varrefp->varp()->attrClocker() == VVarAttrClocker::CLOCKER_YES) { - if (m_inClocked) { - varrefp->v3warn( - CLKDATA, "Clock used as data (on rhs of assignment) in sequential block " - << varrefp->prettyNameQ()); - } else { - m_hasClk = true; - UINFO(5, "node is already marked as clocker " << varrefp << endl); - } - } - } else { - m_inAss = true; - m_childClkWidth = 0; - iterateAndNextNull(nodep->rhsp()); - m_rightClkWidth = m_childClkWidth; - m_inAss = false; - } - - // do the marking + m_inAss = true; + m_childClkWidth = 0; + iterateAndNextNull(nodep->rhsp()); + m_inAss = false; if (m_hasClk) { - if (nodep->lhsp()->width() > m_rightClkWidth) { + // do the marking + if (nodep->lhsp()->width() > m_childClkWidth) { nodep->v3warn(CLKDATA, "Clock is assigned to part of data signal " << nodep->lhsp()->prettyNameQ()); UINFO(4, "CLKDATA: lhs with width " << nodep->lhsp()->width() << endl); - UINFO(4, " but rhs clock with width " << m_rightClkWidth << endl); + UINFO(4, " but rhs clock with width " << m_childClkWidth << endl); return; // skip the marking }