summaryrefslogtreecommitdiff
path: root/configs/example/memcheck.py
diff options
context:
space:
mode:
Diffstat (limited to 'configs/example/memcheck.py')
-rw-r--r--configs/example/memcheck.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/configs/example/memcheck.py b/configs/example/memcheck.py
index 0bbcd2f7c..c2eed1959 100644
--- a/configs/example/memcheck.py
+++ b/configs/example/memcheck.py
@@ -39,6 +39,8 @@
# Authors: Ron Dreslinski
# Andreas Hansson
+from __future__ import print_function
+
import optparse
import random
import sys
@@ -108,7 +110,7 @@ parser.add_option("--sys-clock", action="store", type="string",
(options, args) = parser.parse_args()
if args:
- print "Error: script doesn't take any positional arguments"
+ print("Error: script doesn't take any positional arguments")
sys.exit(1)
# Start by parsing the command line options and do some basic sanity
@@ -118,36 +120,36 @@ if options.random:
tree_depth = random.randint(1, 4)
cachespec = [random.randint(1, 3) for i in range(tree_depth)]
testerspec = [random.randint(1, 3) for i in range(tree_depth + 1)]
- print "Generated random tree -c", ':'.join(map(str, cachespec)), \
- "-t", ':'.join(map(str, testerspec))
+ print("Generated random tree -c", ':'.join(map(str, cachespec)),
+ "-t", ':'.join(map(str, testerspec)))
else:
try:
cachespec = [int(x) for x in options.caches.split(':')]
testerspec = [int(x) for x in options.testers.split(':')]
except:
- print "Error: Unable to parse caches or testers option"
+ print("Error: Unable to parse caches or testers option")
sys.exit(1)
if len(cachespec) < 1:
- print "Error: Must have at least one level of caches"
+ print("Error: Must have at least one level of caches")
sys.exit(1)
if len(cachespec) != len(testerspec) - 1:
- print "Error: Testers must have one element more than caches"
+ print("Error: Testers must have one element more than caches")
sys.exit(1)
if testerspec[-1] == 0:
- print "Error: Must have testers at the uppermost level"
+ print("Error: Must have testers at the uppermost level")
sys.exit(1)
for t in testerspec:
if t < 0:
- print "Error: Cannot have a negative number of testers"
+ print("Error: Cannot have a negative number of testers")
sys.exit(1)
for c in cachespec:
if c < 1:
- print "Error: Must have 1 or more caches at each level"
+ print("Error: Must have 1 or more caches at each level")
sys.exit(1)
# Determine the tester multiplier for each level as the string
@@ -155,7 +157,7 @@ else:
multiplier = [1]
for c in cachespec:
if c < 1:
- print "Error: Must have at least one cache per level"
+ print("Error: Must have at least one cache per level")
multiplier.append(multiplier[-1] * c)
numtesters = 0
@@ -275,7 +277,7 @@ def make_cache_level(ncaches, prototypes, level, next_cache):
cache.mem_side = xbar.slave
else:
if not next_cache:
- print "Error: No next-level cache at top level"
+ print("Error: No next-level cache at top level")
sys.exit(1)
if ntesters > 1:
@@ -315,4 +317,4 @@ m5.instantiate()
# Simulate until program terminates
exit_event = m5.simulate(options.maxtick)
-print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()
+print('Exiting @ tick', m5.curTick(), 'because', exit_event.getCause())