summaryrefslogtreecommitdiff
path: root/src/python/m5/params.py
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2013-02-19 05:56:06 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2013-02-19 05:56:06 -0500
commit5c7ebee434a0328802c01b38c19845c50ae75cab (patch)
treefff45deda9f6abdf58a4ba9b103e4b1a8d9460af /src/python/m5/params.py
parent86a4d092691bdcdc7b60f7cacd7d5b5c54d9a1ca (diff)
downloadgem5-5c7ebee434a0328802c01b38c19845c50ae75cab.tar.xz
x86: Move APIC clock divider to Python
This patch moves the 16x APIC clock divider to the Python code to avoid the post-instantiation modifications to the clock. The x86 APIC was the only object setting the clock after creation time and this required some custom functionality and configuration. With this patch, the clock multiplier is moved to the Python code and the objects are instantiated with the appropriate clock.
Diffstat (limited to 'src/python/m5/params.py')
-rw-r--r--src/python/m5/params.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index b9a205307..fdd22dac0 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2012 ARM Limited
+# Copyright (c) 2012-2013 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
@@ -1207,9 +1207,10 @@ class Frequency(TickParamValue):
def ini_str(self):
return '%d' % self.getValue()
-# A generic frequency and/or Latency value. Value is stored as a latency,
-# but to avoid ambiguity this object does not support numeric ops (* or /).
-# An explicit conversion to a Latency or Frequency must be made first.
+# A generic frequency and/or Latency value. Value is stored as a
+# latency, and any manipulation using a multiplier thus scales the
+# clock period, i.e. a 2x multiplier doubles the clock period and thus
+# halves the clock frequency.
class Clock(ParamValue):
cxx_type = 'Tick'
@@ -1243,6 +1244,14 @@ class Clock(ParamValue):
return Latency(self)
raise AttributeError, "Frequency object has no attribute '%s'" % attr
+ def __mul__(self, other):
+ # Always treat the clock as a period when scaling
+ newobj = self.__class__(self)
+ newobj.value *= other
+ return newobj
+
+ __rmul__ = __mul__
+
def getValue(self):
return self.period.getValue()