Fix elaboration displays with `%m` (#6445).

This commit is contained in:
Wilson Snyder 2025-09-16 20:48:23 -04:00
parent 4ab0690428
commit b10c6293d9
3 changed files with 11 additions and 1 deletions

View File

@ -50,6 +50,7 @@ Verilator 5.041 devel
* Fix external function declarations with class typedef references (#6433). * Fix external function declarations with class typedef references (#6433).
* Fix internal error on out-of-bounds real array access. * Fix internal error on out-of-bounds real array access.
* Fix pre/post increments in assertions (#6434). * Fix pre/post increments in assertions (#6434).
* Fix elaboration displays with `%m` (#6445). [Alex Solomatnikov]
Verilator 5.040 2025-08-30 Verilator 5.040 2025-08-30

View File

@ -5756,6 +5756,11 @@ class WidthVisitor final : public VNVisitor {
// Just let all arguments seek their natural sizes // Just let all arguments seek their natural sizes
userIterateChildren(nodep, WidthVP{SELF, BOTH}.p()); userIterateChildren(nodep, WidthVP{SELF, BOTH}.p());
if (!m_paramsOnly) { if (!m_paramsOnly) {
nodep->foreach([this](AstScopeName* nodep) { //
nodep->replaceWith(
new AstConst{nodep->fileline(), AstConst::String{}, "<scope-unavailable>"});
pushDeletep(nodep);
});
V3Const::constifyParamsEdit(nodep->fmtp()); // fmtp may change V3Const::constifyParamsEdit(nodep->fmtp()); // fmtp may change
string text = VString::dequotePercent(nodep->fmtp()->text()); string text = VString::dequotePercent(nodep->fmtp()->text());
if (text.empty()) text = "Elaboration system task message (IEEE 1800-2023 20.11)"; if (text.empty()) text = "Elaboration system task message (IEEE 1800-2023 20.11)";

View File

@ -7,7 +7,7 @@
module t; module t;
localparam STR = "string"; localparam STR = "string";
function logic checkParameter(input logic [8:0] N); function logic checkParameter(input logic [8:0] N);
$display("x is %d.", N); $info("For %m, x is %d.", N);
if (N == 1) if (N == 1)
return 0; return 0;
$fatal(1, "Parameter %d is invalid...%s and %s", N, STR, "constant both work"); $fatal(1, "Parameter %d is invalid...%s and %s", N, STR, "constant both work");
@ -19,6 +19,10 @@ module t;
localparam X = checkParameter(1); localparam X = checkParameter(1);
`endif `endif
generate
$info("%m: In generate"); // Issue 6445
endgenerate
initial begin initial begin
$write("*-* All Finished *-*\n"); $write("*-* All Finished *-*\n");
$finish; $finish;