back.rtlil: extend unsigned operand of binop if another is signed.

Fixes #580.
This commit is contained in:
whitequark 2021-12-11 10:25:41 +00:00
parent 44b8bd29af
commit 25573c5eff

View file

@ -529,8 +529,8 @@ class _RHSValueCompiler(_ValueCompiler):
lhs_wire = self(lhs)
rhs_wire = self(rhs)
else:
lhs_bits = rhs_bits = max(lhs_bits + rhs_sign, rhs_bits + lhs_sign)
lhs_sign = rhs_sign = True
lhs_bits = rhs_bits = max(lhs_bits, rhs_bits)
lhs_wire = self.match_shape(lhs, lhs_bits, lhs_sign)
rhs_wire = self.match_shape(rhs, rhs_bits, rhs_sign)
res_bits, res_sign = value.shape()