params.py (9180:ee8d7a51651d) params.py (9184:a1a8f137b796)
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

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

458 # most derived types require this, so we just do it here once
459 code('#include "base/types.hh"')
460
461 @classmethod
462 def swig_predecls(cls, code):
463 # most derived types require this, so we just do it here once
464 code('%import "stdint.i"')
465 code('%import "base/types.hh"')
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

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

458 # most derived types require this, so we just do it here once
459 code('#include "base/types.hh"')
460
461 @classmethod
462 def swig_predecls(cls, code):
463 # most derived types require this, so we just do it here once
464 code('%import "stdint.i"')
465 code('%import "base/types.hh"')
466 # ignore the case operator for Cycles
467 code('%ignore *::operator uint64_t() const;')
468
469 def getValue(self):
470 return long(self.value)
471
472class Int(CheckedInt): cxx_type = 'int'; size = 32; unsigned = False
473class Unsigned(CheckedInt): cxx_type = 'unsigned'; size = 32; unsigned = True
474
475class Int8(CheckedInt): cxx_type = 'int8_t'; size = 8; unsigned = False
476class UInt8(CheckedInt): cxx_type = 'uint8_t'; size = 8; unsigned = True
477class Int16(CheckedInt): cxx_type = 'int16_t'; size = 16; unsigned = False
478class UInt16(CheckedInt): cxx_type = 'uint16_t'; size = 16; unsigned = True
479class Int32(CheckedInt): cxx_type = 'int32_t'; size = 32; unsigned = False
480class UInt32(CheckedInt): cxx_type = 'uint32_t'; size = 32; unsigned = True
481class Int64(CheckedInt): cxx_type = 'int64_t'; size = 64; unsigned = False
482class UInt64(CheckedInt): cxx_type = 'uint64_t'; size = 64; unsigned = True
483
484class Counter(CheckedInt): cxx_type = 'Counter'; size = 64; unsigned = True
466
467 def getValue(self):
468 return long(self.value)
469
470class Int(CheckedInt): cxx_type = 'int'; size = 32; unsigned = False
471class Unsigned(CheckedInt): cxx_type = 'unsigned'; size = 32; unsigned = True
472
473class Int8(CheckedInt): cxx_type = 'int8_t'; size = 8; unsigned = False
474class UInt8(CheckedInt): cxx_type = 'uint8_t'; size = 8; unsigned = True
475class Int16(CheckedInt): cxx_type = 'int16_t'; size = 16; unsigned = False
476class UInt16(CheckedInt): cxx_type = 'uint16_t'; size = 16; unsigned = True
477class Int32(CheckedInt): cxx_type = 'int32_t'; size = 32; unsigned = False
478class UInt32(CheckedInt): cxx_type = 'uint32_t'; size = 32; unsigned = True
479class Int64(CheckedInt): cxx_type = 'int64_t'; size = 64; unsigned = False
480class UInt64(CheckedInt): cxx_type = 'uint64_t'; size = 64; unsigned = True
481
482class Counter(CheckedInt): cxx_type = 'Counter'; size = 64; unsigned = True
485class Cycles(CheckedInt): cxx_type = 'Cycles'; size = 64; unsigned = True
486class Tick(CheckedInt): cxx_type = 'Tick'; size = 64; unsigned = True
487class TcpPort(CheckedInt): cxx_type = 'uint16_t'; size = 16; unsigned = True
488class UdpPort(CheckedInt): cxx_type = 'uint16_t'; size = 16; unsigned = True
489
490class Percent(CheckedInt): cxx_type = 'int'; min = 0; max = 100
491
483class Tick(CheckedInt): cxx_type = 'Tick'; size = 64; unsigned = True
484class TcpPort(CheckedInt): cxx_type = 'uint16_t'; size = 16; unsigned = True
485class UdpPort(CheckedInt): cxx_type = 'uint16_t'; size = 16; unsigned = True
486
487class Percent(CheckedInt): cxx_type = 'int'; min = 0; max = 100
488
489class Cycles(CheckedInt):
490 cxx_type = 'Cycles'
491 size = 64
492 unsigned = True
493
494 def getValue(self):
495 from m5.internal.core import Cycles
496 return Cycles(self.value)
497
492class Float(ParamValue, float):
493 cxx_type = 'double'
494
495 def __init__(self, value):
496 if isinstance(value, (int, long, float, NumericParamValue, Float)):
497 self.value = float(value)
498 else:
499 raise TypeError, "Can't convert object of type %s to Float" \

--- 1148 unchanged lines hidden ---
498class Float(ParamValue, float):
499 cxx_type = 'double'
500
501 def __init__(self, value):
502 if isinstance(value, (int, long, float, NumericParamValue, Float)):
503 self.value = float(value)
504 else:
505 raise TypeError, "Can't convert object of type %s to Float" \

--- 1148 unchanged lines hidden ---