power_insn: custom sz handling for branches
authorDmitry Selyutin <ghostmansd@gmail.com>
Tue, 20 Sep 2022 10:23:44 +0000 (13:23 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Tue, 20 Sep 2022 10:26:45 +0000 (13:26 +0300)
src/openpower/decoder/power_insn.py

index 98fd44c923fabb602f80e80b38344158a5d20a7d..600d8fd4e38eb3f12d7a4285efc651637a61261c 100644 (file)
@@ -1723,7 +1723,7 @@ class CROpRM(CROpBaseRM):
 # ********************
 # Branches mode
 # https://libre-soc.org/openpower/sv/branches/
-class BranchBaseRM(SZBaseRM, BaseRM):
+class BranchBaseRM(BaseRM):
     ALL: BaseRM[4]
     SNZ: BaseRM[5]
     SL: BaseRM[17]
@@ -1736,8 +1736,20 @@ class BranchBaseRM(SZBaseRM, BaseRM):
     def specifiers(self, record):
         if self.ALL:
             yield "all"
+
+        # /sz
+        #   branch.sz=1
+        #   branch.snz=0
+        # /snz
+        #   branch.sz=1
+        #   branch.snz=1
         if self.SNZ:
+            if not self.sz:
+                raise ValueError(self.sz)
             yield "snz"
+        elif self.sz:
+            yield "sz"
+
         if self.SL:
             yield "sl"
         if self.SLu: