summaryrefslogtreecommitdiff
path: root/src/mem/ruby/eventqueue
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/ruby/eventqueue')
-rw-r--r--src/mem/ruby/eventqueue/RubyEventQueue.cc43
-rw-r--r--src/mem/ruby/eventqueue/RubyEventQueue.hh77
-rw-r--r--src/mem/ruby/eventqueue/RubyEventQueueNode.cc23
-rw-r--r--src/mem/ruby/eventqueue/RubyEventQueueNode.hh78
4 files changed, 86 insertions, 135 deletions
diff --git a/src/mem/ruby/eventqueue/RubyEventQueue.cc b/src/mem/ruby/eventqueue/RubyEventQueue.cc
index 3cfb52ff1..eaa22ff1e 100644
--- a/src/mem/ruby/eventqueue/RubyEventQueue.cc
+++ b/src/mem/ruby/eventqueue/RubyEventQueue.cc
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* All rights reserved.
@@ -27,16 +26,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*
- * $Id$
- */
-
-#include "mem/ruby/eventqueue/RubyEventQueue.hh"
#include "mem/ruby/common/Consumer.hh"
-#include "mem/ruby/system/System.hh"
+#include "mem/ruby/eventqueue/RubyEventQueue.hh"
#include "mem/ruby/eventqueue/RubyEventQueueNode.hh"
-
-// Class public method definitions
+#include "mem/ruby/system/System.hh"
RubyEventQueue::RubyEventQueue(EventQueue* eventq, Tick _clock)
: EventManager(eventq), m_clock(_clock)
@@ -47,28 +40,28 @@ RubyEventQueue::~RubyEventQueue()
{
}
-void RubyEventQueue::scheduleEvent(Consumer* consumer, Time timeDelta)
-{
- scheduleEventAbsolute(consumer, timeDelta + getTime());
+void
+RubyEventQueue::scheduleEvent(Consumer* consumer, Time timeDelta)
+{
+ scheduleEventAbsolute(consumer, timeDelta + getTime());
}
-void RubyEventQueue::scheduleEventAbsolute(Consumer* consumer, Time timeAbs)
+void
+RubyEventQueue::scheduleEventAbsolute(Consumer* consumer, Time timeAbs)
{
- // Check to see if this is a redundant wakeup
- ASSERT(consumer != NULL);
- if (!consumer->alreadyScheduled(timeAbs)) {
- // This wakeup is not redundant
- RubyEventQueueNode *thisNode = new RubyEventQueueNode(consumer, this);
- assert(timeAbs > getTime());
- schedule(thisNode, (timeAbs * m_clock));
- consumer->insertScheduledWakeupTime(timeAbs);
- }
+ // Check to see if this is a redundant wakeup
+ ASSERT(consumer != NULL);
+ if (!consumer->alreadyScheduled(timeAbs)) {
+ // This wakeup is not redundant
+ RubyEventQueueNode *thisNode = new RubyEventQueueNode(consumer, this);
+ assert(timeAbs > getTime());
+ schedule(thisNode, (timeAbs * m_clock));
+ consumer->insertScheduledWakeupTime(timeAbs);
+ }
}
-// Class private method definitions
-
void
RubyEventQueue::print(ostream& out) const
{
- out << "[Event Queue:]";
+ out << "[Event Queue:]";
}
diff --git a/src/mem/ruby/eventqueue/RubyEventQueue.hh b/src/mem/ruby/eventqueue/RubyEventQueue.hh
index 468b21edb..d2ebc42c2 100644
--- a/src/mem/ruby/eventqueue/RubyEventQueue.hh
+++ b/src/mem/ruby/eventqueue/RubyEventQueue.hh
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* All rights reserved.
@@ -28,9 +27,7 @@
*/
/*
- * $Id$
- *
- * Description: The RubyEventQueue class implements an event queue which
+ * The RubyEventQueue class implements an event queue which
* can be trigger events, allowing our simulation to be event driven.
*
* Currently, the only event we support is a Consumer being signaled
@@ -56,8 +53,8 @@
*
*/
-#ifndef RUBYEVENTQUEUE_H
-#define RUBYEVENTQUEUE_H
+#ifndef __MEM_RUBY_EVENTQUEUE_RUBYEVENTQUEUE_HH__
+#define __MEM_RUBY_EVENTQUEUE_RUBYEVENTQUEUE_HH__
#include <iostream>
@@ -70,48 +67,36 @@ class Consumer;
template <class TYPE> class PrioHeap;
class RubyEventQueueNode;
-class RubyEventQueue : public EventManager {
-public:
- // Constructors
- RubyEventQueue(EventQueue* eventq, Tick _clock);
-
- // Destructor
- ~RubyEventQueue();
-
- // 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(std::ostream& out) const;
-
- void triggerEvents(Time t) { assert(0); }
- void triggerAllEvents() { assert(0); }
-
- // Private Methods
-private:
- // Private copy constructor and assignment operator
- RubyEventQueue(const RubyEventQueue& obj);
- RubyEventQueue& operator=(const RubyEventQueue& obj);
-
- // Data Members (m_ prefix)
- Tick m_clock;
+class RubyEventQueue : public EventManager
+{
+ public:
+ RubyEventQueue(EventQueue* eventq, Tick _clock);
+ ~RubyEventQueue();
+
+ 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(std::ostream& out) const;
+
+ void triggerEvents(Time t) { assert(0); }
+ void triggerAllEvents() { assert(0); }
+
+ private:
+ // Private copy constructor and assignment operator
+ RubyEventQueue(const RubyEventQueue& obj);
+ RubyEventQueue& operator=(const RubyEventQueue& obj);
+
+ // Data Members (m_ prefix)
+ Tick m_clock;
};
-// Output operator declaration
-inline extern
-std::ostream& operator<<(std::ostream& out, const RubyEventQueue& obj);
-
-// ******************* Definitions *******************
-
-// Output operator definition
-inline extern
-std::ostream& operator<<(std::ostream& out, const RubyEventQueue& obj)
+inline std::ostream&
+operator<<(std::ostream& out, const RubyEventQueue& obj)
{
- obj.print(out);
- out << std::flush;
- return out;
+ obj.print(out);
+ out << std::flush;
+ return out;
}
-#endif //EVENTQUEUE_H
+#endif // __MEM_RUBY_EVENTQUEUE_RUBYEVENTQUEUE_HH__
diff --git a/src/mem/ruby/eventqueue/RubyEventQueueNode.cc b/src/mem/ruby/eventqueue/RubyEventQueueNode.cc
index 31aa2088a..c15452dd9 100644
--- a/src/mem/ruby/eventqueue/RubyEventQueueNode.cc
+++ b/src/mem/ruby/eventqueue/RubyEventQueueNode.cc
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* All rights reserved.
@@ -27,20 +26,16 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*
- * $Id$
- *
- */
-
#include "mem/ruby/eventqueue/RubyEventQueueNode.hh"
-void RubyEventQueueNode::print(std::ostream& out) const
+void
+RubyEventQueueNode::print(std::ostream& out) const
{
- out << "[";
- if (m_consumer_ptr != NULL) {
- out << " Consumer=" << m_consumer_ptr;
- } else {
- out << " Consumer=NULL";
- }
- out << "]";
+ out << "[";
+ if (m_consumer_ptr != NULL) {
+ out << " Consumer=" << m_consumer_ptr;
+ } else {
+ out << " Consumer=NULL";
+ }
+ out << "]";
}
diff --git a/src/mem/ruby/eventqueue/RubyEventQueueNode.hh b/src/mem/ruby/eventqueue/RubyEventQueueNode.hh
index 46d8b317c..c759e7f57 100644
--- a/src/mem/ruby/eventqueue/RubyEventQueueNode.hh
+++ b/src/mem/ruby/eventqueue/RubyEventQueueNode.hh
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* All rights reserved.
@@ -27,65 +26,44 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*
- * $Id$
- *
- */
-
-#ifndef RUBYEVENTQUEUENODE_H
-#define RUBYEVENTQUEUENODE_H
+#ifndef __MEM_RUBY_EVENTQUEUE_RUBYEVENTQUEUENODE_HH__
+#define __MEM_RUBY_EVENTQUEUE_RUBYEVENTQUEUENODE_HH__
#include <iostream>
+#include "mem/ruby/common/Consumer.hh"
#include "mem/ruby/common/Global.hh"
#include "sim/eventq.hh"
-#include "mem/ruby/common/Consumer.hh"
-//class Consumer;
-class RubyEventQueueNode : public Event {
-public:
- // Constructors
- RubyEventQueueNode(Consumer* _consumer, RubyEventQueue* _eventq)
- : m_consumer_ptr(_consumer), m_eventq_ptr(_eventq)
- {
- setFlags(AutoDelete);
- }
-
- // Destructor
- //~RubyEventQueueNode();
-
- // Public Methods
- void print(std::ostream& out) const;
- virtual void process()
- {
- m_consumer_ptr->wakeup();
- m_consumer_ptr->removeScheduledWakeupTime(m_eventq_ptr->getTime());
- }
- virtual const char *description() const { return "Ruby Event"; }
-
-private:
- // Private Methods
+class RubyEventQueueNode : public Event
+{
+ public:
+ RubyEventQueueNode(Consumer* _consumer, RubyEventQueue* _eventq)
+ : m_consumer_ptr(_consumer), m_eventq_ptr(_eventq)
+ {
+ setFlags(AutoDelete);
+ }
- // Default copy constructor and assignment operator
- // RubyEventQueueNode(const RubyEventQueueNode& obj);
+ void print(std::ostream& out) const;
+ virtual void
+ process()
+ {
+ m_consumer_ptr->wakeup();
+ m_consumer_ptr->removeScheduledWakeupTime(m_eventq_ptr->getTime());
+ }
+ virtual const char *description() const { return "Ruby Event"; }
- // Data Members (m_ prefix)
- Consumer* m_consumer_ptr;
- RubyEventQueue* m_eventq_ptr;
+ private:
+ Consumer* m_consumer_ptr;
+ RubyEventQueue* m_eventq_ptr;
};
-// Output operator declaration
-std::ostream& operator<<(std::ostream& out, const RubyEventQueueNode& obj);
-
-// ******************* Definitions *******************
-
-// Output operator definition
-extern inline
-std::ostream& operator<<(std::ostream& out, const RubyEventQueueNode& obj)
+inline std::ostream&
+operator<<(std::ostream& out, const RubyEventQueueNode& obj)
{
- obj.print(out);
- out << std::flush;
- return out;
+ obj.print(out);
+ out << std::flush;
+ return out;
}
-#endif //EVENTQUEUENODE_H
+#endif // __MEM_RUBY_EVENTQUEUE_EVENTQUEUENODE_HH__