From: Dmitry Selyutin Date: Wed, 17 Aug 2022 20:32:48 +0000 (+0300) Subject: selectable_int: support fields boolean check X-Git-Tag: sv_maxu_works-initial~41 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=149f5a3b90a148d7cd94be514a624ed896aa282c;p=openpower-isa.git selectable_int: support fields boolean check --- 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)