diff --git a/Changes b/Changes index 893e80830..e577ea78e 100644 --- a/Changes +++ b/Changes @@ -50,6 +50,7 @@ Verilator 5.041 devel * Fix external function declarations with class typedef references (#6433). * Fix internal error on out-of-bounds real array access. * Fix pre/post increments in assertions (#6434). +* Fix elaboration displays with `%m` (#6445). [Alex Solomatnikov] Verilator 5.040 2025-08-30 diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 9e32862d1..8a768e879 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -5756,6 +5756,11 @@ class WidthVisitor final : public VNVisitor { // Just let all arguments seek their natural sizes userIterateChildren(nodep, WidthVP{SELF, BOTH}.p()); if (!m_paramsOnly) { + nodep->foreach([this](AstScopeName* nodep) { // + nodep->replaceWith( + new AstConst{nodep->fileline(), AstConst::String{}, ""}); + pushDeletep(nodep); + }); V3Const::constifyParamsEdit(nodep->fmtp()); // fmtp may change string text = VString::dequotePercent(nodep->fmtp()->text()); if (text.empty()) text = "Elaboration system task message (IEEE 1800-2023 20.11)"; diff --git a/test_regress/t/t_assert_elab.v b/test_regress/t/t_assert_elab.v index 44d6d35de..9a23b1f5a 100644 --- a/test_regress/t/t_assert_elab.v +++ b/test_regress/t/t_assert_elab.v @@ -7,7 +7,7 @@ module t; localparam STR = "string"; function logic checkParameter(input logic [8:0] N); - $display("x is %d.", N); + $info("For %m, x is %d.", N); if (N == 1) return 0; $fatal(1, "Parameter %d is invalid...%s and %s", N, STR, "constant both work"); @@ -19,6 +19,10 @@ module t; localparam X = checkParameter(1); `endif + generate + $info("%m: In generate"); // Issue 6445 + endgenerate + initial begin $write("*-* All Finished *-*\n"); $finish;