From 38b3c4af31aea73ba0beb5952deceabf53b7f76f Mon Sep 17 00:00:00 2001 From: whitequark Date: Sat, 19 Jan 2019 09:26:26 +0000 Subject: [PATCH] hdl.ast: implement shape for modulo operator. --- nmigen/hdl/ast.py | 2 ++ 1 file changed, 2 insertions(+) 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 ("&", "^", "|"): -- 2.30.2