From: Dmitry Selyutin Date: Thu, 22 Jun 2023 20:22:38 +0000 (+0300) Subject: insndb/db: introduce section command X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a4c769af5254a45af9efc368f8b8feaf3234feef;p=openpower-isa.git insndb/db: introduce section command --- diff --git a/src/openpower/insndb/db.py b/src/openpower/insndb/db.py index 0de00b10..50fe9eba 100644 --- a/src/openpower/insndb/db.py +++ b/src/openpower/insndb/db.py @@ -14,6 +14,7 @@ from openpower.insndb.core import ( PCode, Operands, Record, + Section, SVP64Record, Walker, ) @@ -139,6 +140,44 @@ class PTypeVisitor(SVP64InstructionVisitor): yield node +class SectionVisitor(InstructionVisitor): + @mdis.dispatcher.Hook(Section.Path) + @contextlib.contextmanager + def dispatch_path(self, node): + print("path", node) + yield node + + @mdis.dispatcher.Hook(Section.BitSel) + @contextlib.contextmanager + def dispatch_bitsel(self, node): + print("bitsel", node) + yield node + + @mdis.dispatcher.Hook(Section.Suffix) + @contextlib.contextmanager + def dispatch_suffix(self, node): + print("suffix", node) + yield node + + @mdis.dispatcher.Hook(Section.Mode) + @contextlib.contextmanager + def dispatch_mode(self, node): + print("mode", node) + yield node + + @mdis.dispatcher.Hook(Section.Opcode) + @contextlib.contextmanager + def dispatch_opcode(self, node): + print("opcode", int(node)) + yield node + + @mdis.dispatcher.Hook(Section.Priority) + @contextlib.contextmanager + def dispatch_priority(self, node): + print("priority", node) + yield node + + class ExtrasVisitor(SVP64InstructionVisitor, SelectorsVisitor): @mdis.dispatcher.Hook(SVP64Record.ExtraMap) @contextlib.contextmanager @@ -195,6 +234,10 @@ def main(): PTypeVisitor, "print instruction ptype", ), + "section": ( + SectionVisitor, + "print instruction section", + ), "extras": ( ExtrasVisitor, "print instruction extras (SVP64)",