pysvp64asm: allow insndb-based assembly
authorDmitry Selyutin <ghostmansd@gmail.com>
Sun, 13 Nov 2022 21:07:01 +0000 (00:07 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Sun, 15 Jan 2023 19:47:22 +0000 (22:47 +0300)
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]