From 149f5a3b90a148d7cd94be514a624ed896aa282c Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Wed, 17 Aug 2022 23:32:48 +0300 Subject: [PATCH] selectable_int: support fields boolean check --- src/openpower/decoder/selectable_int.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/openpower/decoder/selectable_int.py b/src/openpower/decoder/selectable_int.py index baeab54f..d666bd9b 100644 --- a/src/openpower/decoder/selectable_int.py +++ b/src/openpower/decoder/selectable_int.py @@ -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) -- 2.30.2