VERILOG2060: Implicit conversions from real to integer value in string formatting function should be avoided
Summary
| Reliability | Security | Maintainability | Code attribute | Effort to fix | Tags |
|---|---|---|---|---|---|
| LOW | - | - | Consistency | Conventional | 5min | synthesis, vscode, simulation, linter |
Description
A string formatting function is passed a real value for an integer format specifier, which will force the value to round to an integer.
Update the format specifier or add an explicit cast if the conversion is intended.
Noncompliant code example
module fly;
initial $display("%d", 3.14);
endmodule
Compliant solution
module fly;
initial $display("%f", 3.14);
endmodule
module fly;
initial $display("%d", int'(3.14));
endmodule
Parameters
No parameters.