diff --git a/src/V3Width.cpp b/src/V3Width.cpp index ed4cd0dea..6a8a77d33 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -1567,34 +1567,35 @@ class WidthVisitor final : public VNVisitor { // for a strong always shall be bounded"). Weak always [m:$] is legal: // an unbounded upper bound imposes no end-of-trace obligation. if (nodep->isStrong() && (loUnbounded || hiUnbounded)) { - nodep->v3error("s_always range must be bounded (IEEE 1800-2023 16.12.11)"); + AstNode* const boundp = loUnbounded ? nodep->loBoundp() : nodep->hiBoundp(); + boundp->v3error("s_always range must be bounded (IEEE 1800-2023 16.12.11)"); nodep->dtypeSetBit(); return; } if (loUnbounded) { // Only the high bound may be $ (cycle_delay_const_range_expression). - nodep->v3error("always range low bound must be a constant expression" - " (IEEE 1800-2023 16.12.11)"); + nodep->loBoundp()->v3error("always range low bound must be a constant expression" + " (IEEE 1800-2023 16.12.11)"); nodep->dtypeSetBit(); return; } const AstConst* const loConstp = VN_CAST(nodep->loBoundp(), Const); const AstConst* const hiConstp = VN_CAST(nodep->hiBoundp(), Const); if (!loConstp) { - nodep->v3error("always range low bound must be a constant expression" - " (IEEE 1800-2023 16.12.11)"); + nodep->loBoundp()->v3error("always range low bound must be a constant expression" + " (IEEE 1800-2023 16.12.11)"); } if (!hiUnbounded && !hiConstp) { - nodep->v3error("always range high bound must be a constant expression" - " (IEEE 1800-2023 16.12.11)"); + nodep->hiBoundp()->v3error("always range high bound must be a constant expression" + " (IEEE 1800-2023 16.12.11)"); } if (loConstp && loConstp->toSInt() < 0) { - nodep->v3error("always range low bound must be non-negative" - " (IEEE 1800-2023 16.12.11)"); + nodep->loBoundp()->v3error("always range low bound must be non-negative" + " (IEEE 1800-2023 16.12.11)"); } if (!hiUnbounded && loConstp && hiConstp && hiConstp->toSInt() < loConstp->toSInt()) { - nodep->v3error("always range high bound must be >= low bound" - " (IEEE 1800-2023 16.12.11)"); + nodep->hiBoundp()->v3error("always range high bound must be >= low bound" + " (IEEE 1800-2023 16.12.11)"); } bool hasPropertyOp = propp->isMultiCycleSva(); if (!hasPropertyOp) { diff --git a/test_regress/t/t_assert_always_unbounded_bad.out b/test_regress/t/t_assert_always_unbounded_bad.out index ae5b01344..155120065 100644 --- a/test_regress/t/t_assert_always_unbounded_bad.out +++ b/test_regress/t/t_assert_always_unbounded_bad.out @@ -3,12 +3,12 @@ 13 | assert property (@(posedge clk) s_always a); | ^~~~~~~~ ... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance. -%Error: t/t_assert_always_unbounded_bad.v:14:35: s_always range must be bounded (IEEE 1800-2023 16.12.11) +%Error: t/t_assert_always_unbounded_bad.v:14:47: s_always range must be bounded (IEEE 1800-2023 16.12.11) : ... 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) + | ^ +%Error: t/t_assert_always_unbounded_bad.v:18:43: 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_prop_always_bad.out b/test_regress/t/t_prop_always_bad.out index 4e06a8feb..62d3d66a8 100644 --- a/test_regress/t/t_prop_always_bad.out +++ b/test_regress/t/t_prop_always_bad.out @@ -1,34 +1,34 @@ -%Error: t/t_prop_always_bad.v:13:20: always range low bound must be non-negative (IEEE 1800-2023 16.12.11) +%Error: t/t_prop_always_bad.v:13:28: always range low bound must be non-negative (IEEE 1800-2023 16.12.11) : ... note: In instance 't' 13 | assert property (always [-1:3] a); - | ^~~~~~ + | ^ ... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance. -%Error: t/t_prop_always_bad.v:14:20: always range high bound must be >= low bound (IEEE 1800-2023 16.12.11) +%Error: t/t_prop_always_bad.v:14:30: always range high bound must be >= low bound (IEEE 1800-2023 16.12.11) : ... note: In instance 't' 14 | assert property (always [5:2] a); - | ^~~~~~ + | ^ %Error: t/t_prop_always_bad.v:15:28: Expecting expression to be constant, but variable isn't const: 'x' : ... note: In instance 't' 15 | assert property (always [x:3] a); | ^ -%Error: t/t_prop_always_bad.v:15:20: always range low bound must be a constant expression (IEEE 1800-2023 16.12.11) +%Error: t/t_prop_always_bad.v:15:28: always range low bound must be a constant expression (IEEE 1800-2023 16.12.11) : ... note: In instance 't' 15 | assert property (always [x:3] a); - | ^~~~~~ + | ^ %Error: t/t_prop_always_bad.v:16:30: Expecting expression to be constant, but variable isn't const: 'x' : ... note: In instance 't' 16 | assert property (always [1:x] a); | ^ -%Error: t/t_prop_always_bad.v:16:20: always range high bound must be a constant expression (IEEE 1800-2023 16.12.11) +%Error: t/t_prop_always_bad.v:16:30: always range high bound must be a constant expression (IEEE 1800-2023 16.12.11) : ... note: In instance 't' 16 | assert property (always [1:x] a); - | ^~~~~~ + | ^ %Error: t/t_prop_always_bad.v:17:20: s_always range must be bounded (IEEE 1800-2023 16.12.11) : ... note: In instance 't' 17 | assert property (s_always a); | ^~~~~~~~ -%Error: t/t_prop_always_bad.v:18:20: s_always range must be bounded (IEEE 1800-2023 16.12.11) +%Error: t/t_prop_always_bad.v:18:32: s_always range must be bounded (IEEE 1800-2023 16.12.11) : ... note: In instance 't' 18 | assert property (s_always [1:$] a); - | ^~~~~~~~ + | ^ %Error: Exiting due to