SimObject.py (12036:634fbd07bc88) | SimObject.py (12199:f21e7e704ffd) |
---|---|
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 --- 565 unchanged lines hidden (view full) --- 574 575 def _add_cls_child(cls, name, child): 576 # It's a little funky to have a class as a parent, but these 577 # objects should never be instantiated (only cloned, which 578 # clears the parent pointer), and this makes it clear that the 579 # object is not an orphan and can provide better error 580 # messages. 581 child.set_parent(cls, name) | 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 --- 565 unchanged lines hidden (view full) --- 574 575 def _add_cls_child(cls, name, child): 576 # It's a little funky to have a class as a parent, but these 577 # objects should never be instantiated (only cloned, which 578 # clears the parent pointer), and this makes it clear that the 579 # object is not an orphan and can provide better error 580 # messages. 581 child.set_parent(cls, name) |
582 cls._children[name] = child | 582 if not isNullPointer(child): 583 cls._children[name] = child |
583 584 def _new_port(cls, name, port): 585 # each port should be uniquely assigned to one variable 586 assert(not hasattr(port, 'name')) 587 port.name = name 588 cls._ports[name] = port 589 590 # same as _get_port_ref, effectively, but for classes --- 630 unchanged lines hidden (view full) --- 1221 child.get_name()) 1222 if self._children.has_key(name): 1223 # This code path had an undiscovered bug that would make it fail 1224 # at runtime. It had been here for a long time and was only 1225 # exposed by a buggy script. Changes here will probably not be 1226 # exercised without specialized testing. 1227 self.clear_child(name) 1228 child.set_parent(self, name) | 584 585 def _new_port(cls, name, port): 586 # each port should be uniquely assigned to one variable 587 assert(not hasattr(port, 'name')) 588 port.name = name 589 cls._ports[name] = port 590 591 # same as _get_port_ref, effectively, but for classes --- 630 unchanged lines hidden (view full) --- 1222 child.get_name()) 1223 if self._children.has_key(name): 1224 # This code path had an undiscovered bug that would make it fail 1225 # at runtime. It had been here for a long time and was only 1226 # exposed by a buggy script. Changes here will probably not be 1227 # exercised without specialized testing. 1228 self.clear_child(name) 1229 child.set_parent(self, name) |
1229 self._children[name] = child | 1230 if not isNullPointer(child): 1231 self._children[name] = child |
1230 1231 # Take SimObject-valued parameters that haven't been explicitly 1232 # assigned as children and make them children of the object that 1233 # they were assigned to as a parameter value. This guarantees 1234 # that when we instantiate all the parameter objects we're still 1235 # inside the configuration hierarchy. 1236 def adoptOrphanParams(self): 1237 for key,val in self._values.iteritems(): --- 324 unchanged lines hidden --- | 1232 1233 # Take SimObject-valued parameters that haven't been explicitly 1234 # assigned as children and make them children of the object that 1235 # they were assigned to as a parameter value. This guarantees 1236 # that when we instantiate all the parameter objects we're still 1237 # inside the configuration hierarchy. 1238 def adoptOrphanParams(self): 1239 for key,val in self._values.iteritems(): --- 324 unchanged lines hidden --- |