From 1bdf145f6f5f9b5e7f87f20b1f8ca1102d373ec9 Mon Sep 17 00:00:00 2001 From: Yilou Wang Date: Tue, 16 Jun 2026 12:21:08 +0200 Subject: [PATCH] Drop redundant width sets and cover weak always low-bound rejection --- src/V3AssertNfa.cpp | 5 +---- test_regress/t/t_assert_always_unbounded_bad.out | 4 ++++ test_regress/t/t_assert_always_unbounded_bad.v | 4 ++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/V3AssertNfa.cpp b/src/V3AssertNfa.cpp index 7dfdaaca8..3dc603bee 100644 --- a/src/V3AssertNfa.cpp +++ b/src/V3AssertNfa.cpp @@ -1786,19 +1786,16 @@ public: pendingp = svp; } else { pendingp = new AstLogOr{flp, pendingp, svp}; - pendingp->dtypeSetBit(); } } if (pendingp) { AstCExpr* const assertOnp = new AstCExpr{flp, AstCExpr::Pure{}, "vlSymsp->_vm_contextp__->assertOn()", 1}; - assertOnp->dtypeSetBit(); AstNodeExpr* const condp = new AstLogAnd{flp, assertOnp, pendingp}; - condp->dtypeSetBit(); AstDisplay* const dispp = new AstDisplay{flp, VDisplayType::DT_ERROR, "", nullptr, nullptr}; dispp->fmtp()->timeunit(m_modp->timeunit()); - AstNodeStmt* firep = dispp; + AstNodeStmt* const firep = dispp; if (v3Global.opt.stopFail()) firep->addNext(new AstStop{flp, false}); m_modp->addStmtsp(new AstFinal{flp, new AstIf{flp, condp, firep}}); } diff --git a/test_regress/t/t_assert_always_unbounded_bad.out b/test_regress/t/t_assert_always_unbounded_bad.out index 39f1983cf..ae5b01344 100644 --- a/test_regress/t/t_assert_always_unbounded_bad.out +++ b/test_regress/t/t_assert_always_unbounded_bad.out @@ -7,4 +7,8 @@ : ... note: In instance 't' 14 | assert property (@(posedge clk) s_always [2:$] a); | ^~~~~~~~ +%Error: t/t_assert_always_unbounded_bad.v:18:35: always range low bound must be a constant expression (IEEE 1800-2023 16.12.11) + : ... note: In instance 't' + 18 | assert property (@(posedge clk) always [$:5] a); + | ^~~~~~ %Error: Exiting due to diff --git a/test_regress/t/t_assert_always_unbounded_bad.v b/test_regress/t/t_assert_always_unbounded_bad.v index e07e7a3bc..9103865ef 100644 --- a/test_regress/t/t_assert_always_unbounded_bad.v +++ b/test_regress/t/t_assert_always_unbounded_bad.v @@ -13,4 +13,8 @@ module t (input clk); assert property (@(posedge clk) s_always a); assert property (@(posedge clk) s_always [2:$] a); + // A weak always range may only place $ on the high bound; an unbounded low + // bound is not a legal cycle_delay_const_range_expression. + assert property (@(posedge clk) always [$:5] a); + endmodule