summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mem/ruby/system/System.cc6
-rw-r--r--src/sim/clocked_object.hh12
2 files changed, 16 insertions, 2 deletions
diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc
index 8c267654f..6e144a703 100644
--- a/src/mem/ruby/system/System.cc
+++ b/src/mem/ruby/system/System.cc
@@ -354,8 +354,9 @@ RubySystem::startup()
Tick curtick_original = curTick();
// save the event queue head
Event* eventq_head = eventq->replaceHead(NULL);
- // set curTick to 0
+ // set curTick to 0 and reset Ruby System's clock
curTick(0);
+ resetClock();
// Schedule an event to start cache warmup
enqueueRubyEvent(curTick());
@@ -369,8 +370,9 @@ RubySystem::startup()
m_memory_controller->reset();
// Restore eventq head
eventq_head = eventq->replaceHead(eventq_head);
- // Restore curTick
+ // Restore curTick and Ruby System's clock
curTick(curtick_original);
+ resetClock();
}
}
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:
/**