projects
/
soc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
add __bool__ override to selectable_int
[soc.git]
/
src
/
soc
/
decoder
/
selectable_int.py
diff --git
a/src/soc/decoder/selectable_int.py
b/src/soc/decoder/selectable_int.py
index 05cf2b21604ce75f461412c0393ba16e141d8226..53b84f60957e9ed3c5e2b672b2aafb26d727b815 100644
(file)
--- 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)