VERILOG2095: Comparison operators should not have operands of differing signs

Summary

Count: 1

ReliabilitySecurityMaintainabilityCode attributeEffort to fixTags
HIGH--Intentionality | Logical5minsynthesis, 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.