power_fields: fix field slicing
authorDmitry Selyutin <ghostmansd@gmail.com>
Sat, 17 Sep 2022 12:57:40 +0000 (15:57 +0300)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 17 Sep 2022 16:44:16 +0000 (17:44 +0100)
src/openpower/decoder/power_fields.py

index c1a2d483115189dc155e2f555ee578163ae773af..80aa1d4e11eaabf8548c9f9992461a4dffadb664 100644 (file)
@@ -178,6 +178,9 @@ class Field(Reference, metaclass=FieldMeta):
         if isinstance(key, int):
             bit = self.storage[self.__class__.__members__[key]]
             return _SelectableInt(value=bit, bits=1)
+        if isinstance(key, slice):
+            assert key.step is None or key.step == 1
+            key = range(key.start, key.stop)
 
         return _selectconcat(*(self[bit] for bit in tuple(key)))