Support [*N:$] consecutive repetition (#7940)

Signed-off-by: Artur Bieniek <[email protected]>
This commit is contained in:
Artur Bieniek
2026-07-16 09:29:30 -04:00
committed by GitHub
parent 877fc1e812
commit 255bcff3ac
11 changed files with 119 additions and 8 deletions
+4 -1
View File
@@ -1556,7 +1556,7 @@ class WidthVisitor final : public VNVisitor {
}
}
void visit(AstSConsRep* nodep) override {
// IEEE 1800-2023 16.9.2 -- consecutive repetition [*N], [*N:M], [+], [*]
// IEEE 1800-2023 16.9.2 -- consecutive repetition [*N], [*N:M], [*N:$], [+], [*]
assertAtExpr(nodep);
if (m_vup->prelim()) {
userIterateAndNext(nodep->exprp(), WidthVP{SELF, BOTH}.p());
@@ -1566,6 +1566,9 @@ class WidthVisitor final : public VNVisitor {
if (!minConstp) {
nodep->v3error("Consecutive repetition count must be constant expression"
" (IEEE 1800-2023 16.9.2)");
} else if (minConstp->toSInt() < 0) {
nodep->v3error("Consecutive repetition count must be non-negative"
" (IEEE 1800-2023 16.9.2)");
} else if (!nodep->unbounded() && !nodep->maxCountp() && minConstp->toSInt() < 1) {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: [*0] consecutive repetition");
}