configs: Updates for python3
Change-Id: Iab2f83716ea2cb19f06282f037314f2db843327a Signed-off-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/29047 Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
This commit is contained in:
committed by
Jason Lowe-Power
parent
23515fa723
commit
e2a510acef
@@ -41,12 +41,17 @@
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
import six
|
||||
|
||||
import m5
|
||||
from m5.objects import *
|
||||
from m5.util import *
|
||||
from common.Benchmarks import *
|
||||
from common import ObjectList
|
||||
|
||||
if six.PY3:
|
||||
long = int
|
||||
|
||||
# Populate to reflect supported os types per target ISA
|
||||
os_types = { 'mips' : [ 'linux' ],
|
||||
'riscv' : [ 'linux' ], # TODO that's a lie
|
||||
@@ -574,7 +579,7 @@ def makeLinuxX86System(mem_mode, numCPUs=1, mdesc=None, Ruby=False,
|
||||
|
||||
# We assume below that there's at least 1MB of memory. We'll require 2
|
||||
# just to avoid corner cases.
|
||||
phys_mem_size = sum(map(lambda r: r.size(), self.mem_ranges))
|
||||
phys_mem_size = sum([r.size() for r in self.mem_ranges])
|
||||
assert(phys_mem_size >= 0x200000)
|
||||
assert(len(self.mem_ranges) <= 2)
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ def config_filesystem(system, options = None):
|
||||
file_append((procdir, 'cpuinfo'), one_cpu)
|
||||
|
||||
file_append((procdir, 'stat'), 'cpu 0 0 0 0 0 0 0\n')
|
||||
for i in xrange(len(cpus)):
|
||||
for i in range(len(cpus)):
|
||||
file_append((procdir, 'stat'), 'cpu%d 0 0 0 0 0 0 0\n' % i)
|
||||
|
||||
# Set up /sys
|
||||
|
||||
@@ -432,7 +432,7 @@ def config_hmc_dev(opt, system, hmc_host):
|
||||
for i in range(numx*(opt.mem_chunk-1))]
|
||||
|
||||
# Buffer iterator
|
||||
it = iter(range(len(system.hmc_dev.buffers)))
|
||||
it = iter(list(range(len(system.hmc_dev.buffers))))
|
||||
|
||||
# necesarry to add system_port to one of the xbar
|
||||
system.system_port = system.hmc_dev.xbar[3].slave
|
||||
@@ -443,7 +443,7 @@ def config_hmc_dev(opt, system, hmc_host):
|
||||
# connect xbar to all other xbars except itself
|
||||
if i != j:
|
||||
# get the next index of buffer
|
||||
index = it.next()
|
||||
index = next(it)
|
||||
|
||||
# Change the default values for ranges of bridge
|
||||
system.hmc_dev.buffers[index].ranges = system.mem_ranges[
|
||||
|
||||
@@ -75,7 +75,7 @@ class ObjectList(object):
|
||||
print("Available {} classes:".format(self.base_cls))
|
||||
doc_wrapper = TextWrapper(initial_indent="\t\t",
|
||||
subsequent_indent="\t\t")
|
||||
for name, cls in self._sub_classes.items():
|
||||
for name, cls in list(self._sub_classes.items()):
|
||||
print("\t{}".format(name))
|
||||
|
||||
# Try to extract the class documentation from the class help
|
||||
@@ -87,7 +87,7 @@ class ObjectList(object):
|
||||
|
||||
if self._aliases:
|
||||
print("\Aliases:")
|
||||
for alias, target in self._aliases.items():
|
||||
for alias, target in list(self._aliases.items()):
|
||||
print("\t{} => {}".format(alias, target))
|
||||
|
||||
def get_names(self):
|
||||
@@ -156,7 +156,7 @@ class EnumList(ObjectList):
|
||||
def _add_objects(self):
|
||||
""" Add all enum values to the ObjectList """
|
||||
self._sub_classes = {}
|
||||
for (key, value) in self.base_cls.__members__.items():
|
||||
for (key, value) in list(self.base_cls.__members__.items()):
|
||||
# All Enums have a value Num_NAME at the end which we
|
||||
# do not want to include
|
||||
if not key.startswith("Num_"):
|
||||
|
||||
@@ -110,7 +110,7 @@ def addNoISAOptions(parser):
|
||||
help="Specify the physical memory size (single memory)")
|
||||
parser.add_option("--enable-dram-powerdown", action="store_true",
|
||||
help="Enable low-power states in DRAMCtrl")
|
||||
parser.add_option("--mem-channels-intlv", type="int",
|
||||
parser.add_option("--mem-channels-intlv", type="int", default=0,
|
||||
help="Memory channels interleave")
|
||||
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
import six
|
||||
import sys
|
||||
from os import getcwd
|
||||
from os.path import join as joinpath
|
||||
@@ -52,6 +53,9 @@ from m5.defines import buildEnv
|
||||
from m5.objects import *
|
||||
from m5.util import *
|
||||
|
||||
if six.PY3:
|
||||
long = int
|
||||
|
||||
addToPath('../common')
|
||||
|
||||
def getCPUClass(cpu_type):
|
||||
|
||||
@@ -55,10 +55,10 @@ class PathSearchFunc(object):
|
||||
paths = [ '/dist/m5/system', '/n/poolfs/z/dist/m5/system' ]
|
||||
|
||||
# expand '~' and '~user' in paths
|
||||
paths = map(os.path.expanduser, paths)
|
||||
paths = list(map(os.path.expanduser, paths))
|
||||
|
||||
# filter out non-existent directories
|
||||
paths = filter(os.path.isdir, paths)
|
||||
paths = list(filter(os.path.isdir, paths))
|
||||
|
||||
if not paths:
|
||||
raise IOError(
|
||||
|
||||
Reference in New Issue
Block a user