power_insn: support mr/mrr specifiers
authorDmitry Selyutin <ghostmansd@gmail.com>
Mon, 21 Nov 2022 16:48:26 +0000 (19:48 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Sun, 15 Jan 2023 19:47:22 +0000 (22:47 +0300)
src/openpower/decoder/power_insn.py

index 2134750398fc97afa87da4e8c27fbd40b773f0e7..ab200663c4c634b965ef684fd232861fb390f674 100644 (file)
@@ -2868,6 +2868,38 @@ class SpecifierSatU(Specifier):
             etalon="satu", sign=False)
 
 
+@_dataclasses.dataclass(eq=True, frozen=True)
+class SpecifierMR(Specifier):
+    @classmethod
+    def match(cls, desc, record):
+        if desc != "mr":
+            return None
+
+        return cls(record=record)
+
+    def assemble(self, insn):
+        rm = insn.prefix.rm.select(record=self.record)
+        rm.mode.sel = 0
+        rm.mr = 1
+        rm.RG = 0
+
+
+@_dataclasses.dataclass(eq=True, frozen=True)
+class SpecifierMRR(Specifier):
+    @classmethod
+    def match(cls, desc, record):
+        if desc != "mr":
+            return None
+
+        return cls(record=record)
+
+    def assemble(self, insn):
+        rm = insn.prefix.rm.select(record=self.record)
+        rm.mode.sel = 0
+        rm.mr = 1
+        rm.RG = 1
+
+
 class Specifiers(tuple):
     SPECS = (
         SpecifierW,
@@ -2885,6 +2917,8 @@ class Specifiers(tuple):
         SpecifierEls,
         SpecifierSatS,
         SpecifierSatU,
+        SpecifierMR,
+        SpecifierMRR,
     )
 
     def __new__(cls, items, record):