power_insn: consider EXTS operand as signed
authorDmitry Selyutin <ghostmansd@gmail.com>
Mon, 12 Dec 2022 21:55:32 +0000 (00:55 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Sun, 15 Jan 2023 19:47:22 +0000 (22:47 +0300)
src/openpower/decoder/power_insn.py

index d1a6c5eb8f169e9beb9210da96324b16278af7c7..d498e21bbf4dde4c47da3a8a7c60d394e714e7dd 100644 (file)
@@ -925,6 +925,12 @@ class SignedOperand(DynamicOperand):
             value = int(value, 0)
         return super().assemble(value=value, insn=insn)
 
+    def assemble(self, value, insn):
+        span = self.span
+        if isinstance(value, str):
+            value = int(value, 0)
+        insn[span] = value
+
     def disassemble(self, insn,
             verbosity=Verbosity.NORMAL, indent=""):
         span = self.span
@@ -1404,7 +1410,7 @@ class CR5Operand(ConditionRegisterFieldOperand):
 
 
 @_dataclasses.dataclass(eq=True, frozen=True)
-class EXTSOperand(DynamicOperand):
+class EXTSOperand(SignedOperand):
     field: str # real name to report
     nz: int = 0 # number of zeros
     fmt: str = "d" # integer formatter