Commit a364d7bc authored by Alan Marchiori's avatar Alan Marchiori

now supports 5stage output

parent 735485dd
......@@ -109,6 +109,7 @@ type_lut = {
'slti': 'arth',
'slt': 'arth',
'snez': 'arth',
'-': 'nop', # nop and such
}
def profile(f, itypes = type_lut):
......@@ -119,21 +120,27 @@ def profile(f, itypes = type_lut):
results = {k:0 for k in set(itypes.values())}
i = 0
with open(f, 'r') as of:
i += 1
for line in of:
if line.startswith('Cyc'):
#someone change this to a regex.
instruction = line[124:-1] #strip newline
op = instruction.split(" ")[0]
if 'PC=' in line:
instruction = line[124:].strip()
elif 'ExeInst' in line:
instruction = line[113:].strip()
else:
raise("Unsuppoted out file.")
op = instruction.split()[0]
if op not in itypes:
print("Insturction on line {}: {}, is not supported.".format(
print("Insturction on line {}: '{}', is not supported.".format(
i, op
))
print(line.strip())
exit(-5)
results[itypes[op]] += 1
return results
......@@ -142,7 +149,7 @@ if __name__== "__main__":
parser.add_argument('outfile', default = None, nargs='*',
help='the .out file to process.')
args = parser.parse_args()
if args.outfile == []:
parser.print_usage()
exit(-1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment