Fix signing off new MULTIDRIVEN warnigns on variable (#7672)

This commit is contained in:
Geza Lore 2026-05-28 18:34:36 +01:00 committed by GitHub
parent 3a91b333c3
commit 55d78b225d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 37 additions and 2 deletions

View File

@ -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();

View File

@ -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

View File

@ -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