# HG changeset patch
# User Brad Beckmann <brad.beckm...@amd.com>
# Date 1263536244 28800
# Node ID a7113be39b6a4f7ec2398fd87518f49445b1e83f
# Parent  bedc07d1355b1d016e93c8a8831274895e5f3741
ruby: Converted the sequencer deadlock event to m5 eventq

diff -r bedc07d1355b -r a7113be39b6a src/mem/ruby/eventqueue/RubyEventQueue.hh
--- a/src/mem/ruby/eventqueue/RubyEventQueue.hh Thu Jan 14 22:17:23 2010 -0800
+++ b/src/mem/ruby/eventqueue/RubyEventQueue.hh Thu Jan 14 22:17:24 2010 -0800
@@ -79,6 +79,7 @@
   // 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;
diff -r bedc07d1355b -r a7113be39b6a src/mem/ruby/system/Sequencer.cc
--- a/src/mem/ruby/system/Sequencer.cc  Thu Jan 14 22:17:23 2010 -0800
+++ b/src/mem/ruby/system/Sequencer.cc  Thu Jan 14 22:17:24 2010 -0800
@@ -60,9 +60,8 @@
 
 
 Sequencer::Sequencer(const Params *p)
-    : RubyPort(p)
+    : RubyPort(p), deadlockCheckEvent(this)
 {
-    m_deadlock_check_scheduled = false;
     m_outstanding_count = 0;
 
     m_max_outstanding_requests = 0;
@@ -128,9 +127,8 @@
   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);
   }
 }
 
@@ -190,9 +188,8 @@
   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);
diff -r bedc07d1355b -r a7113be39b6a src/mem/ruby/system/Sequencer.hh
--- a/src/mem/ruby/system/Sequencer.hh  Thu Jan 14 22:17:23 2010 -0800
+++ b/src/mem/ruby/system/Sequencer.hh  Thu Jan 14 22:17:24 2010 -0800
@@ -124,6 +124,18 @@
   bool m_deadlock_check_scheduled;
   int m_servicing_atomic;
   int m_atomics_counter;
+
+  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

_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to