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:
@@ -115,7 +115,7 @@ def construct(options, system, ruby_system):
|
||||
cpu_sequencers = []
|
||||
cpuCluster = None
|
||||
cpuCluster = Cluster(name="CPU Cluster", extBW = 8, intBW=8) # 16 GB/s
|
||||
for i in xrange((options.num_cpus + 1) / 2):
|
||||
for i in range((options.num_cpus + 1) // 2):
|
||||
|
||||
cp_cntrl = CPCntrl()
|
||||
cp_cntrl.create(options, ruby_system, system)
|
||||
|
||||
@@ -470,7 +470,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
block_size_bits = int(math.log(options.cacheline_size, 2))
|
||||
numa_bit = block_size_bits + dir_bits - 1
|
||||
|
||||
for i in xrange(options.num_dirs):
|
||||
for i in range(options.num_dirs):
|
||||
dir_ranges = []
|
||||
for r in system.mem_ranges:
|
||||
addr_range = m5.objects.AddrRange(r.start, size = r.size(),
|
||||
@@ -511,7 +511,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
|
||||
# For an odd number of CPUs, still create the right number of controllers
|
||||
cpuCluster = Cluster(extBW = 512, intBW = 512) # 1 TB/s
|
||||
for i in xrange((options.num_cpus + 1) / 2):
|
||||
for i in range((options.num_cpus + 1) // 2):
|
||||
|
||||
cp_cntrl = CPCntrl()
|
||||
cp_cntrl.create(options, ruby_system, system)
|
||||
@@ -545,7 +545,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
|
||||
gpuCluster = Cluster(extBW = 512, intBW = 512) # 1 TB/s
|
||||
|
||||
for i in xrange(options.num_compute_units):
|
||||
for i in range(options.num_compute_units):
|
||||
|
||||
tcp_cntrl = TCPCntrl(TCC_select_num_bits = TCC_bits,
|
||||
number_of_TBEs = 2560) # max outstanding requests
|
||||
@@ -578,7 +578,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
|
||||
gpuCluster.add(tcp_cntrl)
|
||||
|
||||
for i in xrange(options.num_sqc):
|
||||
for i in range(options.num_sqc):
|
||||
|
||||
sqc_cntrl = SQCCntrl(TCC_select_num_bits = TCC_bits)
|
||||
sqc_cntrl.create(options, ruby_system, system)
|
||||
@@ -610,7 +610,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
# SQC also in GPU cluster
|
||||
gpuCluster.add(sqc_cntrl)
|
||||
|
||||
for i in xrange(options.num_cp):
|
||||
for i in range(options.num_cp):
|
||||
|
||||
tcp_cntrl = TCPCntrl(TCC_select_num_bits = TCC_bits,
|
||||
number_of_TBEs = 2560) # max outstanding requests
|
||||
@@ -673,7 +673,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
# SQC also in GPU cluster
|
||||
gpuCluster.add(sqc_cntrl)
|
||||
|
||||
for i in xrange(options.num_tccs):
|
||||
for i in range(options.num_tccs):
|
||||
|
||||
tcc_cntrl = TCCCntrl(TCC_select_num_bits = TCC_bits,
|
||||
number_of_TBEs = options.num_compute_units * 2560)
|
||||
|
||||
@@ -429,7 +429,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
mainCluster = Cluster(intBW=crossbar_bw)
|
||||
else:
|
||||
mainCluster = Cluster(intBW=8) # 16 GB/s
|
||||
for i in xrange(options.num_dirs):
|
||||
for i in range(options.num_dirs):
|
||||
|
||||
dir_cntrl = DirCntrl(noTCCdir = True, TCC_select_num_bits = TCC_bits)
|
||||
dir_cntrl.create(options, ruby_system, system)
|
||||
@@ -467,7 +467,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
cpuCluster = Cluster(extBW = crossbar_bw, intBW = crossbar_bw)
|
||||
else:
|
||||
cpuCluster = Cluster(extBW = 8, intBW = 8) # 16 GB/s
|
||||
for i in xrange((options.num_cpus + 1) / 2):
|
||||
for i in range((options.num_cpus + 1) // 2):
|
||||
|
||||
cp_cntrl = CPCntrl()
|
||||
cp_cntrl.create(options, ruby_system, system)
|
||||
@@ -504,7 +504,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
gpuCluster = Cluster(extBW = crossbar_bw, intBW = crossbar_bw)
|
||||
else:
|
||||
gpuCluster = Cluster(extBW = 8, intBW = 8) # 16 GB/s
|
||||
for i in xrange(options.num_compute_units):
|
||||
for i in range(options.num_compute_units):
|
||||
|
||||
tcp_cntrl = TCPCntrl(TCC_select_num_bits = TCC_bits,
|
||||
issue_latency = 1,
|
||||
@@ -543,7 +543,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
|
||||
gpuCluster.add(tcp_cntrl)
|
||||
|
||||
for i in xrange(options.num_sqc):
|
||||
for i in range(options.num_sqc):
|
||||
|
||||
sqc_cntrl = SQCCntrl(TCC_select_num_bits = TCC_bits)
|
||||
sqc_cntrl.create(options, ruby_system, system)
|
||||
@@ -569,7 +569,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
# SQC also in GPU cluster
|
||||
gpuCluster.add(sqc_cntrl)
|
||||
|
||||
for i in xrange(options.num_cp):
|
||||
for i in range(options.num_cp):
|
||||
|
||||
tcp_ID = options.num_compute_units + i
|
||||
sqc_ID = options.num_sqc + i
|
||||
@@ -623,7 +623,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
# SQC also in GPU cluster
|
||||
gpuCluster.add(sqc_cntrl)
|
||||
|
||||
for i in xrange(options.num_tccs):
|
||||
for i in range(options.num_tccs):
|
||||
|
||||
tcc_cntrl = TCCCntrl(l2_response_latency = options.TCC_latency)
|
||||
tcc_cntrl.create(options, ruby_system, system)
|
||||
|
||||
@@ -407,7 +407,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
# Clusters
|
||||
crossbar_bw = 16 * options.num_compute_units #Assuming a 2GHz clock
|
||||
mainCluster = Cluster(intBW = crossbar_bw)
|
||||
for i in xrange(options.num_dirs):
|
||||
for i in range(options.num_dirs):
|
||||
|
||||
dir_cntrl = DirCntrl(noTCCdir=True,TCC_select_num_bits = TCC_bits)
|
||||
dir_cntrl.create(options, ruby_system, system)
|
||||
@@ -440,7 +440,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
mainCluster.add(dir_cntrl)
|
||||
|
||||
cpuCluster = Cluster(extBW = crossbar_bw, intBW=crossbar_bw)
|
||||
for i in xrange((options.num_cpus + 1) / 2):
|
||||
for i in range((options.num_cpus + 1) // 2):
|
||||
|
||||
cp_cntrl = CPCntrl()
|
||||
cp_cntrl.create(options, ruby_system, system)
|
||||
@@ -473,7 +473,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
cpuCluster.add(cp_cntrl)
|
||||
|
||||
gpuCluster = Cluster(extBW = crossbar_bw, intBW = crossbar_bw)
|
||||
for i in xrange(options.num_compute_units):
|
||||
for i in range(options.num_compute_units):
|
||||
|
||||
tcp_cntrl = TCPCntrl(TCC_select_num_bits = TCC_bits,
|
||||
issue_latency = 1,
|
||||
@@ -510,7 +510,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
|
||||
gpuCluster.add(tcp_cntrl)
|
||||
|
||||
for i in xrange(options.num_sqc):
|
||||
for i in range(options.num_sqc):
|
||||
|
||||
sqc_cntrl = SQCCntrl(TCC_select_num_bits = TCC_bits)
|
||||
sqc_cntrl.create(options, ruby_system, system)
|
||||
@@ -539,7 +539,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
# Because of wire buffers, num_tccs must equal num_tccdirs
|
||||
numa_bit = 6
|
||||
|
||||
for i in xrange(options.num_tccs):
|
||||
for i in range(options.num_tccs):
|
||||
|
||||
tcc_cntrl = TCCCntrl()
|
||||
tcc_cntrl.create(options, ruby_system, system)
|
||||
|
||||
@@ -469,7 +469,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
# For an odd number of CPUs, still create the right number of controllers
|
||||
crossbar_bw = 16 * options.num_compute_units #Assuming a 2GHz clock
|
||||
cpuCluster = Cluster(extBW = (crossbar_bw), intBW=crossbar_bw)
|
||||
for i in xrange((options.num_cpus + 1) / 2):
|
||||
for i in range((options.num_cpus + 1) // 2):
|
||||
|
||||
cp_cntrl = CPCntrl()
|
||||
cp_cntrl.create(options, ruby_system, system)
|
||||
@@ -535,7 +535,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
cpuCluster.add(rb_cntrl)
|
||||
|
||||
gpuCluster = Cluster(extBW = (crossbar_bw), intBW = crossbar_bw)
|
||||
for i in xrange(options.num_compute_units):
|
||||
for i in range(options.num_compute_units):
|
||||
|
||||
tcp_cntrl = TCPCntrl(TCC_select_num_bits = TCC_bits,
|
||||
issue_latency = 1,
|
||||
@@ -571,7 +571,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
|
||||
gpuCluster.add(tcp_cntrl)
|
||||
|
||||
for i in xrange(options.num_sqc):
|
||||
for i in range(options.num_sqc):
|
||||
|
||||
sqc_cntrl = SQCCntrl(TCC_select_num_bits = TCC_bits)
|
||||
sqc_cntrl.create(options, ruby_system, system)
|
||||
@@ -599,7 +599,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
|
||||
numa_bit = 6
|
||||
|
||||
for i in xrange(options.num_tccs):
|
||||
for i in range(options.num_tccs):
|
||||
|
||||
tcc_cntrl = TCCCntrl()
|
||||
tcc_cntrl.create(options, ruby_system, system)
|
||||
|
||||
@@ -66,7 +66,7 @@ def create_system(options, full_system, system, dma_ports, bootmem,
|
||||
# controller constructors are called before the network constructor
|
||||
#
|
||||
|
||||
for i in xrange(options.num_cpus):
|
||||
for i in range(options.num_cpus):
|
||||
#
|
||||
# First create the Ruby objects associated with this cpu
|
||||
# Only one cache exists for this protocol, so by default use the L1D
|
||||
|
||||
@@ -83,8 +83,8 @@ def create_system(options, full_system, system, dma_ports, bootmem,
|
||||
# Must create the individual controllers before the network to ensure the
|
||||
# controller constructors are called before the network constructor
|
||||
#
|
||||
for i in xrange(options.num_clusters):
|
||||
for j in xrange(num_cpus_per_cluster):
|
||||
for i in range(options.num_clusters):
|
||||
for j in range(num_cpus_per_cluster):
|
||||
#
|
||||
# First create the Ruby objects associated with this cpu
|
||||
#
|
||||
@@ -164,7 +164,7 @@ def create_system(options, full_system, system, dma_ports, bootmem,
|
||||
l1_cntrl.responseFromL2.slave = ruby_system.network.master
|
||||
|
||||
|
||||
for j in xrange(num_l2caches_per_cluster):
|
||||
for j in range(num_l2caches_per_cluster):
|
||||
l2_cache = L2Cache(size = options.l2_size,
|
||||
assoc = options.l2_assoc,
|
||||
start_index_bit = l2_index_start)
|
||||
|
||||
@@ -67,7 +67,7 @@ def create_system(options, full_system, system, dma_ports, bootmem,
|
||||
l2_bits = int(math.log(options.num_l2caches, 2))
|
||||
block_size_bits = int(math.log(options.cacheline_size, 2))
|
||||
|
||||
for i in xrange(options.num_cpus):
|
||||
for i in range(options.num_cpus):
|
||||
#
|
||||
# First create the Ruby objects associated with this cpu
|
||||
#
|
||||
@@ -135,7 +135,7 @@ def create_system(options, full_system, system, dma_ports, bootmem,
|
||||
|
||||
l2_index_start = block_size_bits + l2_bits
|
||||
|
||||
for i in xrange(options.num_l2caches):
|
||||
for i in range(options.num_l2caches):
|
||||
#
|
||||
# First create the Ruby objects associated with this cpu
|
||||
#
|
||||
|
||||
@@ -64,7 +64,7 @@ def create_system(options, full_system, system, dma_ports, bootmem,
|
||||
#
|
||||
block_size_bits = int(math.log(options.cacheline_size, 2))
|
||||
|
||||
for i in xrange(options.num_cpus):
|
||||
for i in range(options.num_cpus):
|
||||
#
|
||||
# First create the Ruby objects associated with this cpu
|
||||
# Only one cache exists for this protocol, so by default use the L1D
|
||||
|
||||
@@ -248,7 +248,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
block_size_bits = int(math.log(options.cacheline_size, 2))
|
||||
numa_bit = block_size_bits + dir_bits - 1
|
||||
|
||||
for i in xrange(options.num_dirs):
|
||||
for i in range(options.num_dirs):
|
||||
dir_ranges = []
|
||||
for r in system.mem_ranges:
|
||||
addr_range = m5.objects.AddrRange(r.start, size = r.size(),
|
||||
@@ -294,7 +294,7 @@ def create_system(options, full_system, system, dma_devices, bootmem,
|
||||
|
||||
# For an odd number of CPUs, still create the right number of controllers
|
||||
cpuCluster = Cluster(extBW = 512, intBW = 512) # 1 TB/s
|
||||
for i in xrange((options.num_cpus + 1) / 2):
|
||||
for i in range((options.num_cpus + 1) // 2):
|
||||
|
||||
cp_cntrl = CPCntrl()
|
||||
cp_cntrl.create(options, ruby_system, system)
|
||||
|
||||
@@ -67,7 +67,7 @@ def create_system(options, full_system, system, dma_ports, bootmem,
|
||||
l2_bits = int(math.log(options.num_l2caches, 2))
|
||||
block_size_bits = int(math.log(options.cacheline_size, 2))
|
||||
|
||||
for i in xrange(options.num_cpus):
|
||||
for i in range(options.num_cpus):
|
||||
#
|
||||
# First create the Ruby objects associated with this cpu
|
||||
#
|
||||
@@ -126,7 +126,7 @@ def create_system(options, full_system, system, dma_ports, bootmem,
|
||||
|
||||
l2_index_start = block_size_bits + l2_bits
|
||||
|
||||
for i in xrange(options.num_l2caches):
|
||||
for i in range(options.num_l2caches):
|
||||
#
|
||||
# First create the Ruby objects associated with this cpu
|
||||
#
|
||||
|
||||
@@ -80,7 +80,7 @@ def create_system(options, full_system, system, dma_ports, bootmem,
|
||||
l2_bits = int(math.log(options.num_l2caches, 2))
|
||||
block_size_bits = int(math.log(options.cacheline_size, 2))
|
||||
|
||||
for i in xrange(options.num_cpus):
|
||||
for i in range(options.num_cpus):
|
||||
#
|
||||
# First create the Ruby objects associated with this cpu
|
||||
#
|
||||
@@ -149,7 +149,7 @@ def create_system(options, full_system, system, dma_ports, bootmem,
|
||||
|
||||
l2_index_start = block_size_bits + l2_bits
|
||||
|
||||
for i in xrange(options.num_l2caches):
|
||||
for i in range(options.num_l2caches):
|
||||
#
|
||||
# First create the Ruby objects associated with this cpu
|
||||
#
|
||||
|
||||
@@ -74,7 +74,7 @@ def create_system(options, full_system, system, dma_ports, bootmem,
|
||||
#
|
||||
block_size_bits = int(math.log(options.cacheline_size, 2))
|
||||
|
||||
for i in xrange(options.num_cpus):
|
||||
for i in range(options.num_cpus):
|
||||
#
|
||||
# First create the Ruby objects associated with this cpu
|
||||
#
|
||||
|
||||
@@ -214,7 +214,7 @@ def create_system(options, full_system, system, piobus = None, dma_ports = [],
|
||||
|
||||
def create_directories(options, bootmem, ruby_system, system):
|
||||
dir_cntrl_nodes = []
|
||||
for i in xrange(options.num_dirs):
|
||||
for i in range(options.num_dirs):
|
||||
dir_cntrl = Directory_Controller()
|
||||
dir_cntrl.version = i
|
||||
dir_cntrl.directory = RubyDirectoryMemory()
|
||||
|
||||
Reference in New Issue
Block a user