power_enums: map in/out to extra
authorDmitry Selyutin <ghostmansd@gmail.com>
Thu, 4 Aug 2022 20:06:45 +0000 (23:06 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Sun, 14 Aug 2022 19:07:43 +0000 (22:07 +0300)
src/openpower/decoder/power_enums.py

index 013d3d08c1bc53302e3981ed672645590e7a2bad..45b30c11a9c9cb578f37d8c0b02619b3f22a6a59 100644 (file)
@@ -245,6 +245,16 @@ class SVExtraReg(Enum):
     WHOLE_REG = auto()
     SPR = auto()
 
+    @classmethod
+    def _missing_(cls, value):
+        selectors = (
+            In1Sel, In2Sel, In3Sel, CRInSel,
+            OutSel, CROutSel,
+        )
+        if isinstance(value, selectors):
+            return cls.__members__.get(value, cls.NONE)
+        return super()._missing_(value)
+
 
 @unique
 class SVP64PredMode(Enum):