You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fantastic find, thanks! The Comb-to-LLVM lowering should probably insert the necessary code around divisions to ensure the semantics of comb.div* are preserved. I'm not even sure if we currently specify what division by zero is.
AFAIK, we don't have a definition for division-by-zero semantics, which would be necessary to fix this properly.
It would be great if the CIRCT community could agree on some semantics so that all backends are consistent. Currently,
the ExportVerilog directly lowers the operation to the / SV operation, which, I think, returns a 4-state 'x' (even if both inputs are 2-state).
the lowering to SMT (thus circt-lec) defines it to be 1 (the SMT default for div-by-zero)
Arcilator uses UB as in LLVM IR (which it really shouldn't do)
As an intermediate solution, we could lower a %0 = comb.divu/s %a, %b : i32 to
comb.divs
(and probablycomb.divu
) generate code that causes aSIGFPE
signal on my system, due to division by zero.Below is a small sample that should be equivalent to
b == 0 ? 0 : a / b
, which results inwhen run with
--jit
.The text was updated successfully, but these errors were encountered: