configs: Fix Python 3 iterator and exec compatibility issues
Python 2.7 used to return lists for operations such as map and range, this has changed in Python 3. To make the configs Python 3 compliant, add explicit conversions from iterators to lists where needed, replace xrange with range, and fix changes to exec syntax. This change doesn't fix import paths since that might require us to restructure the configs slightly. Change-Id: Idcea8482b286779fc98b4e144ca8f54069c08024 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/16002 Reviewed-by: Gabe Black <gabeblack@google.com>
This commit is contained in:
@@ -453,18 +453,18 @@ def run(options, root, testsys, cpu_class):
|
||||
switch_cpus = None
|
||||
|
||||
if options.prog_interval:
|
||||
for i in xrange(np):
|
||||
for i in range(np):
|
||||
testsys.cpu[i].progress_interval = options.prog_interval
|
||||
|
||||
if options.maxinsts:
|
||||
for i in xrange(np):
|
||||
for i in range(np):
|
||||
testsys.cpu[i].max_insts_any_thread = options.maxinsts
|
||||
|
||||
if cpu_class:
|
||||
switch_cpus = [cpu_class(switched_out=True, cpu_id=(i))
|
||||
for i in xrange(np)]
|
||||
for i in range(np)]
|
||||
|
||||
for i in xrange(np):
|
||||
for i in range(np):
|
||||
if options.fast_forward:
|
||||
testsys.cpu[i].max_insts_any_thread = int(options.fast_forward)
|
||||
switch_cpus[i].system = testsys
|
||||
@@ -489,7 +489,7 @@ def run(options, root, testsys, cpu_class):
|
||||
CpuConfig.config_etrace(cpu_class, switch_cpus, options)
|
||||
|
||||
testsys.switch_cpus = switch_cpus
|
||||
switch_cpu_list = [(testsys.cpu[i], switch_cpus[i]) for i in xrange(np)]
|
||||
switch_cpu_list = [(testsys.cpu[i], switch_cpus[i]) for i in range(np)]
|
||||
|
||||
if options.repeat_switch:
|
||||
switch_class = getCPUClass(options.cpu_type)[0]
|
||||
@@ -502,9 +502,9 @@ def run(options, root, testsys, cpu_class):
|
||||
sys.exit(1)
|
||||
|
||||
repeat_switch_cpus = [switch_class(switched_out=True, \
|
||||
cpu_id=(i)) for i in xrange(np)]
|
||||
cpu_id=(i)) for i in range(np)]
|
||||
|
||||
for i in xrange(np):
|
||||
for i in range(np):
|
||||
repeat_switch_cpus[i].system = testsys
|
||||
repeat_switch_cpus[i].workload = testsys.cpu[i].workload
|
||||
repeat_switch_cpus[i].clk_domain = testsys.cpu[i].clk_domain
|
||||
@@ -520,18 +520,18 @@ def run(options, root, testsys, cpu_class):
|
||||
|
||||
if cpu_class:
|
||||
repeat_switch_cpu_list = [(switch_cpus[i], repeat_switch_cpus[i])
|
||||
for i in xrange(np)]
|
||||
for i in range(np)]
|
||||
else:
|
||||
repeat_switch_cpu_list = [(testsys.cpu[i], repeat_switch_cpus[i])
|
||||
for i in xrange(np)]
|
||||
for i in range(np)]
|
||||
|
||||
if options.standard_switch:
|
||||
switch_cpus = [TimingSimpleCPU(switched_out=True, cpu_id=(i))
|
||||
for i in xrange(np)]
|
||||
for i in range(np)]
|
||||
switch_cpus_1 = [DerivO3CPU(switched_out=True, cpu_id=(i))
|
||||
for i in xrange(np)]
|
||||
for i in range(np)]
|
||||
|
||||
for i in xrange(np):
|
||||
for i in range(np):
|
||||
switch_cpus[i].system = testsys
|
||||
switch_cpus_1[i].system = testsys
|
||||
switch_cpus[i].workload = testsys.cpu[i].workload
|
||||
@@ -572,8 +572,12 @@ def run(options, root, testsys, cpu_class):
|
||||
|
||||
testsys.switch_cpus = switch_cpus
|
||||
testsys.switch_cpus_1 = switch_cpus_1
|
||||
switch_cpu_list = [(testsys.cpu[i], switch_cpus[i]) for i in xrange(np)]
|
||||
switch_cpu_list1 = [(switch_cpus[i], switch_cpus_1[i]) for i in xrange(np)]
|
||||
switch_cpu_list = [
|
||||
(testsys.cpu[i], switch_cpus[i]) for i in range(np)
|
||||
]
|
||||
switch_cpu_list1 = [
|
||||
(switch_cpus[i], switch_cpus_1[i]) for i in range(np)
|
||||
]
|
||||
|
||||
# set the checkpoint in the cpu before m5.instantiate is called
|
||||
if options.take_checkpoints != None and \
|
||||
@@ -581,7 +585,7 @@ def run(options, root, testsys, cpu_class):
|
||||
offset = int(options.take_checkpoints)
|
||||
# Set an instruction break point
|
||||
if options.simpoint:
|
||||
for i in xrange(np):
|
||||
for i in range(np):
|
||||
if testsys.cpu[i].workload[0].simpoint == 0:
|
||||
fatal('no simpoint for testsys.cpu[%d].workload[0]', i)
|
||||
checkpoint_inst = int(testsys.cpu[i].workload[0].simpoint) + offset
|
||||
@@ -592,7 +596,7 @@ def run(options, root, testsys, cpu_class):
|
||||
options.take_checkpoints = offset
|
||||
# Set all test cpus with the right number of instructions
|
||||
# for the upcoming simulation
|
||||
for i in xrange(np):
|
||||
for i in range(np):
|
||||
testsys.cpu[i].max_insts_any_thread = offset
|
||||
|
||||
if options.take_simpoint_checkpoints != None:
|
||||
|
||||
Reference in New Issue
Block a user