selectable_int: allow fields-based instantiation
authorDmitry Selyutin <ghostmansd@gmail.com>
Tue, 16 Aug 2022 18:21:32 +0000 (21:21 +0300)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 29 Aug 2022 19:38:10 +0000 (20:38 +0100)
src/openpower/decoder/selectable_int.py

index d1b8023cea4902389ee7c5952a62e2761f478b3a..cb12c83c31ce996a52c3ae4c264d1633038193df 100644 (file)
@@ -192,6 +192,11 @@ class SelectableInt:
                 raise ValueError(value)
             bits = value.bits
             value = value.value
+        elif isinstance(value, FieldSelectableInt):
+            if bits is not None:
+                raise ValueError(value)
+            bits = len(value.br)
+            value = value.si.value
         else:
             if not isinstance(value, int):
                 raise ValueError(value)