selectable_int: allow further fields slicing
authorDmitry Selyutin <ghostmansd@gmail.com>
Wed, 17 Aug 2022 20:43:04 +0000 (23:43 +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 d666bd9b54d8e63a54bb48a687e26e03ab65b195..7e7eb97d92a2ceafbfa3e94acb6828ee6ef1adf0 100644 (file)
@@ -74,12 +74,15 @@ class FieldSelectableInt:
         log("getitem", key, self.br)
         if isinstance(key, SelectableInt):
             key = key.value
+
         if isinstance(key, int):
             key = self.br[key]  # don't do POWER 1.3.4 bit-inversion
             return self.si[key]
-        if isinstance(key, slice):
+        elif isinstance(key, slice):
             key = self.br[key]
             return selectconcat(*[self.si[x] for x in key])
+        elif isinstance(key, (tuple, list, range)):
+            return FieldSelectableInt(si=self, br=key)
 
     def __setitem__(self, key, value):
         if isinstance(key, SelectableInt):