params.py (9411:22e15f9c3fda) params.py (9544:1a075d9bc1bc)
1# Copyright (c) 2012 ARM Limited
1# Copyright (c) 2012-2013 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

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

1202 value = self.value
1203 else:
1204 value = ticks.fromSeconds(1.0 / self.value)
1205 return long(value)
1206
1207 def ini_str(self):
1208 return '%d' % self.getValue()
1209
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

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

1202 value = self.value
1203 else:
1204 value = ticks.fromSeconds(1.0 / self.value)
1205 return long(value)
1206
1207 def ini_str(self):
1208 return '%d' % self.getValue()
1209
1210# A generic frequency and/or Latency value. Value is stored as a latency,
1211# but to avoid ambiguity this object does not support numeric ops (* or /).
1212# An explicit conversion to a Latency or Frequency must be made first.
1210# A generic frequency and/or Latency value. Value is stored as a
1211# latency, and any manipulation using a multiplier thus scales the
1212# clock period, i.e. a 2x multiplier doubles the clock period and thus
1213# halves the clock frequency.
1213class Clock(ParamValue):
1214 cxx_type = 'Tick'
1215
1216 @classmethod
1217 def cxx_predecls(cls, code):
1218 code('#include "base/types.hh"')
1219
1220 @classmethod

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

1238
1239 def __getattr__(self, attr):
1240 if attr == 'frequency':
1241 return Frequency(self)
1242 if attr in ('latency', 'period'):
1243 return Latency(self)
1244 raise AttributeError, "Frequency object has no attribute '%s'" % attr
1245
1214class Clock(ParamValue):
1215 cxx_type = 'Tick'
1216
1217 @classmethod
1218 def cxx_predecls(cls, code):
1219 code('#include "base/types.hh"')
1220
1221 @classmethod

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

1239
1240 def __getattr__(self, attr):
1241 if attr == 'frequency':
1242 return Frequency(self)
1243 if attr in ('latency', 'period'):
1244 return Latency(self)
1245 raise AttributeError, "Frequency object has no attribute '%s'" % attr
1246
1247 def __mul__(self, other):
1248 # Always treat the clock as a period when scaling
1249 newobj = self.__class__(self)
1250 newobj.value *= other
1251 return newobj
1252
1253 __rmul__ = __mul__
1254
1246 def getValue(self):
1247 return self.period.getValue()
1248
1249 def ini_str(self):
1250 return self.period.ini_str()
1251
1252class NetworkBandwidth(float,ParamValue):
1253 cxx_type = 'float'

--- 395 unchanged lines hidden ---
1255 def getValue(self):
1256 return self.period.getValue()
1257
1258 def ini_str(self):
1259 return self.period.ini_str()
1260
1261class NetworkBandwidth(float,ParamValue):
1262 cxx_type = 'float'

--- 395 unchanged lines hidden ---