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# |
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 |
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 |
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 |
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) |
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 |
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: |
983 setattr(cc_params, 'port_' + port_name + '_connection_count', 984 len(port)) |
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 --- |