From 0b9e456fb2b9fda4a5cdd4cf0f1f6a7ab60208ea Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 3 Sep 2022 18:00:54 +0100 Subject: [PATCH] correct table-matching --- src/openpower/decoder/power_table.py | 34 ++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/src/openpower/decoder/power_table.py b/src/openpower/decoder/power_table.py index 286cb8e3..03feb165 100644 --- a/src/openpower/decoder/power_table.py +++ b/src/openpower/decoder/power_table.py @@ -3,7 +3,8 @@ from openpower.decoder.power_enums import find_wiki_dir from openpower.decoder.power_insn import (Database, MarkdownDatabase, FieldsDatabase, PPCDatabase, IntegerOpcode, PatternOpcode, - parse, Section) + parse, Section, BitSel, + FieldsOpcode) root = find_wiki_dir() root = pathlib.Path(root) mdwndb = MarkdownDatabase() @@ -26,7 +27,10 @@ for insn in db: insns[str(insn.section.path)].append(insn) print (insn) -def do_table(insns, section): +# create one table +def do_table(fname, insns, section): + insns = insns[fname] + section = sections[fname] start, end = section.bitsel.start, section.bitsel.end print ("start-end", start, end) bitlen = end-start+1 @@ -35,12 +39,16 @@ def do_table(insns, section): uppermask = (1<<(bitlen-half))-1 table_entries = {} # debug-print all opcodes first + opcode_per_insn = {} for insn in insns: - opcode = insn.section.opcode + fields = [] + fields += [(insn.ppc.opcode.value, insn.section.bitsel)] + opcode = FieldsOpcode(fields) if not isinstance(opcode, list): opcode = [opcode] for op in opcode: print ("op", insn.name, op) + opcode_per_insn[insn.name] = opcode for i in range(1<