def __init__(self, file): log = {} guess_mode = "M" for line in file: m = self.trace_if.match(line) if m: id = int(m.group(1)) log[id] = AttrDict({ "pc": int(m.group(3), 16), "insn": m.group(4), "mode": guess_mode, "IF": int(int(m.group(2)) / self.scale), "DE": None, "RN": None, "IS": None, "C": None, "RE": None }) continue m = self.trace_de.match(line) if m: id = int(m.group(1)) log[id].DE = int(int(m.group(2)) / self.scale) m = self.trace_rn.match(line) if m: id = int(m.group(1)) log[id].RN = int(int(m.group(2)) / self.scale) m = self.trace_is.match(line) if m: id = int(m.group(1)) log[id].IS = int(int(m.group(2)) / self.scale) m = self.trace_c.match(line) if m: id = int(m.group(1)) log[id].C = int(int(m.group(2)) / self.scale) m = self.trace_re.match(line) if m: id = int(m.group(1)) log[id].RE = int(int(m.group(2)) / self.scale) log[id].mode = self.modemap[int(m.group(3))] guess_mode = self.modemap[int(m.group(3))] self.log = log
def __init__(self, file): log = {} for line in file: m = self.trace_if.match(line) if m: id = int(m.group(2)) log[id] = AttrDict({ "pc": int(m.group(4), 16), "insn": None, "mode": m.group(3), "IF": int(m.group(1)), "DE": None, "IS": None, "EX": None, "C": None, "BHT": None, "BP": None }) continue m = self.trace_de.match(line) if m: id = int(m.group(2)) pc = int(m.group(3), 16) assert pc & ~3 == log[ id].pc, "{} pc = {:x} logpc = {:x}".format( id, pc, log[id].pc) log[id].pc = pc log[id].DE = int(m.group(1)) log[id].insn = m.group(4) continue m = self.trace_is.match(line) if m: id = int(m.group(2)) log[id].IS = int(m.group(1)) continue m = self.trace_ex.match(line) if m: id = int(m.group(2)) log[id].EX = int(m.group(1)) continue m = self.trace_c.match(line) if m: id = int(m.group(2)) log[id].C = int(m.group(1)) continue m = self.trace_bht.match(line) if m: id = int(m.group(2)) log[id].BHT = AttrDict(index=int(m.group(4)), taken=int(m.group(6)), oldcounter=int(m.group(7), 2), newcounter=int(m.group(8), 2)) continue m = self.trace_bp_static.match(line) if m: id = int(m.group(2)) log[id].BP = AttrDict(type="static", index=int(m.group(4)), taken=int(m.group(5))) continue m = self.trace_bp_dynamic.match(line) if m: id = int(m.group(2)) log[id].BP = AttrDict(type="dynamic", index=int(m.group(4)), taken=(int(m.group(5), 2) >= 2)) continue self.log = log