From 55d78b225d4138b485018bf6a9d9bde0b0ef3c2d Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Thu, 28 May 2026 18:34:36 +0100 Subject: [PATCH] Fix signing off new MULTIDRIVEN warnigns on variable (#7672) --- src/V3Undriven.cpp | 3 +- .../t/t_lint_always_ff_multidriven_bad.out | 8 ++++++ .../t/t_lint_always_ff_multidriven_bad.v | 28 ++++++++++++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/V3Undriven.cpp b/src/V3Undriven.cpp index cca308d05..d4a2a1fd5 100644 --- a/src/V3Undriven.cpp +++ b/src/V3Undriven.cpp @@ -530,7 +530,8 @@ class UndrivenVisitor final : public VNVisitorConst { if (entryp->isDrivenWhole() && !m_inBBox && !VN_IS(nodep, VarXRef) && !VN_IS(nodep->dtypep()->skipRefp(), UnpackArrayDType) && !sameFileLine && !entryp->isUnderGen() && otherWritep && !entryp->isFtaskDriven() - && !ftaskDef) { + && !ftaskDef + && !nodep->varp()->fileline()->warnIsOff(V3ErrorCode::MULTIDRIVEN)) { const bool otherWriteIsStaticInit = nodep->varp()->hasUserInit() && otherWritep == entryp->initStaticp(); diff --git a/test_regress/t/t_lint_always_ff_multidriven_bad.out b/test_regress/t/t_lint_always_ff_multidriven_bad.out index 7486d44ec..fa7b14b1d 100644 --- a/test_regress/t/t_lint_always_ff_multidriven_bad.out +++ b/test_regress/t/t_lint_always_ff_multidriven_bad.out @@ -16,4 +16,12 @@ t/t_lint_always_ff_multidriven_bad.v:20:5: ... Location of always_ff write 20 | b <= 1'b1; | ^ +%Warning-MULTIDRIVEN: t/t_lint_always_ff_multidriven_bad.v:34:7: Variable written to in always_ff also written by other process (IEEE 1800-2023 9.2.2.4): 'q' + : ... note: In instance 't' + t/t_lint_always_ff_multidriven_bad.v:34:7: + 34 | q[i][1] <= a; + | ^ + t/t_lint_always_ff_multidriven_bad.v:29:7: ... Location of other write + 29 | q[i][0] <= a; + | ^ %Error: Exiting due to diff --git a/test_regress/t/t_lint_always_ff_multidriven_bad.v b/test_regress/t/t_lint_always_ff_multidriven_bad.v index ae435f716..ddc2f6034 100644 --- a/test_regress/t/t_lint_always_ff_multidriven_bad.v +++ b/test_regress/t/t_lint_always_ff_multidriven_bad.v @@ -4,7 +4,7 @@ // SPDX-FileCopyrightText: 2026 Zhi QU // SPDX-License-Identifier: CC0-1.0 -module t; +module t(input wire clk); logic a; @@ -22,4 +22,30 @@ module t; initial b = 1'b0; // <--- Warning + reg [1:0][1:0] q; + + always_ff @(posedge clk) begin + for (int i = 0 ; i < 2 ; ++i) + q[i][0] <= a; // <--- Warning + end + + always_ff @(posedge clk) begin + for (int i = 0 ; i < 2 ; ++i) + q[i][1] <= a; // <--- Warning + end + + /* verilator lint_off MULTIDRIVEN */ + reg [1:0][1:0] q2; + /* verilator lint_on MULTIDRIVEN */ + + always_ff @(posedge clk) begin + for (int i = 0 ; i < 2 ; ++i) + q2[i][0] <= a; // <--- NO Warning + end + + always_ff @(posedge clk) begin + for (int i = 0 ; i < 2 ; ++i) + q2[i][1] <= a; // <--- NO Warning + end + endmodule