From b4b03a60b170362aa0ae9dcfd224ed4fbce69683 Mon Sep 17 00:00:00 2001 From: Christopher Torng Date: Sun, 29 Dec 2013 19:29:45 -0600 Subject: 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 --- src/sim/clocked_object.hh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/sim/clocked_object.hh') diff --git a/src/sim/clocked_object.hh b/src/sim/clocked_object.hh index 304397a38..fb020f567 100644 --- a/src/sim/clocked_object.hh +++ b/src/sim/clocked_object.hh @@ -1,5 +1,6 @@ /* * Copyright (c) 2012-2013 ARM Limited + * Copyright (c) 2013 Cornell University * All rights reserved * * The license below extends only to copyright in the software and shall @@ -35,6 +36,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Authors: Andreas Hansson + * Christopher Torng */ /** @@ -118,6 +120,9 @@ class ClockedObject : public SimObject ClockedObject(const ClockedObjectParams* p) : SimObject(p), tick(0), cycle(0), clockDomain(*p->clk_domain) { + // Register with the clock domain, so that if the clock domain + // frequency changes, we can update this object's tick. + clockDomain.registerWithClockDomain(this); } /** @@ -139,6 +144,15 @@ class ClockedObject : public SimObject public: + /** + * Update the tick to the current tick. + * + */ + inline void updateClockPeriod() const + { + update(); + } + /** * Determine the tick when a cycle begins, by default the current * one, but the argument also enables the caller to determine a -- cgit v1.2.3