summaryrefslogtreecommitdiff
path: root/src/sim/clocked_object.hh
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2012-10-15 17:27:15 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2012-10-15 17:27:15 -0500
commit6a65fafa52925ec4278121278b048363a3abd5ac (patch)
tree0add5d78fd8955c26249414291deb36d90dfd9ce /src/sim/clocked_object.hh
parentb6bd4f34b4a20ac158af610b71aaa24ac86b1ef6 (diff)
downloadgem5-6a65fafa52925ec4278121278b048363a3abd5ac.tar.xz
ruby: reset timing after cache warm up
Ruby system was recently converted to a clocked object. Such objects maintain state related to the time that has passed so far. During the cache warmup, Ruby system changes its own time and the global time. Later on, the global time is restored. So Ruby system also needs to reset its own time.
Diffstat (limited to 'src/sim/clocked_object.hh')
-rw-r--r--src/sim/clocked_object.hh12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/sim/clocked_object.hh b/src/sim/clocked_object.hh
index 78539c9c9..9a4c1034a 100644
--- a/src/sim/clocked_object.hh
+++ b/src/sim/clocked_object.hh
@@ -119,6 +119,18 @@ class ClockedObject : public SimObject
*/
virtual ~ClockedObject() { }
+ /**
+ * Reset the object's clock using the current global tick value. Likely
+ * to be used only when the global clock is reset. Currently, this done
+ * only when Ruby is done warming up the memory system.
+ */
+ void resetClock() const
+ {
+ Cycles elapsedCycles(divCeil(curTick(), clock));
+ cycle = elapsedCycles;
+ tick = elapsedCycles * clock;
+ }
+
public:
/**