SimObject.py (8839:eeb293859255) | SimObject.py (8840:b62d40514d98) |
---|---|
1# Copyright (c) 2012 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 9# terms below provided that you ensure that this notice is replicated 10# unmodified and in its entirety in all distributions of the software, 11# modified or unmodified, in source code or in binary form. 12# |
|
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; --- 13 unchanged lines hidden (view full) --- 22# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27# 28# Authors: Steve Reinhardt 29# Nathan Binkert | 13# Copyright (c) 2004-2006 The Regents of The University of Michigan 14# Copyright (c) 2010 Advanced Micro Devices, Inc. 15# All rights reserved. 16# 17# Redistribution and use in source and binary forms, with or without 18# modification, are permitted provided that the following conditions are 19# met: redistributions of source code must retain the above copyright 20# notice, this list of conditions and the following disclaimer; --- 13 unchanged lines hidden (view full) --- 34# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39# 40# Authors: Steve Reinhardt 41# Nathan Binkert |
42# Andreas Hansson |
|
30 31import sys 32from types import FunctionType, MethodType, ModuleType 33 34try: 35 import pydot 36except: 37 pydot = False --- 343 unchanged lines hidden (view full) --- 381 classname = class_path[-1] 382 namespaces = class_path[:-1] 383 384 # The 'local' attribute restricts us to the params declared in 385 # the object itself, not including inherited params (which 386 # will also be inherited from the base class's param struct 387 # here). 388 params = cls._params.local.values() | 43 44import sys 45from types import FunctionType, MethodType, ModuleType 46 47try: 48 import pydot 49except: 50 pydot = False --- 343 unchanged lines hidden (view full) --- 394 classname = class_path[-1] 395 namespaces = class_path[:-1] 396 397 # The 'local' attribute restricts us to the params declared in 398 # the object itself, not including inherited params (which 399 # will also be inherited from the base class's param struct 400 # here). 401 params = cls._params.local.values() |
402 ports = cls._ports.local |
|
389 390 code('%module(package="m5.internal") param_$cls') 391 code() 392 code('%{') 393 code('#include "params/$cls.hh"') 394 for param in params: 395 param.cxx_predecls(code) 396 cls.export_method_cxx_predecls(code) --- 39 unchanged lines hidden (view full) --- 436 # Generate the C++ declaration (.hh file) for this SimObject's 437 # param struct. Called from src/SConscript. 438 def cxx_param_decl(cls, code): 439 # The 'local' attribute restricts us to the params declared in 440 # the object itself, not including inherited params (which 441 # will also be inherited from the base class's param struct 442 # here). 443 params = cls._params.local.values() | 403 404 code('%module(package="m5.internal") param_$cls') 405 code() 406 code('%{') 407 code('#include "params/$cls.hh"') 408 for param in params: 409 param.cxx_predecls(code) 410 cls.export_method_cxx_predecls(code) --- 39 unchanged lines hidden (view full) --- 450 # Generate the C++ declaration (.hh file) for this SimObject's 451 # param struct. Called from src/SConscript. 452 def cxx_param_decl(cls, code): 453 # The 'local' attribute restricts us to the params declared in 454 # the object itself, not including inherited params (which 455 # will also be inherited from the base class's param struct 456 # here). 457 params = cls._params.local.values() |
458 ports = cls._ports.local |
|
444 try: 445 ptypes = [p.ptype for p in params] 446 except: 447 print cls, p, p.ptype_str 448 print params 449 raise 450 451 class_path = cls._value_dict['cxx_class'].split('::') --- 24 unchanged lines hidden (view full) --- 476#endif 477 478#include <string> 479 480class EventQueue; 481''') 482 for param in params: 483 param.cxx_predecls(code) | 459 try: 460 ptypes = [p.ptype for p in params] 461 except: 462 print cls, p, p.ptype_str 463 print params 464 raise 465 466 class_path = cls._value_dict['cxx_class'].split('::') --- 24 unchanged lines hidden (view full) --- 491#endif 492 493#include <string> 494 495class EventQueue; 496''') 497 for param in params: 498 param.cxx_predecls(code) |
499 for port in ports.itervalues(): 500 port.cxx_predecls(code) |
|
484 code() 485 486 if cls._base: 487 code('#include "params/${{cls._base.type}}.hh"') 488 code() 489 490 for ptype in ptypes: 491 if issubclass(ptype, Enum): --- 20 unchanged lines hidden (view full) --- 512 virtual ~SimObjectParams() {} 513 514 std::string name; 515 PyObject *pyobj; 516 EventQueue *eventq; 517 ''') 518 for param in params: 519 param.cxx_decl(code) | 501 code() 502 503 if cls._base: 504 code('#include "params/${{cls._base.type}}.hh"') 505 code() 506 507 for ptype in ptypes: 508 if issubclass(ptype, Enum): --- 20 unchanged lines hidden (view full) --- 529 virtual ~SimObjectParams() {} 530 531 std::string name; 532 PyObject *pyobj; 533 EventQueue *eventq; 534 ''') 535 for param in params: 536 param.cxx_decl(code) |
537 for port in ports.itervalues(): 538 port.cxx_decl(code) 539 |
|
520 code.dedent() 521 code('};') 522 523 code() 524 code('#endif // __PARAMS__${cls}__') 525 return code 526 527 --- 427 unchanged lines hidden (view full) --- 955 else: 956 setattr(cc_params, param, value) 957 958 port_names = self._ports.keys() 959 port_names.sort() 960 for port_name in port_names: 961 port = self._port_refs.get(port_name, None) 962 if port != None: | 540 code.dedent() 541 code('};') 542 543 code() 544 code('#endif // __PARAMS__${cls}__') 545 return code 546 547 --- 427 unchanged lines hidden (view full) --- 975 else: 976 setattr(cc_params, param, value) 977 978 port_names = self._ports.keys() 979 port_names.sort() 980 for port_name in port_names: 981 port = self._port_refs.get(port_name, None) 982 if port != None: |
963 setattr(cc_params, port_name, port) | 983 setattr(cc_params, 'port_' + port_name + '_connection_count', 984 len(port)) |
964 self._ccParams = cc_params 965 return self._ccParams 966 967 # Get C++ object corresponding to this object, calling C++ if 968 # necessary to construct it. Does *not* recursively create 969 # children. 970 def getCCObject(self): 971 if not self._ccObject: --- 152 unchanged lines hidden --- | 985 self._ccParams = cc_params 986 return self._ccParams 987 988 # Get C++ object corresponding to this object, calling C++ if 989 # necessary to construct it. Does *not* recursively create 990 # children. 991 def getCCObject(self): 992 if not self._ccObject: --- 152 unchanged lines hidden --- |