Fix splitting of packed ports with non-zero based ranges (#5842)

This commit is contained in:
Geza Lore
2025-03-08 09:37:30 -05:00
committed by GitHub
parent 10a77a17a9
commit 20b964a9a2
4 changed files with 1224 additions and 1104 deletions
+2 -1
View File
@@ -1051,10 +1051,11 @@ class SplitPackedVarVisitor final : public VNVisitor, public SplitVarImpl {
}
const bool in = portp->isReadOnly();
FileLine* const fl = portp->fileline();
const int portLsb = portp->basicp()->lo();
for (const SplitNewVar& var : vars) {
AstNodeExpr* rhsp
= new AstSel{fl, new AstVarRef{fl, portp, !in ? VAccess::WRITE : VAccess::READ},
var.lsb(), var.bitwidth()};
var.lsb() - portLsb, var.bitwidth()};
AstNodeExpr* lhsp = new AstVarRef{fl, var.varp(), in ? VAccess::WRITE : VAccess::READ};
if (!in) std::swap(lhsp, rhsp);
AstNodeAssign* const assignp = newAssign(fl, lhsp, rhsp, portp);