diff --git a/Changes b/Changes index f8540fb54..a62177081 100644 --- a/Changes +++ b/Changes @@ -49,6 +49,7 @@ Verilator 5.037 devel * Fix missing FreeBSD include (#6027) (#6028). [Joel Bodenmann] * Fix associative arrays with enum keys (#6034) (#6035). [Petr Nohavica] * Fix GCC 10 read-only linker error (#6040). [Todd Strader] +* Fix WIDTHCONCAT on packed pattern assignment (#6045). [Dan Petrisko] * Fix V3OrderParallel scoring contraction hang (#6052). [Bartłomiej Chmiel, Antmicro Ltd.] diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 88f510db1..c1eecc786 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -4722,6 +4722,9 @@ class WidthVisitor final : public VNVisitor { newp = valuep; } else { AstConcat* const concatp = new AstConcat{patp->fileline(), newp, valuep}; + // Have resolved widths, no reason to warn about widths on the concat itself + newp->fileline()->modifyWarnOff(V3ErrorCode::WIDTHCONCAT, true); + valuep->fileline()->modifyWarnOff(V3ErrorCode::WIDTHCONCAT, true); newp = concatp; newp->dtypeSetLogicSized(concatp->lhsp()->width() + concatp->rhsp()->width(), nodep->dtypep()->numeric()); diff --git a/test_regress/t/t_lint_width_arraydecl.v b/test_regress/t/t_lint_width_arraydecl.v index 5de0ecc50..55a3d0e4c 100644 --- a/test_regress/t/t_lint_width_arraydecl.v +++ b/test_regress/t/t_lint_width_arraydecl.v @@ -14,8 +14,32 @@ module t( input [UADDR_WIDTH-1:0] mAddr, output logic [UROM_WIDTH-1:0] mOutput); + // Issue #3959 reg [UROM_WIDTH-1:0] uRam[UROM_DEPTH]; always @(posedge clk) mOutput <= uRam[mAddr]; + // Issue #6045 + typedef enum logic [1:0] { e_0, e_1, e_2, e_3 } enum_e; + + typedef struct packed { + integer unsigned x; + integer unsigned y; + } foo_s; + + typedef struct packed { + integer unsigned y; + } bar_s; + + // Warning due to concatenation, but this is actually a member assignment + localparam foo_s foo = '{ + y: (1 << e_0) | (1 << e_3) + , default: '0 + }; + + // No warning + localparam bar_s bar = '{ + y: (1 << e_0) | (1 << e_3) + }; + endmodule