-# Copyright (c) 2014 ARM Limited
+# Copyright (c) 2014,2019 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
import inspect
import json
import re
+import six
import sys
import m5
import m5.ticks as ticks
+if six.PY3:
+ long = int
+
sim_object_classes_by_name = {
- cls.__name__: cls for cls in m5.objects.__dict__.itervalues()
+ cls.__name__: cls for cls in m5.objects.__dict__.values()
if inspect.isclass(cls) and issubclass(cls, m5.objects.SimObject) }
# Add some parsing functions to Param classes to handle reading in .ini
'EthernetAddr': simple_parser()
}
-for name, parser in param_parsers.iteritems():
+for name, parser in param_parsers.items():
setattr(m5.params.__dict__[name], 'parse_ini', classmethod(parser))
class PortConnection(object):
parsed_params = {}
- for param_name, param in object_class._params.iteritems():
+ for param_name, param in object_class._params.items():
if issubclass(param.ptype, m5.params.ParamValue):
if isinstance(param, m5.params.VectorParamDesc):
param_values = self.config.get_param_vector(object_name,
if object_name == 'Null':
return NULL
- for param_name, param in obj.__class__._params.iteritems():
+ for param_name, param in obj.__class__._params.items():
if issubclass(param.ptype, m5.objects.SimObject):
if isinstance(param, m5.params.VectorParamDesc):
param_values = self.config.get_param_vector(object_name,
return NULL
parsed_ports = []
- for port_name, port in obj.__class__._ports.iteritems():
+ for port_name, port in obj.__class__._ports.items():
# Assume that unnamed ports are unconnected
peers = self.config.get_port_peers(object_name, port_name)
# Now fill in SimObject-valued parameters in the knowledge that
# this won't be interpreted as becoming the parent of objects
# which are already in the root hierarchy
- for name, obj in self.objects_by_name.iteritems():
+ for name, obj in self.objects_by_name.items():
self.fill_in_simobj_parameters(name, obj)
# Gather a list of all port-to-port connections
connections = []
- for name, obj in self.objects_by_name.iteritems():
+ for name, obj in self.objects_by_name.items():
connections += self.gather_port_connections(name, obj)
# Find an acceptable order to bind those port connections and
for elem in node:
self.find_all_objects(elem)
elif isinstance(node, dict):
- for elem in node.itervalues():
+ for elem in node.values():
self.find_all_objects(elem)
def load(self, config_file):
obj = self.object_dicts[object_name]
children = []
- for name, node in obj.iteritems():
+ for name, node in obj.items():
if self.is_sim_object(node):
children.append((name, node['path']))
elif isinstance(node, list) and node != [] and all([