From 6d5767fd8bb73ef0ccbe40d7a2567e7e7222be21 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 3 Apr 2020 20:00:37 +0100 Subject: [PATCH] add __bool__ override to selectable_int --- src/soc/decoder/selectable_int.py | 3 +++ 1 file changed, 3 insertions(+) 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) -- 2.30.2