summaryrefslogtreecommitdiff
path: root/src/mem/ruby/common/Consumer.cc
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2013-01-14 10:04:21 -0600
committerNilay Vaish <nilay@cs.wisc.edu>2013-01-14 10:04:21 -0600
commitcf232de4615f0fe9435d6e92a1d6319c972a8c88 (patch)
tree539c365baf0b078b2fdbf820feeb89c1afee8726 /src/mem/ruby/common/Consumer.cc
parentcbbc4c7f6b4cb718cc3907b955f7ae527d2d0274 (diff)
downloadgem5-cf232de4615f0fe9435d6e92a1d6319c972a8c88.tar.xz
Ruby: use ClockedObject in Consumer class
Many Ruby structures inherit from the Consumer, which is used for scheduling events. The Consumer used to relay on an Event Manager for scheduling events and on g_system_ptr for time. With this patch, the Consumer will now use a ClockedObject to schedule events and to query for current time. This resulted in several structures being converted from SimObjects to ClockedObjects. Also, the MessageBuffer class now requires a pointer to a ClockedObject so as to query for time.
Diffstat (limited to 'src/mem/ruby/common/Consumer.cc')
-rw-r--r--src/mem/ruby/common/Consumer.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/mem/ruby/common/Consumer.cc b/src/mem/ruby/common/Consumer.cc
index de6a8f448..a829f4d99 100644
--- a/src/mem/ruby/common/Consumer.cc
+++ b/src/mem/ruby/common/Consumer.cc
@@ -27,23 +27,21 @@
*/
#include "mem/ruby/common/Consumer.hh"
-#include "mem/ruby/common/Global.hh"
-#include "mem/ruby/system/System.hh"
void
Consumer::scheduleEvent(Time timeDelta)
{
- scheduleEventAbsolute(timeDelta + g_system_ptr->getTime());
+ scheduleEventAbsolute(timeDelta + em->curCycle());
}
void
Consumer::scheduleEventAbsolute(Time timeAbs)
{
- Tick evt_time = g_system_ptr->clockPeriod() * timeAbs;
+ Tick evt_time = em->clockPeriod() * timeAbs;
if (!alreadyScheduled(evt_time)) {
// This wakeup is not redundant
ConsumerEvent *evt = new ConsumerEvent(this);
- assert(timeAbs > g_system_ptr->getTime());
+ assert(timeAbs > em->curCycle());
em->schedule(evt, evt_time);
insertScheduledWakeupTime(evt_time);