TODO section 24, coverage_gaps M7 via topo 2.9-6 and 2.9-4. unused-signal, undriven-net and multiply-driven shipped off because a per-file analysis cannot see a signal read or driven from another file's hierarchy. The index now carries a per-file identifier census - FileFacts::words, FACTS_FORMAT 12 -> 13, one harvest lifted from the server's completion candidates and now feeding them back from the store instead of re-lexing every file at startup (scan -28 percent) - and the linter gains a MentionOracle: unused-signal and undriven-net say nothing when the name is mentioned in any other indexed file, the false-negative-safe direction; multiply-driven shares the gate but never reads it. The three are on wherever an oracle exists (the editor always, the CLI when it walks a project) and off for a single file or stdin. With them, the missing off switch: [lint] select/ignore in lucisv.toml with CLI flags winning key by key, and lucisv.lint.select/ignore in the editor. QA's finding, reworked: the census dropped macro invocations whole, so a signal named only inside `uvm_info(..., dut.sig) was not silenced; the harvest now splits macro, directive and attribute words, skipping double-quoted runs so a "%d" cannot silence a signal named d project-wide, with workspace-defined macro names filtered out of the completion table at the reader. Store +16.9 percent corpus / +15.0 percent opentitan, measured. Corpus unused-signal 52 -> 44 and undriven-net 3 -> 0 with every silencing hand-checked, nothing added; opentitan - lint-clean under its own tools - 14 findings, all classified true against the whole repo. Also: the docs-site rules page gains the empty-item row it lacked. docs/features/semantic-lints-on/README.md. Co-Authored-By: Claude Fable 5 <[email protected]>
183 lines
4.4 KiB
Plaintext
183 lines
4.4 KiB
Plaintext
# a variable driven from two always blocks is flagged at its declaration
|
|
#select multiply-driven,unused-waiver
|
|
module m (input logic c, output logic q);
|
|
logic a;
|
|
//^ 9 multiply-driven
|
|
always_comb a = c;
|
|
always_ff @(posedge c) a <= 1'b0;
|
|
assign q = a;
|
|
endmodule
|
|
====
|
|
# the rule is off by default: the same source is quiet without #select
|
|
module m (input logic c, output logic q);
|
|
logic a;
|
|
always_comb a = c;
|
|
always_ff @(posedge c) a <= 1'b0;
|
|
assign q = a;
|
|
endmodule
|
|
====
|
|
# a continuous assignment plus a procedural block is the same mistake
|
|
#select multiply-driven,unused-waiver
|
|
module m (input logic c, output logic q);
|
|
logic a;
|
|
//^ 9 multiply-driven
|
|
assign a = c;
|
|
always_comb a = 1'b0;
|
|
assign q = a;
|
|
endmodule
|
|
====
|
|
# two continuous assignments to a variable are one driver too many
|
|
#select multiply-driven,unused-waiver
|
|
module m (input logic c, output logic q);
|
|
logic a;
|
|
//^ 9 multiply-driven
|
|
assign a = c;
|
|
assign a = 1'b0;
|
|
assign q = a;
|
|
endmodule
|
|
====
|
|
# one block assigning a variable many times is one driver
|
|
#select multiply-driven,unused-waiver
|
|
module m (input logic c, output logic q);
|
|
logic a;
|
|
always_comb begin
|
|
a = 1'b0;
|
|
if (c) a = 1'b1;
|
|
end
|
|
assign q = a;
|
|
endmodule
|
|
====
|
|
# a net may legally have as many drivers as it likes
|
|
#select multiply-driven,unused-waiver
|
|
module m (input logic c, output logic q);
|
|
wire a;
|
|
assign a = c;
|
|
assign a = 1'b0;
|
|
assign q = a;
|
|
endmodule
|
|
====
|
|
# different bits from different blocks are left alone
|
|
#select multiply-driven,unused-waiver
|
|
module m (input logic c, output logic [1:0] q);
|
|
logic [1:0] a;
|
|
always_comb a[0] = c;
|
|
always_comb a[1] = 1'b0;
|
|
assign q = a;
|
|
endmodule
|
|
====
|
|
# generate arms are exclusive, so two of them are one driver
|
|
#select multiply-driven,unused-waiver
|
|
module m #(parameter int W = 1) (input logic c, output logic q);
|
|
logic a;
|
|
generate
|
|
if (W == 1) begin : g0
|
|
always_comb a = c;
|
|
end else begin : g1
|
|
always_comb a = 1'b0;
|
|
end
|
|
endgenerate
|
|
assign q = a;
|
|
endmodule
|
|
====
|
|
# `ifdef arms are exclusive for the same reason
|
|
#select multiply-driven,unused-waiver
|
|
module m (input logic c, output logic q);
|
|
logic a;
|
|
`ifdef FAST
|
|
always_comb a = c;
|
|
`else
|
|
always_comb a = 1'b0;
|
|
`endif
|
|
assign q = a;
|
|
endmodule
|
|
====
|
|
# an initial block and a task body say nothing about which process runs them
|
|
#select multiply-driven,unused-waiver
|
|
module m (input logic c, output logic q);
|
|
logic a;
|
|
always_comb a = c;
|
|
initial a = 1'b0;
|
|
task t;
|
|
a = 1'b1;
|
|
endtask
|
|
assign q = a;
|
|
endmodule
|
|
====
|
|
# an initializer takes the signal out of the running
|
|
#select multiply-driven,unused-waiver
|
|
module m (input logic c, output logic q);
|
|
logic a = 1'b0;
|
|
always_comb a = c;
|
|
always_comb a = 1'b1;
|
|
assign q = a;
|
|
endmodule
|
|
====
|
|
# a name a macro mentions cannot be counted
|
|
#select multiply-driven,unused-waiver
|
|
module m (input logic c, output logic q);
|
|
logic a;
|
|
always_comb a = c;
|
|
always_comb a = 1'b0;
|
|
`NOTE(a)
|
|
assign q = a;
|
|
endmodule
|
|
====
|
|
# an assign plus a force/release override block is not two drivers
|
|
#select multiply-driven,unused-waiver
|
|
module m (input logic clk, input logic bypass, output logic q);
|
|
logic a;
|
|
assign a = clk;
|
|
always @(posedge clk) begin
|
|
if (bypass) force a = 1'b1;
|
|
else release a;
|
|
end
|
|
assign q = a;
|
|
endmodule
|
|
====
|
|
# an override anywhere takes the signal out of the rule, as initial does
|
|
#select multiply-driven,unused-waiver
|
|
module m (input logic c, output logic q);
|
|
logic a;
|
|
always_comb a = c;
|
|
always_comb a = 1'b0;
|
|
initial force a = 1'b1;
|
|
assign q = a;
|
|
endmodule
|
|
====
|
|
# waived on the same line
|
|
#select multiply-driven,unused-waiver
|
|
module m (input logic c, output logic q);
|
|
logic a; // lucisv: waive multiply-driven
|
|
always_comb a = c;
|
|
always_comb a = 1'b0;
|
|
assign q = a;
|
|
endmodule
|
|
====
|
|
# a waiver that waives nothing is reported
|
|
#select multiply-driven,unused-waiver
|
|
module m (input logic c, output logic q);
|
|
logic a; // lucisv: waive multiply-driven
|
|
//^ 12 unused-waiver
|
|
always_comb a = c;
|
|
assign q = a;
|
|
endmodule
|
|
====
|
|
# with a project behind it the rule is on by default — no #select needed
|
|
#workspace
|
|
module m (input logic clk, input logic d);
|
|
logic a;
|
|
//^ 9 multiply-driven
|
|
always_comb a = d;
|
|
always_comb a = ~d;
|
|
endmodule
|
|
====
|
|
# it never consults the oracle: a name other files mention still reports,
|
|
# because nothing another file does can take an in-file driver away
|
|
#workspace a
|
|
module m (input logic clk, input logic d);
|
|
logic a;
|
|
//^ 9 multiply-driven
|
|
always_comb a = d;
|
|
always_comb a = ~d;
|
|
endmodule
|