VERILOG2095: Comparison operators should not have operands of differing signs
Summary
| Reliability | Security | Maintainability | Code attribute | Effort to fix | Tags |
|---|---|---|---|---|---|
| HIGH | - | - | Intentionality | Logical | 5min | synthesis, vscode, simulation, linter |
Description
If a comparison operator has operands of differing signs, the signed operand will be treated as unsigned, which can lead to unexpected results.
Noncompliant code example
module fly;
int a = -1;
int unsigned b = 1;
initial begin
if (a < b) begin
end
end
endmodule
Compliant solution
module fly;
int unsigned a = 0;
int unsigned b = 1;
initial begin
if (a < b) begin
end
end
endmodule
Parameters
No parameters.