summaryrefslogtreecommitdiff
path: root/src/sim/clock_domain.cc
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.cc
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.cc')
-rw-r--r--src/sim/clock_domain.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/sim/clock_domain.cc b/src/sim/clock_domain.cc
index 8b563d598..ff96f2808 100644
--- a/src/sim/clock_domain.cc
+++ b/src/sim/clock_domain.cc
@@ -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
@@ -37,6 +38,7 @@
* Authors: Vasileios Spiliopoulos
* Akash Bagdia
* Andreas Hansson
+ * Christopher Torng
*/
#include "debug/ClockDomain.hh"
@@ -45,6 +47,7 @@
#include "params/SrcClockDomain.hh"
#include "sim/clock_domain.hh"
#include "sim/voltage_domain.hh"
+#include "sim/clocked_object.hh"
double
ClockDomain::voltage() const
@@ -65,6 +68,11 @@ SrcClockDomain::clockPeriod(Tick clock_period)
fatal("%s has a clock period of zero\n", name());
}
+ // Align all members to the current tick
+ for (auto m = members.begin(); m != members.end(); ++m) {
+ (*m)->updateClockPeriod();
+ }
+
_clockPeriod = clock_period;
DPRINTF(ClockDomain,
@@ -105,6 +113,11 @@ DerivedClockDomain::DerivedClockDomain(const Params *p) :
void
DerivedClockDomain::updateClockPeriod()
{
+ // Align all members to the current tick
+ for (auto m = members.begin(); m != members.end(); ++m) {
+ (*m)->updateClockPeriod();
+ }
+
// recalculate the clock period, relying on the fact that changes
// propagate downwards in the tree
_clockPeriod = parent.clockPeriod() * clockDivider;