hdl.ast: fix shape for subtraction.

Fixes #813.
This commit is contained in:
Marcelina Kościelnicka 2023-06-07 14:29:33 +02:00 committed by Catherine
parent 3180a17fd9
commit 1d5e090580
2 changed files with 8 additions and 3 deletions

View file

@ -730,9 +730,12 @@ class Operator(Value):
return Shape(a_shape.width, True)
elif len(op_shapes) == 2:
a_shape, b_shape = op_shapes
if self.operator in ("+", "-"):
if self.operator == "+":
o_shape = _bitwise_binary_shape(*op_shapes)
return Shape(o_shape.width + 1, o_shape.signed)
if self.operator == "-":
o_shape = _bitwise_binary_shape(*op_shapes)
return Shape(o_shape.width + 1, True)
if self.operator == "*":
return Shape(a_shape.width + b_shape.width, a_shape.signed or b_shape.signed)
if self.operator == "//":