summaryrefslogtreecommitdiff
path: root/src/sim/clock_domain.hh
diff options
context:
space:
mode:
authorChristopher Torng <clt67@cornell.edu>2013-12-29 19:29:45 -0600
committerChristopher Torng <clt67@cornell.edu>2013-12-29 19:29:45 -0600
commitb4b03a60b170362aa0ae9dcfd224ed4fbce69683 (patch)
treeb8897d2af9e81d50cbc251205b363cd0c5a89fd2 /src/sim/clock_domain.hh
parent903b442228efd27b8b7b49201eacc96c282714b5 (diff)
downloadgem5-b4b03a60b170362aa0ae9dcfd224ed4fbce69683.tar.xz
sim: Add support for dynamic frequency scaling
This patch provides support for DFS by having ClockedObjects register themselves with their clock domain at construction time in a member list. Using this list, a clock domain can update each member's tick to the curTick() before modifying the clock period. Committed by: Nilay Vaish <nilay@cs.wisc.edu>
Diffstat (limited to 'src/sim/clock_domain.hh')
-rw-r--r--src/sim/clock_domain.hh25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/sim/clock_domain.hh b/src/sim/clock_domain.hh
index 619f30696..e6b7273c1 100644
--- a/src/sim/clock_domain.hh
+++ b/src/sim/clock_domain.hh
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2013 ARM Limited
+ * Copyright (c) 2013 Cornell University
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -36,6 +37,7 @@
*
* Authors: Vasileios Spiliopoulos
* Akash Bagdia
+ * Christopher Torng
*/
/**
@@ -46,6 +48,8 @@
#ifndef __SIM_CLOCK_DOMAIN_HH__
#define __SIM_CLOCK_DOMAIN_HH__
+#include <algorithm>
+
#include "base/statistics.hh"
#include "params/ClockDomain.hh"
#include "params/DerivedClockDomain.hh"
@@ -57,6 +61,7 @@
*/
class DerivedClockDomain;
class VoltageDomain;
+class ClockedObject;
/**
* The ClockDomain provides clock to group of clocked objects bundled
@@ -86,6 +91,12 @@ class ClockDomain : public SimObject
*/
std::vector<DerivedClockDomain*> children;
+ /**
+ * Pointers to members of this clock domain, so that when the clock
+ * period changes, we can update each member's tick.
+ */
+ std::vector<ClockedObject*> members;
+
public:
typedef ClockDomainParams Params;
@@ -102,6 +113,18 @@ class ClockDomain : public SimObject
inline Tick clockPeriod() const { return _clockPeriod; }
/**
+ * Register a ClockedObject to this ClockDomain.
+ *
+ * @param ClockedObject to add as a member
+ */
+ void registerWithClockDomain(ClockedObject *c)
+ {
+ assert(c != NULL);
+ assert(std::find(members.begin(), members.end(), c) == members.end());
+ members.push_back(c);
+ }
+
+ /**
* Get the voltage domain.
*
* @return Voltage domain this clock domain belongs to
@@ -145,6 +168,8 @@ class SrcClockDomain : public ClockDomain
*/
void clockPeriod(Tick clock_period);
+ // Explicitly import the otherwise hidden clockPeriod
+ using ClockDomain::clockPeriod;
};
/**