VERILOG2000: Unused variables should be removed
Summary
| Reliability | Security | Maintainability | Code attribute | Effort to fix | Tags |
|---|---|---|---|---|---|
| MEDIUM | - | - | Intentionality | Logical | 10min | synthesis, vscode, linter, simulation, dead-code |
Description
A variable that is never used should be removed.
Noncompliant code example
module fly(input clk, output reg x);
logic a = '0;
int b; // Noncompliant: 'b' is never set nor read
int c; // Noncompliant: 'c' is set but never read
initial c = 42;
always @(posedge clk)
begin
x <= a;
end
endmodule
Compliant solution
module fly(input clk, output reg x);
logic a = '0;
always @(posedge clk)
begin
x <= a;
end
endmodule
Parameters
No parameters.