power_insn: support GPR operands
authorDmitry Selyutin <ghostmansd@gmail.com>
Sun, 6 Nov 2022 09:29:55 +0000 (12:29 +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 9d77cbdbefd8d2e53c515d0e5b409fbcec3b35fe..933741b8ea20b30f7f9d26a20e473109cd511ed9 100644 (file)
@@ -742,6 +742,14 @@ class RegisterOperand(DynamicOperand):
 
 
 class GPROperand(RegisterOperand):
+    def assemble(self, value, insn, record):
+        if isinstance(value, str):
+            value = value.lower()
+            if value.startswith("r"):
+                value = value[1:]
+            value = int(value, 0)
+        return super().assemble(value=value, insn=insn, record=record)
+
     def disassemble(self, insn, record,
             verbosity=Verbosity.NORMAL, indent=""):
         prefix = "" if (verbosity <= Verbosity.SHORT) else "r"