From 3959a4797106b0d8566c3d9aa755b04f61ab0bf4 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 19 Jun 2020 15:25:04 +0100 Subject: [PATCH] add SelectableInt.abs https://bugs.libre-soc.org/show_bug.cgi?id=324#c19 --- src/soc/decoder/selectable_int.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/soc/decoder/selectable_int.py b/src/soc/decoder/selectable_int.py index 72640909..eebada68 100644 --- a/src/soc/decoder/selectable_int.py +++ b/src/soc/decoder/selectable_int.py @@ -181,6 +181,8 @@ class SelectableInt: return self._op(or_, b) def __xor__(self, b): return self._op(xor, b) + def __abs__(self): + return SelectableInt(0, self.bits) - self def __rsub__(self, b): if isinstance(b, int): -- 2.30.2