From 78e12719cf234ef0bd7882ecb99bd0c16b795764 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Sun, 4 Sep 2022 15:33:23 +0300 Subject: [PATCH] power_table: replace prints with logging --- src/openpower/decoder/power_table.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/openpower/decoder/power_table.py b/src/openpower/decoder/power_table.py index 59fc8996..985c6e52 100644 --- a/src/openpower/decoder/power_table.py +++ b/src/openpower/decoder/power_table.py @@ -1,6 +1,7 @@ import collections from openpower.decoder.power_enums import find_wiki_dir from openpower.decoder.power_insn import Database +from openpower.util import log sections = {} insns = collections.defaultdict(list) @@ -23,7 +24,7 @@ def do_table(fname, insns, section, divpoint): insns = insns[fname] section = sections[fname] start, end = section.bitsel.start, section.bitsel.end - print ("start-end", start, end) + log("start-end", start, end) bitlen = end-start+1 half = divpoint lowermask = (1<>half) & uppermask - print ("search", XO, bin(XO), bin(lower), bin(upper)) + log("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 @@ -61,10 +62,10 @@ def do_table(fname, insns, section, divpoint): for insn in insns: opcode = opcode_per_insn[insn.name] for op in opcode: - #print (" search", XO, hex(key), insn.name, + #log(" search", XO, hex(key), insn.name, # hex(op.value), hex(op.mask)) if ((op.value & op.mask) == (XO & op.mask)): - print (" match", bin(XO), insn.name) + log(" match", bin(XO), insn.name) assert table_entries[upper][lower] is None, \ "entry %d %d (XO %s) should be empty " \ "contains %s conflicting %s" % \ @@ -75,7 +76,7 @@ def do_table(fname, insns, section, divpoint): maxnamelen = max(maxnamelen, len(insn.name)) continue - print (table_entries) + log(table_entries) # now got the table: print it out # create the markdown header. first line: | |00|01|10|11| | @@ -99,8 +100,7 @@ def do_table(fname, insns, section, divpoint): line.append(hdr) table.append("|" + "|".join(line) + "|") - print ("\n".join(table)) + print("\n".join(table)) do_table('minor_30.csv', insns, sections, divpoint=2) #do_table('minor_22.csv', insns, sections, divpoint=5) - -- 2.30.2