ruby: Converted the sequencer deadlock event to m5 eventq
authorBrad Beckmann <Brad.Beckmann@amd.com>
Sat, 30 Jan 2010 04:29:19 +0000 (20:29 -0800)
committerBrad Beckmann <Brad.Beckmann@amd.com>
Sat, 30 Jan 2010 04:29:19 +0000 (20:29 -0800)
src/mem/ruby/eventqueue/RubyEventQueue.hh
src/mem/ruby/system/Sequencer.cc
src/mem/ruby/system/Sequencer.hh

index 36aa4843eac72e22b403a845e3b0e39d8a4d64b5..f9b4aa060d75b3a6344311444869465b0024b9be 100644 (file)
@@ -79,6 +79,7 @@ public:
   // Public Methods
 
   Time getTime() const { return curTick/m_clock; }
+  Tick getClock() const { return m_clock; }
   void scheduleEvent(Consumer* consumer, Time timeDelta);
   void scheduleEventAbsolute(Consumer* consumer, Time timeAbs);
   void print(ostream& out) const;
index ad219eab32ade120ebc1067e4657220450b625ec..a5a6e3260e062599858c026aa17a7371c112c2bf 100644 (file)
@@ -56,14 +56,13 @@ RubySequencerParams::create()
 }
  
 Sequencer::Sequencer(const Params *p)
-    : RubyPort(p)
+    : RubyPort(p), deadlockCheckEvent(this)
 {
     m_store_waiting_on_load_cycles = 0;
     m_store_waiting_on_store_cycles = 0;
     m_load_waiting_on_store_cycles = 0;
     m_load_waiting_on_load_cycles = 0;
     
-    m_deadlock_check_scheduled = false;
     m_outstanding_count = 0;
 
     m_max_outstanding_requests = 0;
@@ -128,9 +127,8 @@ void Sequencer::wakeup() {
   assert(m_outstanding_count == total_outstanding);
 
   if (m_outstanding_count > 0) { // If there are still outstanding requests, keep checking
-    g_eventQueue_ptr->scheduleEvent(this, m_deadlock_threshold);
-  } else {
-    m_deadlock_check_scheduled = false;
+    schedule(deadlockCheckEvent, 
+             (m_deadlock_threshold * g_eventQueue_ptr->getClock()) + curTick);
   }
 }
 
@@ -198,9 +196,8 @@ bool Sequencer::insertRequest(SequencerRequest* request) {
   assert(m_outstanding_count == total_outstanding);
 
   // See if we should schedule a deadlock check
-  if (m_deadlock_check_scheduled == false) {
-    g_eventQueue_ptr->scheduleEvent(this, m_deadlock_threshold);
-    m_deadlock_check_scheduled = true;
+  if (deadlockCheckEvent.scheduled() == false) {
+    schedule(deadlockCheckEvent, m_deadlock_threshold);
   }
 
   Address line_addr(request->ruby_request.paddr);
index 974b251f01493298fb7a3adb10562e17d35d5891..f24edbf746aa939b989461bb76b9ca7a33170f8e 100644 (file)
@@ -128,6 +128,18 @@ private:
   int m_store_waiting_on_store_cycles;
   int m_load_waiting_on_store_cycles;
   int m_load_waiting_on_load_cycles;
+
+  class SequencerWakeupEvent : public Event
+  {
+      Sequencer *m_sequencer_ptr;
+
+    public:
+      SequencerWakeupEvent(Sequencer *_seq) : m_sequencer_ptr(_seq) {}
+      void process() { m_sequencer_ptr->wakeup(); }
+      const char *description() const { return "Sequencer deadlock check"; }
+  };
+
+  SequencerWakeupEvent deadlockCheckEvent;
 };
 
 // Output operator declaration