power_insn: decouple common normal and ld/st RM
authorDmitry Selyutin <ghostmansd@gmail.com>
Sun, 18 Sep 2022 08:26:34 +0000 (11:26 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Sun, 18 Sep 2022 08:26:34 +0000 (11:26 +0300)
src/openpower/decoder/power_insn.py

index d092bd16f9ca90a6fa001e3acae14a474e47d4bc..9f80d3a33d2754c83119726e77fffef63fd7a3b2 100644 (file)
@@ -1300,7 +1300,7 @@ class BaseRM(_Mapping):
                 yield f"{indent}{', '.join(map(str, members))}"
 
 
-class NormalBaseRM(BaseRM):
+class NormalLDSTBaseRM(BaseRM):
     @property
     def specifiers(self):
         ew = int(self.elwidth)
@@ -1315,6 +1315,10 @@ class NormalBaseRM(BaseRM):
         yield from super().specifiers
 
 
+class NormalBaseRM(NormalLDSTBaseRM):
+    pass
+
+
 class NormalSimpleRM(NormalBaseRM):
     """normal: simple mode"""
     dz: BaseRM.mode[3]
@@ -1427,19 +1431,8 @@ class NormalRM(NormalBaseRM):
     prrc0: NormalPredResultRc0RM
 
 
-class LDSTImmBaseRM(BaseRM):
-    @property
-    def specifiers(self):
-        ew = int(self.elwidth)
-        if ew != 0b00:
-            ew = {
-                0b11: "8",
-                0b10: "16",
-                0b01: "32",
-            }[ew]
-            yield f"ew={ew}"
-
-        yield from super().specifiers
+class LDSTImmBaseRM(NormalLDSTBaseRM):
+    pass
 
 
 class LDSTImmSimpleRM(LDSTImmBaseRM):
@@ -1510,19 +1503,8 @@ class LDSTImmRM(LDSTImmBaseRM):
     prrc0: LDSTImmPredResultRc0RM
 
 
-class LDSTIdxBaseRM(BaseRM):
-    @property
-    def specifiers(self):
-        ew = int(self.elwidth)
-        if ew != 0b00:
-            ew = {
-                0b11: "8",
-                0b10: "16",
-                0b01: "32",
-            }[ew]
-            yield f"ew={ew}"
-
-        yield from super().specifiers
+class LDSTIdxBaseRM(NormalLDSTBaseRM):
+    pass
 
 
 class LDSTIdxSimpleRM(LDSTIdxBaseRM):