Open mwkmwkmwk opened 3 years ago
As quoted by @mwkmwkmwk , either adding [31:0]
to localparam
to infer integer type OR wire [31:0] tmp = 2.0; assign O = A < tmp;
will work to avoid floating point operations which are not synthesizable, because they don't map to logic circuits without major effort. However, the first method (adding the type directly on localparam
is more superior)
This bug is a little tricky. detectSignWidthWorker()
has a hack where it sets sign_hint = true
when found_real
is set. This appears intended to treat -1 * -1.17
correctly in an unsigned context (i.e., when compared with an unsigned expression). Without the hack, it simplifies to INT_MAX * -1.17
. This is the only place where sign_hint
is set true in this way, breaking the (quite reasonable) assumptions made in the getRTLIL
code for comparison operators. I think we should remove the existing hack, but I don't have a great proposal for making something like -1 * -1.17
work correctly without it.
Isn't the frontend too liberal in this case anyway? AFAICS the rules here would require promoting A to a real and performing a real comparison, which is non-synthesizable, and should result in an error.
Parsing that fails with: