From 41ab6e1e353acb509e9c8b3f4feb462815d620e6 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 4 Sep 2022 11:08:19 +0100 Subject: [PATCH] code-cleanup (comments) and rename "i" to "XO" --- src/openpower/decoder/power_table.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/openpower/decoder/power_table.py b/src/openpower/decoder/power_table.py index 59ed3397..c1fa52a6 100644 --- a/src/openpower/decoder/power_table.py +++ b/src/openpower/decoder/power_table.py @@ -56,26 +56,30 @@ def do_table(fname, insns, section, divpoint): opcode_per_insn[insn.name] = [] opcode_per_insn[insn.name] += opcodes + # along the way work out the maximum length of the instruction name + # that goes into the table. maxnamelen = 0 - for i in range(1<>half) & uppermask - print (i, bin(lower), bin(upper)) - if upper not in table_entries: + lower = XO & lowermask + upper = (XO>>half) & uppermask + print ("search", XO, bin(XO), bin(lower), bin(upper)) + if upper not in table_entries: # really should use defaultdict here table_entries[upper] = {} table_entries[upper][lower] = None - # create an XO - key = i - print ("search", i, hex(key)) - # start hunting + # hunt through all instructions, check XO against value/mask for insn in insns: opcode = opcode_per_insn[insn.name] for op in opcode: - #print (" search", i, hex(key), insn.name, + #print (" search", XO, hex(key), insn.name, # hex(op.value), hex(op.mask)) - if ((op.value & op.mask) == (key & op.mask)): - print (" match", i, hex(key), insn.name) + if ((op.value & op.mask) == (XO & op.mask)): + print (" match", bin(XO), insn.name) assert table_entries[upper][lower] is None, \ "entry %d %d should be empty " \ "contains %s conflicting %s" % \ -- 2.30.2