params.py (9232:3bb99fab80d4) | params.py (9235:5aa4896ed55a) |
---|---|
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 --- 536 unchanged lines hidden (view full) --- 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): | 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 --- 536 unchanged lines hidden (view full) --- 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>' | 553 cxx_type = 'AddrRange' |
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: --- 27 unchanged lines hidden (view full) --- 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) | 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: --- 27 unchanged lines hidden (view full) --- 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"') | 597 code('#include "base/addr_range.hh"') |
598 599 @classmethod 600 def swig_predecls(cls, code): 601 Addr.swig_predecls(code) | 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): | 602 603 def getValue(self): |
604 # Go from the Python class to the wrapped C++ class generated 605 # by swig |
|
605 from m5.internal.range import AddrRange 606 | 606 from m5.internal.range import AddrRange 607 |
607 value = AddrRange() 608 value.start = long(self.start) 609 value.end = long(self.end) 610 return value | 608 return AddrRange(long(self.start), long(self.end)) |
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: --- 1013 unchanged lines hidden --- | 609 610# Boolean parameter type. Python doesn't let you subclass bool, since 611# it doesn't want to let you create multiple instances of True and 612# False. Thus this is a little more complicated than String. 613class Bool(ParamValue): 614 cxx_type = 'bool' 615 def __init__(self, value): 616 try: --- 1013 unchanged lines hidden --- |