From: Luke Kenneth Casson Leighton Date: Fri, 19 Jun 2020 14:25:04 +0000 (+0100) Subject: add SelectableInt.abs X-Git-Tag: div_pipeline~312 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3959a4797106b0d8566c3d9aa755b04f61ab0bf4;p=soc.git add SelectableInt.abs https://bugs.libre-soc.org/show_bug.cgi?id=324#c19 --- 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):