SimObject.py (8669:f02f8c38f6a1) | SimObject.py (8714:cd48e2802644) |
---|---|
1# Copyright (c) 2004-2006 The Regents of The University of Michigan 2# Copyright (c) 2010 Advanced Micro Devices, Inc. 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 259 unchanged lines hidden (view full) --- 268 child.set_parent(cls, name) 269 cls._children[name] = child 270 271 def _new_port(cls, name, port): 272 # each port should be uniquely assigned to one variable 273 assert(not hasattr(port, 'name')) 274 port.name = name 275 cls._ports[name] = port | 1# Copyright (c) 2004-2006 The Regents of The University of Michigan 2# Copyright (c) 2010 Advanced Micro Devices, Inc. 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 259 unchanged lines hidden (view full) --- 268 child.set_parent(cls, name) 269 cls._children[name] = child 270 271 def _new_port(cls, name, port): 272 # each port should be uniquely assigned to one variable 273 assert(not hasattr(port, 'name')) 274 port.name = name 275 cls._ports[name] = port |
276 if hasattr(port, 'default'): 277 cls._cls_get_port_ref(name).connect(port.default) | |
278 279 # same as _get_port_ref, effectively, but for classes 280 def _cls_get_port_ref(cls, attr): 281 # Return reference that can be assigned to another port 282 # via __setattr__. There is only ever one reference 283 # object per port, but we create them lazily here. 284 ref = cls._port_refs.get(attr) 285 if not ref: --- 840 unchanged lines hidden --- | 276 277 # same as _get_port_ref, effectively, but for classes 278 def _cls_get_port_ref(cls, attr): 279 # Return reference that can be assigned to another port 280 # via __setattr__. There is only ever one reference 281 # object per port, but we create them lazily here. 282 ref = cls._port_refs.get(attr) 283 if not ref: --- 840 unchanged lines hidden --- |