From: Dmitry Selyutin Date: Thu, 25 Aug 2022 19:30:03 +0000 (+0300) Subject: selectable_int: introduce more checks X-Git-Tag: sv_maxu_works-initial~29 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7bfc6aa754ed34ac7abf1690c1e80fe85a5afc4e;p=openpower-isa.git selectable_int: introduce more checks --- diff --git a/src/openpower/decoder/selectable_int.py b/src/openpower/decoder/selectable_int.py index d3caac30..46477509 100644 --- a/src/openpower/decoder/selectable_int.py +++ b/src/openpower/decoder/selectable_int.py @@ -97,6 +97,8 @@ class FieldSelectableInt: return selectconcat(*[self.si[x] for x in key]) elif isinstance(key, (tuple, list, range)): return FieldSelectableInt(si=self, br=key) + else: + raise ValueError(key) def __setitem__(self, key, value): if isinstance(key, SelectableInt): @@ -379,6 +381,8 @@ class SelectableInt: value = (self.value >> start) & mask log("getitem", stop, start, self.bits, hex(self.value), value) return SelectableInt(value, bits) + else: + raise ValueError(value) def __setitem__(self, key, value): if isinstance(key, SelectableInt): @@ -420,6 +424,8 @@ class SelectableInt: mask = ((1 << bits) - 1) << start value = value << start self.value = (self.value & ~mask) | (value & mask) + else: + raise ValueError(key) def __ge__(self, other): if isinstance(other, FieldSelectableInt):