From: whitequark Date: Sat, 19 Jan 2019 09:26:26 +0000 (+0000) Subject: hdl.ast: implement shape for modulo operator. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=efa92243d9cece2032043d2b38151320e5a4dfcf;p=nmigen.git hdl.ast: implement shape for modulo operator. --- diff --git a/nmigen/hdl/ast.py b/nmigen/hdl/ast.py index b330cb3..6e2155e 100644 --- a/nmigen/hdl/ast.py +++ b/nmigen/hdl/ast.py @@ -341,6 +341,8 @@ class Operator(Value): return a_bits + b_bits - 1, True # one operand signed, the other unsigned (add sign bit) return a_bits + b_bits + 1 - 1, True + if self.op == "%": + return a_bits, a_sign if self.op in ("<", "<=", "==", "!=", ">", ">=", "b"): return 1, False if self.op in ("&", "^", "|"):