Deleted Added
sdiff udiff text old ( 9184:a1a8f137b796 ) new ( 9232:3bb99fab80d4 )
full compact
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

--- 535 unchanged lines hidden (view full) ---

544 self.value = long(value)
545 self._check()
546 def __add__(self, other):
547 if isinstance(other, Addr):
548 return self.value + other.value
549 else:
550 return self.value + other
551
552class AddrRange(ParamValue):
553 cxx_type = 'Range<Addr>'
554
555 def __init__(self, *args, **kwargs):
556 def handle_kwargs(self, kwargs):
557 if 'end' in kwargs:
558 self.end = Addr(kwargs.pop('end'))
559 elif 'size' in kwargs:
560 self.end = self.start + Addr(kwargs.pop('size')) - 1
561 else:
562 raise TypeError, "Either end or size must be specified"
563
564 if len(args) == 0:
565 self.start = Addr(kwargs.pop('start'))
566 handle_kwargs(self, kwargs)
567
568 elif len(args) == 1:
569 if kwargs:
570 self.start = Addr(args[0])
571 handle_kwargs(self, kwargs)
572 elif isinstance(args[0], (list, tuple)):
573 self.start = Addr(args[0][0])
574 self.end = Addr(args[0][1])
575 else:
576 self.start = Addr(0)
577 self.end = Addr(args[0]) - 1
578
579 elif len(args) == 2:
580 self.start = Addr(args[0])
581 self.end = Addr(args[1])
582 else:
583 raise TypeError, "Too many arguments specified"
584
585 if kwargs:
586 raise TypeError, "Too many keywords: %s" % kwargs.keys()
587
588 def __str__(self):
589 return '%s:%s' % (self.start, self.end)
590
591 def size(self):
592 return long(self.end) - long(self.start) + 1
593
594 @classmethod
595 def cxx_predecls(cls, code):
596 Addr.cxx_predecls(code)
597 code('#include "base/range.hh"')
598
599 @classmethod
600 def swig_predecls(cls, code):
601 Addr.swig_predecls(code)
602 code('%import "python/swig/range.i"')
603
604 def getValue(self):
605 from m5.internal.range import AddrRange
606
607 value = AddrRange()
608 value.start = long(self.start)
609 value.end = long(self.end)
610 return value
611
612# Boolean parameter type. Python doesn't let you subclass bool, since
613# it doesn't want to let you create multiple instances of True and
614# False. Thus this is a little more complicated than String.
615class Bool(ParamValue):
616 cxx_type = 'bool'
617 def __init__(self, value):
618 try:
619 self.value = convert.toBool(value)

--- 996 unchanged lines hidden (view full) ---

1616 'Int', 'Unsigned', 'Int8', 'UInt8', 'Int16', 'UInt16',
1617 'Int32', 'UInt32', 'Int64', 'UInt64',
1618 'Counter', 'Addr', 'Tick', 'Percent',
1619 'TcpPort', 'UdpPort', 'EthernetAddr',
1620 'IpAddress', 'IpNetmask', 'IpWithPort',
1621 'MemorySize', 'MemorySize32',
1622 'Latency', 'Frequency', 'Clock',
1623 'NetworkBandwidth', 'MemoryBandwidth',
1624 'AddrRange',
1625 'MaxAddr', 'MaxTick', 'AllMemory',
1626 'Time',
1627 'NextEthernetAddr', 'NULL',
1628 'MasterPort', 'SlavePort',
1629 'VectorMasterPort', 'VectorSlavePort']
1630
1631import SimObject