print("Info: Using Python config: %s" % (python_config, ))
py_includes = readCommand([python_config, '--includes'],
exception='').split()
- py_includes = filter(lambda s: match(r'.*\/include\/.*',s), py_includes)
+ py_includes = list(filter(
+ lambda s: match(r'.*\/include\/.*',s), py_includes))
# Strip the -I from the include folders before adding them to the
# CPPPATH
- py_includes = map(lambda s: s[2:] if s.startswith('-I') else s, py_includes)
+ py_includes = list(map(
+ lambda s: s[2:] if s.startswith('-I') else s, py_includes))
main.Append(CPPPATH=py_includes)
# Read the linker flags and split them into libraries and other link
EnumVariable('TARGET_ISA', 'Target ISA', 'alpha', all_isa_list),
EnumVariable('TARGET_GPU_ISA', 'Target GPU ISA', 'hsail', all_gpu_isa_list),
ListVariable('CPU_MODELS', 'CPU models',
- sorted(n for n,m in CpuModel.dict.iteritems() if m.default),
+ sorted(n for n,m in CpuModel.dict.items() if m.default),
sorted(CpuModel.dict.keys())),
BoolVariable('EFENCE', 'Link with Electric Fence malloc debugger',
False),
joinpath(opts_dir, default)]
else:
default_vars_files = [joinpath(opts_dir, variant_dir)]
- existing_files = filter(isfile, default_vars_files)
+ existing_files = list(filter(isfile, default_vars_files))
if existing_files:
default_vars_file = existing_files[0]
sticky_vars.files.append(default_vars_file)
def strip(f):
return strip_build_path(str(f), env)
if len(source) > 0:
- srcs = map(strip, source)
+ srcs = list(map(strip, source))
else:
srcs = ['']
- tgts = map(strip, target)
+ tgts = list(map(strip, target))
# surprisingly, os.path.commonprefix is a dumb char-by-char string
# operation that has nothing to do with paths.
com_pfx = os.path.commonprefix(srcs + tgts)
# recalculate length in case com_pfx was modified
com_pfx_len = len(com_pfx)
def fmt(files):
- f = map(lambda s: s[com_pfx_len:], files)
+ f = list(map(lambda s: s[com_pfx_len:], files))
return ', '.join(f)
return self.format % (com_pfx, fmt(srcs), fmt(tgts))
cpp_code(symbol_declaration + ' = {')
cpp_code.indent()
step = 16
- for i in xrange(0, len(data), step):
+ for i in six.moves.range(0, len(data), step):
x = array.array('B', data[i:i+step])
cpp_code(''.join('%d,' % d for d in x))
cpp_code.dedent()
code.write(str(target[0]))
-env.Command('config/the_isa.hh', map(Value, all_isa_list),
+env.Command('config/the_isa.hh', list(map(Value, all_isa_list)),
MakeAction(makeTheISA, Transform("CFG ISA", 0)))
def makeTheGPUISA(source, target, env):
code.write(str(target[0]))
-env.Command('config/the_gpu_isa.hh', map(Value, all_gpu_isa_list),
+env.Command('config/the_gpu_isa.hh', list(map(Value, all_gpu_isa_list)),
MakeAction(makeTheGPUISA, Transform("CFG ISA", 0)))
########################################################################
sim_objects = m5.SimObject.allClasses
all_enums = m5.params.allEnums
-for name,obj in sorted(sim_objects.iteritems()):
+for name,obj in sorted(sim_objects.items()):
for param in obj._params.local.values():
# load the ptype attribute now because it depends on the
# current version of SimObject.allClasses, but when scons
# Generate all of the SimObject param C++ struct header files
params_hh_files = []
-for name,simobj in sorted(sim_objects.iteritems()):
+for name,simobj in sorted(sim_objects.items()):
py_source = PySource.modules[simobj.__module__]
extra_deps = [ py_source.tnode ]
# C++ parameter description files
if GetOption('with_cxx_config'):
- for name,simobj in sorted(sim_objects.iteritems()):
+ for name,simobj in sorted(sim_objects.items()):
py_source = PySource.modules[simobj.__module__]
extra_deps = [ py_source.tnode ]
code = code_formatter()
- for name,simobj in sorted(sim_objects.iteritems()):
+ for name,simobj in sorted(sim_objects.items()):
if not hasattr(simobj, 'abstract') or not simobj.abstract:
code('#include "cxx_config/${name}.hh"')
code()
code('void cxxConfigInit()')
code('{')
code.indent()
- for name,simobj in sorted(sim_objects.iteritems()):
+ for name,simobj in sorted(sim_objects.items()):
not_abstract = not hasattr(simobj, 'abstract') or \
not simobj.abstract
if not_abstract and 'type' in simobj.__dict__:
env.Command(cxx_config_init_cc_file, Value(name),
MakeAction(createCxxConfigInitCC, Transform("CXXCINIT")))
cxx_param_hh_files = ["cxx_config/%s.hh" % simobj
- for name,simobj in sorted(sim_objects.iteritems())
+ for name,simobj in sorted(sim_objects.items())
if not hasattr(simobj, 'abstract') or not simobj.abstract]
Depends(cxx_config_init_cc_file, cxx_param_hh_files +
[File('sim/cxx_config.hh')])
Source(cxx_config_init_cc_file)
# Generate all enum header files
-for name,enum in sorted(all_enums.iteritems()):
+for name,enum in sorted(all_enums.items()):
py_source = PySource.modules[enum.__module__]
extra_deps = [ py_source.tnode ]
# Generate SimObject Python bindings wrapper files
if env['USE_PYTHON']:
- for name,simobj in sorted(sim_objects.iteritems()):
+ for name,simobj in sorted(sim_objects.items()):
py_source = PySource.modules[simobj.__module__]
extra_deps = [ py_source.tnode ]
cc_file = File('python/_m5/param_%s.cc' % name)
''')
- for name, flag in sorted(source[0].read().iteritems()):
+ for name, flag in sorted(source[0].read().items()):
n, compound, desc = flag
assert n == name
code.write(str(target[0]))
-for name,flag in sorted(debug_flags.iteritems()):
+for name,flag in sorted(debug_flags.items()):
n, compound, desc = flag
assert n == name
'%s-%s' % (tlc, config_name),
]
- static_lib_nodes = map(simgen_static, static_libs)
- shared_lib_nodes = map(simgen_shared, shared_libs)
+ static_lib_nodes = list(map(simgen_static, static_libs))
+ shared_lib_nodes = list(map(simgen_shared, shared_libs))
# We need to use the static libraries as files so that the linker
# doesn't use the shared versions of them instead. We need to use
# the shared libraries by name so that the linker will apply RPATH
decoder_output ='''
namespace Aarch64
{'''
- for decoderFlavor, type_dict in decoders.iteritems():
+ for decoderFlavor, type_dict in decoders.items():
decoder_output +='''
template StaticInstPtr decodeFpAdvSIMD<%(df)sDecoder>(ExtMachInst machInst);
''' % { "df" : decoderFlavor }
threeRegScrambleInstX("zip2", "Zip2QX", "SimdAluOp", unsignedTypes, 4,
zipCode % "eCount / 2")
- for decoderFlavor, type_dict in decoders.iteritems():
+ for decoderFlavor, type_dict in decoders.items():
header_output += '''
class %(decoder_flavor)sDecoder {
public:
''' % { "decoder_flavor" : decoderFlavor }
- for type,name in type_dict.iteritems():
+ for type,name in type_dict.items():
header_output += '''
template<typename Elem> using %(type)s = %(new_name)s<Elem>;''' % {
"type" : type, "new_name" : name
myDict.update(snippets)
- compositeCode = ' '.join(map(str, snippets.values()))
+ compositeCode = ' '.join(list(map(str, snippets.values())))
# Add in template itself in case it references any
# operands explicitly (like Mem)
if debug:
raise
error(lineno, 'error defining "%s": %s.' % (name, exc))
- for k in vars.keys():
+ for k in list(vars.keys()):
if k not in ('header_output', 'decoder_output',
'exec_output', 'decode_block'):
del vars[k]
self.base_class = base_class
if not isinstance(snippets, dict):
snippets = {'code' : snippets}
- compositeCode = ' '.join(map(str, snippets.values()))
+ compositeCode = ' '.join(list(map(str, snippets.values())))
self.snippets = snippets
self.operands = OperandList(parser, compositeCode)
def p_specification(self, t):
'specification : opt_defs_and_outputs top_level_decode_block'
- for f in self.splits.iterkeys():
+ for f in self.splits.keys():
f.write('\n#endif\n')
- for f in self.files.itervalues(): # close ALL the files;
+ for f in self.files.values(): # close ALL the files;
f.close() # not doing so can cause compilation to fail
self.write_top_level_files()
# Pass the ID and arg list to the current format class to deal with.
currentFormat = self.formatStack.top()
codeObj = currentFormat.defineInst(self, t[1], t[3], t.lexer.lineno)
- args = ','.join(map(str, t[3]))
+ args = ','.join(list(map(str, t[3])))
args = re.sub('(?m)^', '//', args)
args = re.sub('^//', '', args)
comment = '\n// %s::%s(%s)\n' % (currentFormat.id, t[1], args)
def buildOperandNameMap(self, user_dict, lineno):
operand_name = {}
- for op_name, val in user_dict.iteritems():
+ for op_name, val in user_dict.items():
# Check if extra attributes have been specified.
if len(val) > 9:
self.operandNameMap = operand_name
# Define operand variables.
- operands = user_dict.keys()
+ operands = list(user_dict.keys())
# Add the elems defined in the vector operands and
# build a map elem -> vector (used in OperandList)
elem_to_vec = {}
def format MultiInst(switchVal, *opTypeSets) {{
switcher = {}
- for (count, opTypeSet) in zip(xrange(len(opTypeSets)), opTypeSets):
+ for (count, opTypeSet) in zip(range(len(opTypeSets)), opTypeSets):
switcher[count] = (specializeInst, Name, opTypeSet, EmulEnv())
blocks = doSplitDecode(switchVal, switcher)
(header_output, decoder_output,
assert self.table is None
# Check for duplicate action
- for other in self.actions.itervalues():
+ for other in self.actions.values():
if action.ident == other.ident:
action.warning("Duplicate action definition: %s" % action.ident)
action.error("Duplicate action definition: %s" % action.ident)
table[index] = trans
# Look at all actions to make sure we used them all
- for action in self.actions.itervalues():
+ for action in self.actions.values():
if not action.used:
error_msg = "Unused action: %s" % action.ident
if "desc" in action:
// Actions
''')
if self.TBEType != None and self.EntryType != None:
- for action in self.actions.itervalues():
+ for action in self.actions.values():
code('/** \\brief ${{action.desc}} */')
code('void ${{action.ident}}(${{self.TBEType.c_ident}}*& '
'm_tbe_ptr, ${{self.EntryType.c_ident}}*& '
'm_cache_entry_ptr, Addr addr);')
elif self.TBEType != None:
- for action in self.actions.itervalues():
+ for action in self.actions.values():
code('/** \\brief ${{action.desc}} */')
code('void ${{action.ident}}(${{self.TBEType.c_ident}}*& '
'm_tbe_ptr, Addr addr);')
elif self.EntryType != None:
- for action in self.actions.itervalues():
+ for action in self.actions.values():
code('/** \\brief ${{action.desc}} */')
code('void ${{action.ident}}(${{self.EntryType.c_ident}}*& '
'm_cache_entry_ptr, Addr addr);')
else:
- for action in self.actions.itervalues():
+ for action in self.actions.values():
code('/** \\brief ${{action.desc}} */')
code('void ${{action.ident}}(Addr addr);')
// Actions
''')
if self.TBEType != None and self.EntryType != None:
- for action in self.actions.itervalues():
+ for action in self.actions.values():
if "c_code" not in action:
continue
''')
elif self.TBEType != None:
- for action in self.actions.itervalues():
+ for action in self.actions.values():
if "c_code" not in action:
continue
''')
elif self.EntryType != None:
- for action in self.actions.itervalues():
+ for action in self.actions.values():
if "c_code" not in action:
continue
''')
else:
- for action in self.actions.itervalues():
+ for action in self.actions.values():
if "c_code" not in action:
continue
# Check for resources
case_sorter = []
res = trans.resources
- for key,val in res.iteritems():
+ for key,val in res.items():
val = '''
if (!%s.areNSlotsAvailable(%s, clockEdge()))
return TransitionResult_ResourceStall;
# Walk through all of the unique code blocks and spit out the
# corresponding case statement elements
- for case,transitions in cases.iteritems():
+ for case,transitions in cases.items():
# Iterative over all the multiple transitions that share
# the same code
for trans in transitions:
self.printHTMLTransitions(path, None)
# Generate transition tables
- for state in self.states.itervalues():
+ for state in self.states.values():
self.printHTMLTransitions(path, state)
# Generate action descriptions
- for action in self.actions.itervalues():
+ for action in self.actions.values():
name = "%s_action_%s.html" % (self.ident, action.ident)
code = html.createSymbol(action, "Action")
code.write(path, name)
# Generate state descriptions
- for state in self.states.itervalues():
+ for state in self.states.values():
name = "%s_State_%s.html" % (self.ident, state.ident)
code = html.createSymbol(state, "State")
code.write(path, name)
# Generate event descriptions
- for event in self.events.itervalues():
+ for event in self.events.values():
name = "%s_Event_%s.html" % (self.ident, event.ident)
code = html.createSymbol(event, "Event")
code.write(path, name)
<TH> </TH>
""")
- for event in self.events.itervalues():
+ for event in self.events.values():
href = "%s_Event_%s.html" % (self.ident, event.ident)
ref = self.frameRef(href, "Status", href, "1", event.short)
code('<TH bgcolor=white>$ref</TH>')
code('</TR>')
# -- Body of table
- for state in self.states.itervalues():
+ for state in self.states.values():
# -- Each row
if state == active_state:
color = "yellow"
''')
# -- One column for each event
- for event in self.events.itervalues():
+ for event in self.events.values():
trans = self.table.get((state,event), None)
if trans is None:
# This is the no transition case
<TH> </TH>
''')
- for event in self.events.itervalues():
+ for event in self.events.values():
href = "%s_Event_%s.html" % (self.ident, event.ident)
ref = self.frameRef(href, "Status", href, "1", event.short)
code('<TH bgcolor=white>$ref</TH>')
self.resources = {}
for action in self.actions:
- for var,value in action.resources.iteritems():
+ for var,value in action.resources.items():
num = int(value)
if var in self.resources:
num += int(value)
# ******** Full init constructor ********
if not self.isGlobal:
params = [ 'const %s& local_%s' % (dm.type.c_ident, dm.ident) \
- for dm in self.data_members.itervalues() ]
+ for dm in self.data_members.values() ]
params = ', '.join(params)
if self.isMessage:
code.indent()
# For each field
- for i,(ident,enum) in enumerate(self.enums.iteritems()):
+ for i,(ident,enum) in enumerate(self.enums.items()):
desc = enum.get("desc", "No description avaliable")
if i == 0:
init = ' = %s_FIRST' % self.c_ident
int ${{self.c_ident}}_base_count(const ${{self.c_ident}}& obj);
''')
- for enum in self.enums.itervalues():
+ for enum in self.enums.values():
code('''
MachineID get${{enum.ident}}MachineID(NodeID RubyNode);
''')
if self.isMachineType:
- for enum in self.enums.itervalues():
+ for enum in self.enums.values():
if enum.primary:
code('#include "mem/ruby/protocol/${{enum.ident}}'
'_Controller.hh"')
# For each field
code.indent()
- for enum in self.enums.itervalues():
+ for enum in self.enums.values():
code(' case ${{self.c_ident}}_${{enum.ident}}:')
code(' return "${{enum.ident}}";')
code.dedent()
# For each field
start = ""
code.indent()
- for enum in self.enums.itervalues():
+ for enum in self.enums.values():
code('${start}if (str == "${{enum.ident}}") {')
code(' return ${{self.c_ident}}_${{enum.ident}};')
start = "} else "
# For each field
code.indent()
- for i,enum in enumerate(self.enums.itervalues()):
+ for i,enum in enumerate(self.enums.values()):
code(' case ${{self.c_ident}}_${{enum.ident}}:')
code(' return $i;')
code.dedent()
# For each field
code.indent()
- for i,enum in enumerate(self.enums.itervalues()):
+ for i,enum in enumerate(self.enums.values()):
code(' case $i:')
code(' return ${{self.c_ident}}_${{enum.ident}};')
code.dedent()
''')
# For each field
- for enum in self.enums.itervalues():
+ for enum in self.enums.values():
code('case ${{self.c_ident}}_${{enum.ident}}:')
if enum.primary:
code('return ${{enum.ident}}_Controller::getNumControllers();')
}
''')
- for enum in self.enums.itervalues():
+ for enum in self.enums.values():
code('''
MachineID
# the object itself, not including inherited params (which
# will also be inherited from the base class's param struct
# here). Sort the params based on their key
- params = map(lambda k_v: k_v[1], sorted(cls._params.local.items()))
+ params = list(map(lambda k_v: k_v[1], sorted(cls._params.local.items())))
ports = cls._ports.local
code('''#include "pybind11/pybind11.h"
# the object itself, not including inherited params (which
# will also be inherited from the base class's param struct
# here). Sort the params based on their key
- params = map(lambda k_v: k_v[1], sorted(cls._params.local.items()))
+ params = list(map(lambda k_v: k_v[1], sorted(cls._params.local.items())))
ports = cls._ports.local
try:
ptypes = [p.ptype for p in params]