VERILOG2029: Comparisons should have operands of same type
Summary
| Reliability | Security | Maintainability | Code attribute | Effort to fix | Tags |
|---|---|---|---|---|---|
| MEDIUM | - | - | Intentionality | Logical | 10min | synthesis, vscode, simulation, linter |
Description
Comparisons should have operands of same type. If not, one or both will be converted before the operation is performed. This is not necessarily a problem but the issue can be helpful if you prefer to be strict about disallowing implicit conversions.
Noncompliant code example
module fly;
logic [7:0] a;
struct packed { logic [7:0] x; } b;
initial begin
if (a == b) begin // Noncompliant
end
end
endmodule
Compliant solution
module fly;
logic [7:0] a;
logic [7:0] b;
initial begin
if (a == b) begin // Compliant
end
end
endmodule
Parameters
No parameters.