Identifies a conditional expression mixed with a binary expression in way that suggests a different intended order of operations.
module m;
logic a, b, c, d;
initial begin
if ((a + b ? 1 : 2) == 2) begin end // Noncompliant
if ((c + d ? 1 : 2) == 2) begin end // Noncompliant
end
endmodule
module m;
logic a, b, c, d;
initial begin
if ((a + (b ? 1 : 2)) == 2) begin end // Compliant: Parentheses around the '?:' expression to evaluate it first
if (((c + d) ? 1 : 2) == 2) begin end // Compliant: Parentheses around the '+' expression to silence this issue
end
endmodule