From: Luke Kenneth Casson Leighton Date: Fri, 3 Apr 2020 19:00:37 +0000 (+0100) Subject: add __bool__ override to selectable_int X-Git-Tag: div_pipeline~1547 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6d5767fd8bb73ef0ccbe40d7a2567e7e7222be21;p=soc.git add __bool__ override to selectable_int --- diff --git a/src/soc/decoder/selectable_int.py b/src/soc/decoder/selectable_int.py index 05cf2b21..53b84f60 100644 --- a/src/soc/decoder/selectable_int.py +++ b/src/soc/decoder/selectable_int.py @@ -129,6 +129,9 @@ class SelectableInt: return onebit(other == self.value) assert False + def __bool__(self): + return self.value != 0 + def __repr__(self): return "SelectableInt(value={:x}, bits={})".format(self.value, self.bits)