selectable_int: support fields boolean check
authorDmitry Selyutin <ghostmansd@gmail.com>
Wed, 17 Aug 2022 20:32:48 +0000 (23:32 +0300)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 29 Aug 2022 19:38:11 +0000 (20:38 +0100)
src/openpower/decoder/selectable_int.py

index baeab54ff22e3abee9bb731bd0db36a8bff608b5..d666bd9b54d8e63a54bb48a687e26e03ab65b195 100644 (file)
@@ -144,6 +144,13 @@ class FieldSelectableInt:
     def __repr__(self):
         return f"{self.__class__.__name__}(si={self.si}, br={self.br})"
 
+    def __bool__(self):
+        for key in self.br.values():
+            bit = self.si[key].value
+            if bit:
+                return True
+        return False
+
     def asint(self, msb0=False):
         res = 0
         brlen = len(self.br)