From: whitequark Date: Sat, 19 Jan 2019 09:26:26 +0000 (+0000) Subject: hdl.ast: implement shape for modulo operator. X-Git-Tag: working~60 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=38b3c4af31aea73ba0beb5952deceabf53b7f76f;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 ("&", "^", "|"):