1# Copyright (c) 2017 ARM Limited 2# All rights reserved. 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license --- 463 unchanged lines hidden (view full) --- 472 # We don't support multiple inheritance of sim objects. If you want 473 # to, you must fix multidict to deal with it properly. Non sim-objects 474 # are ok, though 475 bTotal = 0 476 for c in bases: 477 if isinstance(c, MetaSimObject): 478 bTotal += 1 479 if bTotal > 1: |
480 raise TypeError, \ 481 "SimObjects do not support multiple inheritance" |
482 483 base = bases[0] 484 485 # Set up general inheritance via multidicts. A subclass will 486 # inherit all its settings from the base class. The only time 487 # the following is not true is when we define the SimObject 488 # class itself (in which case the multidicts have no parent). 489 if isinstance(base, MetaSimObject): --- 185 unchanged lines hidden (view full) --- 675 # will also be inherited from the base class's param struct 676 # here). Sort the params based on their key 677 params = map(lambda (k, v): v, sorted(cls._params.local.items())) 678 ports = cls._ports.local 679 680 code('''#include "pybind11/pybind11.h" 681#include "pybind11/stl.h" 682 |
683#include "params/$cls.hh" 684#include "sim/init.hh" |
685#include "sim/sim_object.hh" 686 |
687#include "${{cls.cxx_header}}" 688 689''') 690 691 for param in params: 692 param.pybind_predecls(code) 693 694 code('''namespace py = pybind11; --- 284 unchanged lines hidden (view full) --- 979 type_str = 'Vector_%s' % values.ptype_str 980 ptype = values 981 else: 982 type_str = '%s' % values.ptype_str 983 ptype = values.ptype 984 985 if keys in self._hr_values\ 986 and keys in self._values\ |
987 and not isinstance(self._values[keys], 988 m5.proxy.BaseProxy): |
989 cmd_str = cmd_line_str + keys 990 acc_str = access_str + keys 991 flags_dict[cmd_str] = ParamInfo(ptype, 992 self._params[keys].desc, type_str, ex_str, 993 values.pretty_print(self._hr_values[keys]), 994 acc_str) 995 elif not keys in self._hr_values\ 996 and not keys in self._values: --- 183 unchanged lines hidden (view full) --- 1180 assert self._parent is old_parent 1181 self._parent = None 1182 1183 # Also implemented by SimObjectVector 1184 def set_parent(self, parent, name): 1185 self._parent = parent 1186 self._name = name 1187 |
1188 # Return parent object of this SimObject, not implemented by 1189 # SimObjectVector because the elements in a SimObjectVector may not share 1190 # the same parent |
1191 def get_parent(self): 1192 return self._parent 1193 1194 # Also implemented by SimObjectVector 1195 def get_name(self): 1196 return self._name 1197 1198 # Also implemented by SimObjectVector --- 75 unchanged lines hidden (view full) --- 1274 (found_obj.path, child.path) 1275 found_obj = child 1276 # search param space 1277 for pname,pdesc in self._params.iteritems(): 1278 if issubclass(pdesc.ptype, ptype): 1279 match_obj = self._values[pname] 1280 if found_obj != None and found_obj != match_obj: 1281 raise AttributeError, \ |
1282 'parent.any matched more than one: %s and %s' % \ 1283 (found_obj.path, match_obj.path) |
1284 found_obj = match_obj 1285 return found_obj, found_obj != None 1286 1287 def find_all(self, ptype): 1288 all = {} 1289 # search children 1290 for child in self._children.itervalues(): 1291 # a child could be a list, so ensure we visit each item --- 256 unchanged lines hidden --- |