Fix slice of unpacked array calculation (Issue #2506) (#2507)

Fixes Issue #2506 by shifting index as ArraySel does
This commit is contained in:
Yutetsu TAKATSUKASA
2020-08-22 15:23:26 +09:00
committed by GitHub
parent dbb69412e5
commit f632ea500c
6 changed files with 123 additions and 19 deletions
+3 -2
View File
@@ -351,8 +351,9 @@ private:
nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else { // Slice
AstSliceSel* newp = new AstSliceSel(nodep->fileline(), fromp,
VNumRange(VNumRange::LeftRight(), msb, lsb));
AstSliceSel* newp = new AstSliceSel(
nodep->fileline(), fromp,
VNumRange(VNumRange::LeftRight(), msb - fromRange.lo(), lsb - fromRange.lo()));
nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep);
}