From a554dd7c8d031268f22c4cee0ee7118d6614bd2d Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Thu, 15 Dec 2022 22:49:49 -0500 Subject: [PATCH] Optimize expansion of extend operators - fix earlier commit. --- src/V3Expand.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/V3Expand.cpp b/src/V3Expand.cpp index 86091a572..4b5ae7df2 100644 --- a/src/V3Expand.cpp +++ b/src/V3Expand.cpp @@ -344,11 +344,11 @@ private: bool expandWide(AstNodeAssign* nodep, AstExtend* rhsp) { UINFO(8, " Wordize ASSIGN(EXTEND) " << nodep << endl); if (!doExpand(nodep)) return false; - AstNodeExpr* const lhsp = nodep->lhsp(); - for (int w = 0; w < lhsp->widthWords(); ++w) { - addWordAssign(nodep, w, newAstWordSelClone(lhsp, w)); + AstNodeExpr* const rlhsp = rhsp->lhsp(); + for (int w = 0; w < rlhsp->widthWords(); ++w) { + addWordAssign(nodep, w, newAstWordSelClone(rlhsp, w)); } - for (int w = rhsp->widthWords(); w < nodep->widthWords(); ++w) { + for (int w = rlhsp->widthWords(); w < nodep->widthWords(); ++w) { addWordAssign(nodep, w, new AstConst{nodep->fileline(), AstConst::SizedEData{}, 0}); } return true;