From 659900aedd1b4fc69b61b5dbaee39dba26848637 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 5 Mar 2018 22:51:34 -0800 Subject: config: Switch from the print statement to the print function. Change-Id: I701fa58cfcfa2767ce9ad24da314a053889878d0 Reviewed-on: https://gem5-review.googlesource.com/8762 Reviewed-by: Andreas Sandberg Reviewed-by: Jason Lowe-Power Reviewed-by: Anthony Gutierrez Maintainer: Gabe Black --- configs/dram/lat_mem_rd.py | 20 +++++++++++--------- configs/dram/low_power_sweep.py | 22 ++++++++++++---------- configs/dram/sweep.py | 8 +++++--- 3 files changed, 28 insertions(+), 22 deletions(-) (limited to 'configs/dram') diff --git a/configs/dram/lat_mem_rd.py b/configs/dram/lat_mem_rd.py index dc0cfcbb8..dc80bd287 100644 --- a/configs/dram/lat_mem_rd.py +++ b/configs/dram/lat_mem_rd.py @@ -35,6 +35,8 @@ # # Authors: Andreas Hansson +from __future__ import print_function + import gzip import optparse import os @@ -60,22 +62,22 @@ import protolib try: import packet_pb2 except: - print "Did not find packet proto definitions, attempting to generate" + print("Did not find packet proto definitions, attempting to generate") from subprocess import call error = call(['protoc', '--python_out=configs/dram', '--proto_path=src/proto', 'src/proto/packet.proto']) if not error: - print "Generated packet proto definitions" + print("Generated packet proto definitions") try: import google.protobuf except: - print "Please install the Python protobuf module" + print("Please install the Python protobuf module") exit(-1) import packet_pb2 else: - print "Failed to import packet proto definitions" + print("Failed to import packet proto definitions") exit(-1) parser = optparse.OptionParser() @@ -92,7 +94,7 @@ parser.add_option("--reuse-trace", action="store_true", (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 creating the system itself, using a multi-layer 2.0 GHz @@ -171,7 +173,7 @@ def create_trace(filename, max_addr, burst_size, itt): try: proto_out = gzip.open(filename, 'wb') except IOError: - print "Failed to open ", filename, " for writing" + print("Failed to open ", filename, " for writing") exit(-1) # write the magic number in 4-byte Little Endian, similar to what @@ -208,7 +210,7 @@ def create_trace(filename, max_addr, burst_size, itt): proto_out.close() # this will take a while, so keep the user informed -print "Generating traces, please wait..." +print("Generating traces, please wait...") nxt_range = 0 nxt_state = 0 @@ -304,6 +306,6 @@ m5.instantiate() m5.simulate(nxt_state * period) # print all we need to make sense of the stats output -print "lat_mem_rd with %d iterations, ranges:" % iterations +print("lat_mem_rd with %d iterations, ranges:" % iterations) for r in ranges: - print r + print(r) diff --git a/configs/dram/low_power_sweep.py b/configs/dram/low_power_sweep.py index 9adfcaff0..2aa64906f 100644 --- a/configs/dram/low_power_sweep.py +++ b/configs/dram/low_power_sweep.py @@ -36,6 +36,8 @@ # Authors: Radhika Jagtap # Andreas Hansson +from __future__ import print_function + import argparse import m5 @@ -239,13 +241,13 @@ m5.instantiate() # Simulate for exactly as long as it takes to go through all the states # This is why sim exists. m5.simulate(nxt_state * period + idle_period) -print "--- Done DRAM low power sweep ---" -print "Fixed params - " -print "\tburst: %d, banks: %d, max stride: %d, itt min: %s ns" % \ - (burst_size, nbr_banks, max_stride, itt_min) -print "Swept params - " -print "\titt max multiples input:", itt_max_multiples -print "\titt max values", itt_max_values -print "\tbank utilization values", bank_util_values -print "\tstride values:", stride_values -print "Traffic gen config file:", cfg_file_name +print("--- Done DRAM low power sweep ---") +print("Fixed params - ") +print("\tburst: %d, banks: %d, max stride: %d, itt min: %s ns" % \ + (burst_size, nbr_banks, max_stride, itt_min)) +print("Swept params - ") +print("\titt max multiples input:", itt_max_multiples) +print("\titt max values", itt_max_values) +print("\tbank utilization values", bank_util_values) +print("\tstride values:", stride_values) +print("Traffic gen config file:", cfg_file_name) diff --git a/configs/dram/sweep.py b/configs/dram/sweep.py index 32cf00345..8380f74e3 100644 --- a/configs/dram/sweep.py +++ b/configs/dram/sweep.py @@ -35,6 +35,8 @@ # # Authors: Andreas Hansson +from __future__ import print_function + import optparse import m5 @@ -75,7 +77,7 @@ parser.add_option("--addr_map", type="int", default=1, (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) # at the moment we stay with the default open-adaptive page policy, @@ -204,5 +206,5 @@ root.system.mem_mode = 'timing' m5.instantiate() m5.simulate(nxt_state * period) -print "DRAM sweep with burst: %d, banks: %d, max stride: %d" % \ - (burst_size, nbr_banks, max_stride) +print("DRAM sweep with burst: %d, banks: %d, max stride: %d" % + (burst_size, nbr_banks, max_stride)) -- cgit v1.2.3