pysvp64asm: allow insndb-based assembly
authorDmitry Selyutin <ghostmansd@gmail.com>
Sun, 13 Nov 2022 21:07:01 +0000 (00:07 +0300)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 2 Jun 2023 18:51:16 +0000 (19:51 +0100)
src/openpower/sv/trans/svp64.py

index d93d988f8a5eeebce64361e37334e08cb554585c..2a17ec3d0bc46a796ada7c33dd1e5600d8920dd8 100644 (file)
@@ -293,6 +293,25 @@ class SVP64Asm:
         else:
             v30b_op = v30b_op_orig
 
+        record = None
+        if os.environ.get("INSNDB"):
+            record = DB[v30b_op]
+        if record is not None:
+            insn = SVP64Instruction.assemble(db=DB,
+                opcode=v30b_op_orig,
+                arguments=fields,
+                specifiers=opmodes)
+            prefix = int(insn.prefix)
+            suffix = int(insn.suffix)
+            yield " ".join((
+                f".long 0x{prefix:08X};",
+                f".long 0x{suffix:08X};",
+                "#",
+                opcode,
+                ",".join(fields),
+            ))
+            return
+
         # look up the 32-bit op (original, with "." if it has it)
         if v30b_op_orig in isa.instr:
             isa_instr = isa.instr[v30b_op_orig]