Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert toaxe.py to Python3 #3034

Merged
merged 1 commit into from
Aug 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions scripts/toaxe.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# This file was originally written by Matthew Naylor, University of
# Cambridge.
#
# This software was partly developed by the University of Cambridge
# Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
#
# This software was partly developed by the University of Cambridge
# Computer Laboratory under DARPA/AFRL contract FA8750-11-C-0249
# ("MRC2"), as part of the DARPA MRC research programme.
#
#
# This software was partly developed by the University of Cambridge
# Computer Laboratory as part of the Rigorous Engineering of
# Mainstream Systems (REMS) project, funded by EPSRC grant
# EP/K008528/1.
# EP/K008528/1.

# -------
# Outline
Expand All @@ -27,7 +27,6 @@

import sys
import re
import sets

def main():

Expand Down Expand Up @@ -82,7 +81,7 @@ def error(msg):
m = re.search(' *([0-9]+) *: *([^ ]*) (.*)', line)
if m == None: error("Expected: <thread-id> ':' <command>")
tid, cmd, line = m.group(1), m.group(2), m.group(3)

if cmd == 'fence-req':
# Parse time
m = re.search(' *@ *([0-9]+)', line)
Expand Down Expand Up @@ -135,7 +134,7 @@ def error(msg):
# Find corresponding response
tag = m.group(2)
if not ((tid, tag) in tagMap) or tagMap[(tid, tag)] == None:
error("resp without associated req with tag " + tag +
error("resp without associated req with tag " + tag +
" on thread " + tid)
opId = tagMap[(tid, tag)]
(c, val, addr, start, lr) = ops[opId]
Expand Down Expand Up @@ -176,7 +175,7 @@ def error(msg):
ops[opId] = (op,)
else:
error("Unknown command '" + cmd + "'")

lineCount = lineCount+1

# Print statistics
Expand All @@ -185,7 +184,7 @@ def error(msg):
print("# LRSC_Success_Rate=" + scSuccessRate)
if statsFile != None:
statsFile.write("LRSC_Success_Rate=" + scSuccessRate + "\n")

if (loadCount > 0):
loadExtRate = str(loadExtCount/float(loadCount))[0:6]
print("# Load_External_Rate=" + loadExtRate)
Expand All @@ -197,12 +196,12 @@ def error(msg):

# Print address map in comments
for addr in addrMap:
print ("# &M[" + str(addrMap[addr]) + "] == " + addr)
print("# &M[" + str(addrMap[addr]) + "] == " + addr)

# Print axe trace
for op in ops:
if op != None and isinstance(op, tuple) and len(op) == 1:
print op[0]
print(op[0])

try:
main()
Expand Down