params.py (8839:eeb293859255) | params.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 --- 1335 unchanged lines hidden (view full) --- 1344 self.role = role 1345 self.peer = None # not associated with another port yet 1346 self.ccConnected = False # C++ port connection done? 1347 self.index = -1 # always -1 for non-vector ports 1348 1349 def __str__(self): 1350 return '%s.%s' % (self.simobj, self.name) 1351 | 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 --- 1335 unchanged lines hidden (view full) --- 1344 self.role = role 1345 self.peer = None # not associated with another port yet 1346 self.ccConnected = False # C++ port connection done? 1347 self.index = -1 # always -1 for non-vector ports 1348 1349 def __str__(self): 1350 return '%s.%s' % (self.simobj, self.name) 1351 |
1352 def __len__(self): 1353 # Return the number of connected ports, i.e. 0 is we have no 1354 # peer and 1 if we do. 1355 return int(self.peer != None) 1356 |
|
1352 # for config.ini, print peer's name (not ours) 1353 def ini_str(self): 1354 return str(self.peer) 1355 1356 def __getattr__(self, attr): 1357 if attr == 'peerObj': 1358 # shorthand for proxies 1359 return self.peer.simobj --- 97 unchanged lines hidden (view full) --- 1457 self.simobj = simobj 1458 self.name = name 1459 self.role = role 1460 self.elements = [] 1461 1462 def __str__(self): 1463 return '%s.%s[:]' % (self.simobj, self.name) 1464 | 1357 # for config.ini, print peer's name (not ours) 1358 def ini_str(self): 1359 return str(self.peer) 1360 1361 def __getattr__(self, attr): 1362 if attr == 'peerObj': 1363 # shorthand for proxies 1364 return self.peer.simobj --- 97 unchanged lines hidden (view full) --- 1462 self.simobj = simobj 1463 self.name = name 1464 self.role = role 1465 self.elements = [] 1466 1467 def __str__(self): 1468 return '%s.%s[:]' % (self.simobj, self.name) 1469 |
1470 def __len__(self): 1471 # Return the number of connected peers, corresponding the the 1472 # length of the elements. 1473 return len(self.elements) 1474 |
|
1465 # for config.ini, print peer's name (not ours) 1466 def ini_str(self): 1467 return ' '.join([el.ini_str() for el in self.elements]) 1468 1469 def __getitem__(self, key): 1470 if not isinstance(key, int): 1471 raise TypeError, "VectorPort index must be integer" 1472 if key >= len(self.elements): --- 47 unchanged lines hidden (view full) --- 1520 def makeRef(self, simobj): 1521 return PortRef(simobj, self.name, self.role) 1522 1523 # Connect an instance of this port (on the given SimObject with 1524 # the given name) with the port described by the supplied PortRef 1525 def connect(self, simobj, ref): 1526 self.makeRef(simobj).connect(ref) 1527 | 1475 # for config.ini, print peer's name (not ours) 1476 def ini_str(self): 1477 return ' '.join([el.ini_str() for el in self.elements]) 1478 1479 def __getitem__(self, key): 1480 if not isinstance(key, int): 1481 raise TypeError, "VectorPort index must be integer" 1482 if key >= len(self.elements): --- 47 unchanged lines hidden (view full) --- 1530 def makeRef(self, simobj): 1531 return PortRef(simobj, self.name, self.role) 1532 1533 # Connect an instance of this port (on the given SimObject with 1534 # the given name) with the port described by the supplied PortRef 1535 def connect(self, simobj, ref): 1536 self.makeRef(simobj).connect(ref) 1537 |
1538 # No need for any pre-declarations at the moment as we merely rely 1539 # on an unsigned int. 1540 def cxx_predecls(self, code): 1541 pass 1542 1543 # Declare an unsigned int with the same name as the port, that 1544 # will eventually hold the number of connected ports (and thus the 1545 # number of elements for a VectorPort). 1546 def cxx_decl(self, code): 1547 code('unsigned int port_${{self.name}}_connection_count;') 1548 |
|
1528class MasterPort(Port): 1529 # MasterPort("description") 1530 def __init__(self, *args): 1531 if len(args) == 1: 1532 self.desc = args[0] 1533 self.role = 'MASTER' 1534 else: 1535 raise TypeError, 'wrong number of arguments' --- 75 unchanged lines hidden --- | 1549class MasterPort(Port): 1550 # MasterPort("description") 1551 def __init__(self, *args): 1552 if len(args) == 1: 1553 self.desc = args[0] 1554 self.role = 'MASTER' 1555 else: 1556 raise TypeError, 'wrong number of arguments' --- 75 unchanged lines hidden --- |