insndb/db: introduce ptype command
authorDmitry Selyutin <ghostmansd@gmail.com>
Thu, 22 Jun 2023 18:57:48 +0000 (21:57 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Fri, 23 Jun 2023 07:40:44 +0000 (10:40 +0300)
src/openpower/insndb/db.py

index 4d3b91da82ebbb25065e4f455f6fd2c2460a27ca..e64fdc1ee7a9bba4d7ff9198a1520762ac75d396 100644 (file)
@@ -18,6 +18,7 @@ from openpower.insndb.core import (
     Walker,
 )
 from openpower.decoder.power_enums import (
+    SVPType,
     SVExtra,
     In1Sel,
     In2Sel,
@@ -121,6 +122,14 @@ class SelectorsVisitor(InstructionVisitor):
         yield node
 
 
+class PTypeVisitor(SVP64InstructionVisitor):
+    @mdis.dispatcher.Hook(SVPType)
+    @contextlib.contextmanager
+    def dispatch_ptype(self, node):
+        print(node)
+        yield node
+
+
 class ExtrasVisitor(SVP64InstructionVisitor, SelectorsVisitor):
     @mdis.dispatcher.Hook(SVP64Record.ExtraMap)
     @contextlib.contextmanager
@@ -169,6 +178,10 @@ def main():
             SelectorsVisitor,
             "print instruction selectors",
         ),
+        "ptype": (
+            PTypeVisitor,
+            "print instruction ptype",
+        ),
         "extras": (
             ExtrasVisitor,
             "print instruction extras (SVP64)",