power_insn: consider EXTS operand as signed
authorDmitry Selyutin <ghostmansd@gmail.com>
Mon, 12 Dec 2022 21:55:32 +0000 (00:55 +0300)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 2 Jun 2023 18:51:16 +0000 (19:51 +0100)
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