summaryrefslogtreecommitdiff
path: root/src/mem
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem')
-rw-r--r--src/mem/ruby/buffers/MessageBuffer.cc53
-rw-r--r--src/mem/ruby/buffers/MessageBuffer.hh3
-rw-r--r--src/mem/ruby/common/Consumer.cc (renamed from src/mem/ruby/eventqueue/RubyEventQueue.cc)43
-rw-r--r--src/mem/ruby/common/Consumer.hh55
-rw-r--r--src/mem/ruby/common/Global.cc2
-rw-r--r--src/mem/ruby/common/Global.hh3
-rw-r--r--src/mem/ruby/common/SConscript1
-rw-r--r--src/mem/ruby/common/TypeDefines.hh2
-rw-r--r--src/mem/ruby/eventqueue/RubyEventQueue.hh96
-rw-r--r--src/mem/ruby/eventqueue/RubyEventQueueNode.cc41
-rw-r--r--src/mem/ruby/eventqueue/RubyEventQueueNode.hh69
-rw-r--r--src/mem/ruby/eventqueue/SConscript37
-rw-r--r--src/mem/ruby/network/garnet/BaseGarnetNetwork.cc2
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc4
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc2
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh2
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc26
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc4
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc4
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc2
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh6
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc6
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc4
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc6
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc2
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc8
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh2
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc4
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc6
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh6
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc4
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc30
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc4
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/Router.cc55
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flit.cc4
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc4
-rw-r--r--src/mem/ruby/network/orion/NetworkPower.cc4
-rw-r--r--src/mem/ruby/network/simple/PerfectSwitch.cc2
-rw-r--r--src/mem/ruby/network/simple/Throttle.cc8
-rw-r--r--src/mem/ruby/profiler/Profiler.cc26
-rw-r--r--src/mem/ruby/profiler/Profiler.hh19
-rw-r--r--src/mem/ruby/profiler/StoreTrace.cc6
-rw-r--r--src/mem/ruby/profiler/StoreTrace.hh1
-rw-r--r--src/mem/ruby/slicc_interface/Message.hh6
-rw-r--r--src/mem/ruby/slicc_interface/RubySlicc_Util.hh2
-rw-r--r--src/mem/ruby/system/CacheMemory.cc13
-rw-r--r--src/mem/ruby/system/CacheMemory.hh2
-rw-r--r--src/mem/ruby/system/RubyMemoryControl.cc12
-rw-r--r--src/mem/ruby/system/RubyPort.cc4
-rw-r--r--src/mem/ruby/system/Sequencer.cc22
-rw-r--r--src/mem/ruby/system/Sequencer.hh8
-rw-r--r--src/mem/ruby/system/System.cc7
-rw-r--r--src/mem/ruby/system/System.hh14
-rw-r--r--src/mem/ruby/system/TimerTable.cc8
-rw-r--r--src/mem/ruby/system/TimerTable.hh5
-rw-r--r--src/mem/ruby/system/WireBuffer.cc11
-rw-r--r--src/mem/ruby/system/WireBuffer.hh1
-rw-r--r--src/mem/slicc/ast/AST.py2
-rw-r--r--src/mem/slicc/ast/FuncCallExprAST.py4
-rw-r--r--src/mem/slicc/symbols/StateMachine.py12
-rw-r--r--src/mem/slicc/symbols/Type.py2
61 files changed, 269 insertions, 534 deletions
diff --git a/src/mem/ruby/buffers/MessageBuffer.cc b/src/mem/ruby/buffers/MessageBuffer.cc
index 9a7fdb61b..ee1c709f1 100644
--- a/src/mem/ruby/buffers/MessageBuffer.cc
+++ b/src/mem/ruby/buffers/MessageBuffer.cc
@@ -66,10 +66,10 @@ MessageBuffer::MessageBuffer(const string &name)
int
MessageBuffer::getSize()
{
- if (m_time_last_time_size_checked == g_eventQueue_ptr->getTime()) {
+ if (m_time_last_time_size_checked == g_system_ptr->getTime()) {
return m_size_last_time_size_checked;
} else {
- m_time_last_time_size_checked = g_eventQueue_ptr->getTime();
+ m_time_last_time_size_checked = g_system_ptr->getTime();
m_size_last_time_size_checked = m_size;
return m_size;
}
@@ -89,11 +89,11 @@ MessageBuffer::areNSlotsAvailable(int n)
// until next cycle, but enqueue operations effect the visible
// size immediately
int current_size = max(m_size_at_cycle_start, m_size);
- if (m_time_last_time_pop < g_eventQueue_ptr->getTime()) {
+ if (m_time_last_time_pop < g_system_ptr->getTime()) {
// no pops this cycle - m_size is correct
current_size = m_size;
} else {
- if (m_time_last_time_enqueue < g_eventQueue_ptr->getTime()) {
+ if (m_time_last_time_enqueue < g_system_ptr->getTime()) {
// no enqueues this cycle - m_size_at_cycle_start is correct
current_size = m_size_at_cycle_start;
} else {
@@ -155,9 +155,9 @@ MessageBuffer::enqueue(MsgPtr message, Time delta)
m_size++;
// record current time incase we have a pop that also adjusts my size
- if (m_time_last_time_enqueue < g_eventQueue_ptr->getTime()) {
+ if (m_time_last_time_enqueue < g_system_ptr->getTime()) {
m_msgs_this_cycle = 0; // first msg this cycle
- m_time_last_time_enqueue = g_eventQueue_ptr->getTime();
+ m_time_last_time_enqueue = g_system_ptr->getTime();
}
m_msgs_this_cycle++;
@@ -168,7 +168,7 @@ MessageBuffer::enqueue(MsgPtr message, Time delta)
// Calculate the arrival time of the message, that is, the first
// cycle the message can be dequeued.
assert(delta>0);
- Time current_time = g_eventQueue_ptr->getTime();
+ Time current_time = g_system_ptr->getTime();
Time arrival_time = 0;
if (!RubySystem::getRandomization() || (m_randomization == false)) {
// No randomization
@@ -192,10 +192,10 @@ MessageBuffer::enqueue(MsgPtr message, Time delta)
panic("FIFO ordering violated: %s name: %s current time: %d "
"delta: %d arrival_time: %d last arrival_time: %d\n",
*this, m_name,
- current_time * g_eventQueue_ptr->getClock(),
- delta * g_eventQueue_ptr->getClock(),
- arrival_time * g_eventQueue_ptr->getClock(),
- m_last_arrival_time * g_eventQueue_ptr->getClock());
+ current_time * g_system_ptr->getClock(),
+ delta * g_system_ptr->getClock(),
+ arrival_time * g_system_ptr->getClock(),
+ m_last_arrival_time * g_system_ptr->getClock());
}
}
@@ -208,10 +208,10 @@ MessageBuffer::enqueue(MsgPtr message, Time delta)
Message* msg_ptr = message.get();
assert(msg_ptr != NULL);
- assert(g_eventQueue_ptr->getTime() >= msg_ptr->getLastEnqueueTime() &&
+ assert(g_system_ptr->getTime() >= msg_ptr->getLastEnqueueTime() &&
"ensure we aren't dequeued early");
- msg_ptr->setDelayedCycles(g_eventQueue_ptr->getTime() -
+ msg_ptr->setDelayedCycles(g_system_ptr->getTime() -
msg_ptr->getLastEnqueueTime() +
msg_ptr->getDelayedCycles());
msg_ptr->setLastEnqueueTime(arrival_time);
@@ -223,12 +223,12 @@ MessageBuffer::enqueue(MsgPtr message, Time delta)
greater<MessageBufferNode>());
DPRINTF(RubyQueue, "Enqueue with arrival_time %lld.\n",
- arrival_time * g_eventQueue_ptr->getClock());
+ arrival_time * g_system_ptr->getClock());
DPRINTF(RubyQueue, "Enqueue Message: %s.\n", (*(message.get())));
// Schedule the wakeup
if (m_consumer_ptr != NULL) {
- g_eventQueue_ptr->scheduleEventAbsolute(m_consumer_ptr, arrival_time);
+ m_consumer_ptr->scheduleEventAbsolute(arrival_time);
m_consumer_ptr->storeEventInfo(m_vnet_id);
} else {
panic("No consumer: %s name: %s\n", *this, m_name);
@@ -287,9 +287,9 @@ MessageBuffer::pop()
// record previous size and time so the current buffer size isn't
// adjusted until next cycle
- if (m_time_last_time_pop < g_eventQueue_ptr->getTime()) {
+ if (m_time_last_time_pop < g_system_ptr->getTime()) {
m_size_at_cycle_start = m_size;
- m_time_last_time_pop = g_eventQueue_ptr->getTime();
+ m_time_last_time_pop = g_system_ptr->getTime();
}
m_size--;
}
@@ -315,12 +315,12 @@ MessageBuffer::recycle()
MessageBufferNode node = m_prio_heap.front();
pop_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- node.m_time = g_eventQueue_ptr->getTime() + m_recycle_latency;
+ node.m_time = g_system_ptr->getTime() + m_recycle_latency;
m_prio_heap.back() = node;
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- g_eventQueue_ptr->scheduleEventAbsolute(m_consumer_ptr,
- g_eventQueue_ptr->getTime() + m_recycle_latency);
+ m_consumer_ptr->scheduleEventAbsolute(g_system_ptr->getTime() +
+ m_recycle_latency);
}
void
@@ -335,7 +335,7 @@ MessageBuffer::reanalyzeMessages(const Address& addr)
//
while(!m_stall_msg_map[addr].empty()) {
m_msg_counter++;
- MessageBufferNode msgNode(g_eventQueue_ptr->getTime() + 1,
+ MessageBufferNode msgNode(g_system_ptr->getTime() + 1,
m_msg_counter,
m_stall_msg_map[addr].front());
@@ -343,7 +343,7 @@ MessageBuffer::reanalyzeMessages(const Address& addr)
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- g_eventQueue_ptr->scheduleEventAbsolute(m_consumer_ptr, msgNode.m_time);
+ m_consumer_ptr->scheduleEventAbsolute(msgNode.m_time);
m_stall_msg_map[addr].pop_front();
}
m_stall_msg_map.erase(addr);
@@ -364,7 +364,7 @@ MessageBuffer::reanalyzeAllMessages()
while(!(map_iter->second).empty()) {
m_msg_counter++;
- MessageBufferNode msgNode(g_eventQueue_ptr->getTime() + 1,
+ MessageBufferNode msgNode(g_system_ptr->getTime() + 1,
m_msg_counter,
(map_iter->second).front());
@@ -372,8 +372,7 @@ MessageBuffer::reanalyzeAllMessages()
push_heap(m_prio_heap.begin(), m_prio_heap.end(),
greater<MessageBufferNode>());
- g_eventQueue_ptr->scheduleEventAbsolute(m_consumer_ptr,
- msgNode.m_time);
+ m_consumer_ptr->scheduleEventAbsolute(msgNode.m_time);
(map_iter->second).pop_front();
}
}
@@ -407,8 +406,8 @@ MessageBuffer::setAndReturnDelayCycles(MsgPtr msg_ptr)
// this function should only be called on dequeue
// ensure the msg hasn't been enqueued
- assert(msg_ptr->getLastEnqueueTime() <= g_eventQueue_ptr->getTime());
- msg_ptr->setDelayedCycles(g_eventQueue_ptr->getTime() -
+ assert(msg_ptr->getLastEnqueueTime() <= g_system_ptr->getTime());
+ msg_ptr->setDelayedCycles(g_system_ptr->getTime() -
msg_ptr->getLastEnqueueTime() +
msg_ptr->getDelayedCycles());
delay_cycles = msg_ptr->getDelayedCycles();
diff --git a/src/mem/ruby/buffers/MessageBuffer.hh b/src/mem/ruby/buffers/MessageBuffer.hh
index 4193c9f73..cf7e77c2d 100644
--- a/src/mem/ruby/buffers/MessageBuffer.hh
+++ b/src/mem/ruby/buffers/MessageBuffer.hh
@@ -45,7 +45,6 @@
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/common/Consumer.hh"
#include "mem/ruby/common/Global.hh"
-#include "mem/ruby/eventqueue/RubyEventQueue.hh"
#include "mem/ruby/slicc_interface/Message.hh"
class MessageBuffer
@@ -70,7 +69,7 @@ class MessageBuffer
isReady() const
{
return ((m_prio_heap.size() > 0) &&
- (m_prio_heap.front().m_time <= g_eventQueue_ptr->getTime()));
+ (m_prio_heap.front().m_time <= g_system_ptr->getTime()));
}
void
diff --git a/src/mem/ruby/eventqueue/RubyEventQueue.cc b/src/mem/ruby/common/Consumer.cc
index 4ea530b05..a81396217 100644
--- a/src/mem/ruby/eventqueue/RubyEventQueue.cc
+++ b/src/mem/ruby/common/Consumer.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
+ * Copyright (c) 2012 Mark D. Hill and David A. Wood
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,43 +26,38 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <cassert>
-
#include "mem/ruby/common/Consumer.hh"
-#include "mem/ruby/eventqueue/RubyEventQueue.hh"
-#include "mem/ruby/eventqueue/RubyEventQueueNode.hh"
+#include "mem/ruby/common/Global.hh"
+#include "mem/ruby/system/System.hh"
-RubyEventQueue::RubyEventQueue(EventQueue* eventq, Tick _clock)
- : EventManager(eventq), m_clock(_clock)
+void
+Consumer::scheduleEvent(Time timeDelta)
{
+ scheduleEvent(g_system_ptr, timeDelta);
}
-RubyEventQueue::~RubyEventQueue()
+void
+Consumer::scheduleEvent(EventManager *em, Time timeDelta)
{
+ scheduleEventAbsolute(em, timeDelta + g_system_ptr->getTime());
}
void
-RubyEventQueue::scheduleEvent(Consumer* consumer, Time timeDelta)
+Consumer::scheduleEventAbsolute(Time timeAbs)
{
- scheduleEventAbsolute(consumer, timeDelta + getTime());
+ scheduleEventAbsolute(g_system_ptr, timeAbs);
}
void
-RubyEventQueue::scheduleEventAbsolute(Consumer* consumer, Time timeAbs)
+Consumer::scheduleEventAbsolute(EventManager *em, Time timeAbs)
{
- // Check to see if this is a redundant wakeup
- assert(consumer != NULL);
- if (!consumer->alreadyScheduled(timeAbs)) {
+ Tick evt_time = timeAbs * g_system_ptr->getClock();
+ if (!alreadyScheduled(evt_time)) {
// This wakeup is not redundant
- RubyEventQueueNode *thisNode = new RubyEventQueueNode(consumer, this);
- assert(timeAbs > getTime());
- schedule(thisNode, (timeAbs * m_clock));
- consumer->insertScheduledWakeupTime(timeAbs);
- }
-}
+ ConsumerEvent *evt = new ConsumerEvent(this);
+ assert(timeAbs > g_system_ptr->getTime());
-void
-RubyEventQueue::print(std::ostream& out) const
-{
- out << "[Event Queue:]";
+ em->schedule(evt, evt_time);
+ insertScheduledWakeupTime(evt_time);
+ }
}
diff --git a/src/mem/ruby/common/Consumer.hh b/src/mem/ruby/common/Consumer.hh
index a119abb39..6a67bde39 100644
--- a/src/mem/ruby/common/Consumer.hh
+++ b/src/mem/ruby/common/Consumer.hh
@@ -38,10 +38,8 @@
#include <iostream>
#include <set>
-#include "mem/ruby/common/Global.hh"
-#include "mem/ruby/eventqueue/RubyEventQueue.hh"
-
-class MessageBuffer;
+#include "mem/ruby/common/TypeDefines.hh"
+#include "sim/eventq.hh"
class Consumer
{
@@ -55,55 +53,68 @@ class Consumer
~Consumer()
{ }
- void
- triggerWakeup(RubyEventQueue *eventQueue)
- {
- Time time = eventQueue->getTime();
- if (m_last_wakeup != time) {
- wakeup();
- m_last_wakeup = time;
- }
- }
-
virtual void wakeup() = 0;
virtual void print(std::ostream& out) const = 0;
virtual void storeEventInfo(int info) {}
- const Time&
+ const Tick&
getLastScheduledWakeup() const
{
return m_last_scheduled_wakeup;
}
void
- setLastScheduledWakeup(const Time& time)
+ setLastScheduledWakeup(const Tick& time)
{
m_last_scheduled_wakeup = time;
}
bool
- alreadyScheduled(Time time)
+ alreadyScheduled(Tick time)
{
return m_scheduled_wakeups.find(time) != m_scheduled_wakeups.end();
}
void
- insertScheduledWakeupTime(Time time)
+ insertScheduledWakeupTime(Tick time)
{
m_scheduled_wakeups.insert(time);
}
void
- removeScheduledWakeupTime(Time time)
+ removeScheduledWakeupTime(Tick time)
{
assert(alreadyScheduled(time));
m_scheduled_wakeups.erase(time);
}
+ void scheduleEvent(EventManager* em, Time timeDelta);
+ void scheduleEventAbsolute(EventManager* em, Time timeAbs);
+ void scheduleEvent(Time timeDelta);
+ void scheduleEventAbsolute(Time timeAbs);
+
private:
- Time m_last_scheduled_wakeup;
- std::set<Time> m_scheduled_wakeups;
- Time m_last_wakeup;
+ Tick m_last_scheduled_wakeup;
+ std::set<Tick> m_scheduled_wakeups;
+ Tick m_last_wakeup;
+
+ class ConsumerEvent : public Event
+ {
+ public:
+ ConsumerEvent(Consumer* _consumer)
+ : Event(Default_Pri, AutoDelete), m_consumer_ptr(_consumer)
+ {
+ }
+
+ void process()
+ {
+ m_consumer_ptr->wakeup();
+ m_consumer_ptr->removeScheduledWakeupTime(when());
+ }
+
+ private:
+ Consumer* m_consumer_ptr;
+ };
};
inline std::ostream&
diff --git a/src/mem/ruby/common/Global.cc b/src/mem/ruby/common/Global.cc
index e771de7ae..a2ed4e6ae 100644
--- a/src/mem/ruby/common/Global.cc
+++ b/src/mem/ruby/common/Global.cc
@@ -28,6 +28,4 @@
#include "mem/ruby/common/Global.hh"
-RubyEventQueue* g_eventQueue_ptr = 0;
RubySystem* g_system_ptr = 0;
-
diff --git a/src/mem/ruby/common/Global.hh b/src/mem/ruby/common/Global.hh
index cae7cb16b..f76a1a26b 100644
--- a/src/mem/ruby/common/Global.hh
+++ b/src/mem/ruby/common/Global.hh
@@ -31,9 +31,6 @@
#include "base/str.hh"
-class RubyEventQueue;
-extern RubyEventQueue* g_eventQueue_ptr;
-
class RubySystem;
extern RubySystem* g_system_ptr;
diff --git a/src/mem/ruby/common/SConscript b/src/mem/ruby/common/SConscript
index aab35a09c..c7e774b47 100644
--- a/src/mem/ruby/common/SConscript
+++ b/src/mem/ruby/common/SConscript
@@ -34,6 +34,7 @@ if env['PROTOCOL'] == 'None':
Return()
Source('Address.cc')
+Source('Consumer.cc')
Source('DataBlock.cc')
Source('Global.cc')
Source('Histogram.cc')
diff --git a/src/mem/ruby/common/TypeDefines.hh b/src/mem/ruby/common/TypeDefines.hh
index 233c9146a..a7b8a6101 100644
--- a/src/mem/ruby/common/TypeDefines.hh
+++ b/src/mem/ruby/common/TypeDefines.hh
@@ -35,8 +35,6 @@ typedef unsigned char uint8;
typedef unsigned int uint32;
typedef unsigned long long uint64;
-typedef signed char int8;
-typedef int int32;
typedef long long int64;
typedef long long integer_t;
diff --git a/src/mem/ruby/eventqueue/RubyEventQueue.hh b/src/mem/ruby/eventqueue/RubyEventQueue.hh
deleted file mode 100644
index 67fe6131b..000000000
--- a/src/mem/ruby/eventqueue/RubyEventQueue.hh
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * 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
- * by calling the consumer's wakeup() routine. Adding the event to
- * the queue does not require a virtual function call, though calling
- * wakeup() is a virtual function call.
- *
- * The method triggerEvents() is called with a global time. All
- * events which are before or at this time are triggered in timestamp
- * order. No ordering is enforced for events scheduled to occur at
- * the same time. Events scheduled to wakeup the same consumer at the
- * same time are combined into a single event.
- *
- * The method scheduleConsumerWakeup() is called with a global time
- * and a consumer pointer. The event queue will call the wakeup()
- * method of the consumer at the appropriate time.
- *
- * This implementation of RubyEventQueue uses a dynamically sized array
- * managed as a heap. The algorithms used has O(lg n) for insert and
- * O(lg n) for extract minimum element. (Based on chapter 7 of Cormen,
- * Leiserson, and Rivest.) The array is dynamically sized and is
- * automatically doubled in size when necessary.
- *
- */
-
-#ifndef __MEM_RUBY_EVENTQUEUE_RUBYEVENTQUEUE_HH__
-#define __MEM_RUBY_EVENTQUEUE_RUBYEVENTQUEUE_HH__
-
-#include <iostream>
-
-#include "mem/ruby/common/TypeDefines.hh"
-#include "sim/eventq.hh"
-
-class Consumer;
-class RubyEventQueueNode;
-
-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;
-
- private:
- // Private copy constructor and assignment operator
- RubyEventQueue(const RubyEventQueue& obj);
- RubyEventQueue& operator=(const RubyEventQueue& obj);
-
- // Data Members (m_ prefix)
- Tick m_clock;
-};
-
-inline std::ostream&
-operator<<(std::ostream& out, const RubyEventQueue& obj)
-{
- obj.print(out);
- out << std::flush;
- return out;
-}
-
-#endif // __MEM_RUBY_EVENTQUEUE_RUBYEVENTQUEUE_HH__
diff --git a/src/mem/ruby/eventqueue/RubyEventQueueNode.cc b/src/mem/ruby/eventqueue/RubyEventQueueNode.cc
deleted file mode 100644
index c15452dd9..000000000
--- a/src/mem/ruby/eventqueue/RubyEventQueueNode.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "mem/ruby/eventqueue/RubyEventQueueNode.hh"
-
-void
-RubyEventQueueNode::print(std::ostream& out) const
-{
- 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
deleted file mode 100644
index de1550654..000000000
--- a/src/mem/ruby/eventqueue/RubyEventQueueNode.hh
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#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"
-
-class RubyEventQueueNode : public Event
-{
- public:
- RubyEventQueueNode(Consumer* _consumer, RubyEventQueue* _eventq)
- : Event(Default_Pri, AutoDelete),
- m_consumer_ptr(_consumer), m_eventq_ptr(_eventq)
- {
- }
-
- 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:
- Consumer* m_consumer_ptr;
- RubyEventQueue* m_eventq_ptr;
-};
-
-inline std::ostream&
-operator<<(std::ostream& out, const RubyEventQueueNode& obj)
-{
- obj.print(out);
- out << std::flush;
- return out;
-}
-
-#endif // __MEM_RUBY_EVENTQUEUE_EVENTQUEUENODE_HH__
diff --git a/src/mem/ruby/eventqueue/SConscript b/src/mem/ruby/eventqueue/SConscript
deleted file mode 100644
index a74d53139..000000000
--- a/src/mem/ruby/eventqueue/SConscript
+++ /dev/null
@@ -1,37 +0,0 @@
-# -*- mode:python -*-
-
-# Copyright (c) 2009 The Hewlett-Packard Development Company
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met: redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer;
-# redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution;
-# neither the name of the copyright holders nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Authors: Nathan Binkert
-
-Import('*')
-
-if env['PROTOCOL'] == 'None':
- Return()
-
-Source('RubyEventQueue.cc')
-Source('RubyEventQueueNode.cc')
diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
index 69d513329..78b4b2d42 100644
--- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
+++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
@@ -127,7 +127,7 @@ BaseGarnetNetwork::getFromNetQueue(NodeID id, bool ordered, int network_num,
void
BaseGarnetNetwork::clearStats()
{
- m_ruby_start = g_eventQueue_ptr->getTime();
+ m_ruby_start = g_system_ptr->getTime();
}
Time
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
index b861b6a4e..c7ac85ad3 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
@@ -272,7 +272,7 @@ GarnetNetwork_d::printLinkStats(ostream& out) const
for (int i = 0; i < m_link_ptr_vector.size(); i++) {
average_link_utilization +=
(double(m_link_ptr_vector[i]->getLinkUtilization())) /
- (double(g_eventQueue_ptr->getTime()-m_ruby_start));
+ (double(g_system_ptr->getTime()-m_ruby_start));
vector<int> vc_load = m_link_ptr_vector[i]->getVcLoad();
for (int j = 0; j < vc_load.size(); j++) {
@@ -291,7 +291,7 @@ GarnetNetwork_d::printLinkStats(ostream& out) const
continue;
average_vc_load[i] = (double(average_vc_load[i]) /
- (double(g_eventQueue_ptr->getTime()) - m_ruby_start));
+ (double(g_system_ptr->getTime()) - m_ruby_start));
out << "Average VC Load [" << i << "] = " << average_vc_load[i]
<< " flits/cycle " << endl;
}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc
index 3e3584bd8..adafa4d24 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc
@@ -79,7 +79,7 @@ InputUnit_d::wakeup()
// Do the route computation for this vc
m_router->route_req(t_flit, this, vc);
- m_vcs[vc]->set_enqueue_time(g_eventQueue_ptr->getTime());
+ m_vcs[vc]->set_enqueue_time(g_system_ptr->getTime());
} else {
t_flit->advance_stage(SA_);
m_router->swarb_req();
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh
index 79158d56d..544c4271b 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh
@@ -90,7 +90,7 @@ class InputUnit_d : public Consumer
{
flit_d *t_flit = new flit_d(in_vc, free_signal);
creditQueue->insert(t_flit);
- g_eventQueue_ptr->scheduleEvent(m_credit_link, 1);
+ m_credit_link->scheduleEvent(1);
}
inline int
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
index 4a2c9e26a..4bdce2a34 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
@@ -70,7 +70,7 @@ NetworkInterface_d::NetworkInterface_d(int id, int virtual_networks,
for (int i = 0; i < m_num_vcs; i++) {
m_out_vc_state.push_back(new OutVcState_d(i, m_net_ptr));
- m_out_vc_state[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
+ m_out_vc_state[i]->setState(IDLE_, g_system_ptr->getTime());
}
}
@@ -169,11 +169,11 @@ NetworkInterface_d::flitisizeMessage(MsgPtr msg_ptr, int vnet)
for (int i = 0; i < num_flits; i++) {
m_net_ptr->increment_injected_flits(vnet);
flit_d *fl = new flit_d(i, vc, vnet, num_flits, new_msg_ptr);
- fl->set_delay(g_eventQueue_ptr->getTime() - msg_ptr->getTime());
+ fl->set_delay(g_system_ptr->getTime() - msg_ptr->getTime());
m_ni_buffers[vc]->insert(fl);
}
- m_ni_enqueue_time[vc] = g_eventQueue_ptr->getTime();
- m_out_vc_state[vc]->setState(ACTIVE_, g_eventQueue_ptr->getTime());
+ m_ni_enqueue_time[vc] = g_system_ptr->getTime();
+ m_out_vc_state[vc]->setState(ACTIVE_, g_system_ptr->getTime());
}
return true ;
}
@@ -189,7 +189,7 @@ NetworkInterface_d::calculateVC(int vnet)
m_vc_allocator[vnet] = 0;
if (m_out_vc_state[(vnet*m_vc_per_vnet) + delta]->isInState(
- IDLE_, g_eventQueue_ptr->getTime())) {
+ IDLE_, g_system_ptr->getTime())) {
return ((vnet*m_vc_per_vnet) + delta);
}
}
@@ -210,7 +210,7 @@ void
NetworkInterface_d::wakeup()
{
DPRINTF(RubyNetwork, "m_id: %d woke up at time: %lld",
- m_id, g_eventQueue_ptr->getTime());
+ m_id, g_system_ptr->getTime());
MsgPtr msg_ptr;
@@ -245,11 +245,11 @@ NetworkInterface_d::wakeup()
// this flit in the NI
flit_d *credit_flit = new flit_d(t_flit->get_vc(), free_signal);
creditQueue->insert(credit_flit);
- g_eventQueue_ptr->scheduleEvent(m_ni_credit_link, 1);
+ m_ni_credit_link->scheduleEvent(1);
int vnet = t_flit->get_vnet();
m_net_ptr->increment_received_flits(vnet);
- int network_delay = g_eventQueue_ptr->getTime() -
+ int network_delay = g_system_ptr->getTime() -
t_flit->get_enqueue_time();
int queueing_delay = t_flit->get_delay();
m_net_ptr->increment_network_latency(network_delay, vnet);
@@ -264,7 +264,7 @@ NetworkInterface_d::wakeup()
m_out_vc_state[t_flit->get_vc()]->increment_credit();
if (t_flit->is_free_signal()) {
m_out_vc_state[t_flit->get_vc()]->setState(IDLE_,
- g_eventQueue_ptr->getTime());
+ g_system_ptr->getTime());
}
delete t_flit;
}
@@ -313,10 +313,10 @@ NetworkInterface_d::scheduleOutputLink()
m_out_vc_state[vc]->decrement_credit();
// Just removing the flit
flit_d *t_flit = m_ni_buffers[vc]->getTopFlit();
- t_flit->set_time(g_eventQueue_ptr->getTime() + 1);
+ t_flit->set_time(g_system_ptr->getTime() + 1);
outSrcQueue->insert(t_flit);
// schedule the out link
- g_eventQueue_ptr->scheduleEvent(outNetLink, 1);
+ outNetLink->scheduleEvent(1);
if (t_flit->get_type() == TAIL_ ||
t_flit->get_type() == HEAD_TAIL_) {
@@ -343,13 +343,13 @@ NetworkInterface_d::checkReschedule()
{
for (int vnet = 0; vnet < m_virtual_networks; vnet++) {
if (inNode_ptr[vnet]->isReady()) { // Is there a message waiting
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ scheduleEvent(1);
return;
}
}
for (int vc = 0; vc < m_num_vcs; vc++) {
if (m_ni_buffers[vc]->isReadyForNext()) {
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ scheduleEvent(1);
return;
}
}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
index cc6ec6abf..ac41263e3 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc
@@ -68,9 +68,9 @@ NetworkLink_d::wakeup()
{
if (link_srcQueue->isReady()) {
flit_d *t_flit = link_srcQueue->getTopFlit();
- t_flit->set_time(g_eventQueue_ptr->getTime() + m_latency);
+ t_flit->set_time(g_system_ptr->getTime() + m_latency);
linkBuffer->insert(t_flit);
- g_eventQueue_ptr->scheduleEvent(link_consumer, m_latency);
+ link_consumer->scheduleEvent(m_latency);
m_link_utilized++;
m_vc_load[t_flit->get_vc()]++;
}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc
index 8a83fcca2..5aa60d754 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc
@@ -29,15 +29,15 @@
*/
#include "mem/ruby/common/Global.hh"
-#include "mem/ruby/eventqueue/RubyEventQueue.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh"
+#include "mem/ruby/system/System.hh"
OutVcState_d::OutVcState_d(int id, GarnetNetwork_d *network_ptr)
{
m_network_ptr = network_ptr;
m_id = id;
m_vc_state = IDLE_;
- m_time = g_eventQueue_ptr->getTime();
+ m_time = g_system_ptr->getTime();
if (m_network_ptr->get_vnet_type(id) == DATA_VNET_)
m_credit_count = m_network_ptr->getBuffersPerDataVC();
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc
index 159e02731..429ff4d91 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc
@@ -101,7 +101,7 @@ OutputUnit_d::set_credit_link(CreditLink_d *credit_link)
void
OutputUnit_d::update_vc(int vc, int in_port, int in_vc)
{
- m_outvc_state[vc]->setState(ACTIVE_, g_eventQueue_ptr->getTime() + 1);
+ m_outvc_state[vc]->setState(ACTIVE_, g_system_ptr->getTime() + 1);
m_outvc_state[vc]->set_inport(in_port);
m_outvc_state[vc]->set_invc(in_vc);
m_router->update_incredit(in_port, in_vc,
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh
index eada61554..750c71b32 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh
@@ -71,21 +71,21 @@ class OutputUnit_d : public Consumer
inline void
set_vc_state(VC_state_type state, int vc)
{
- m_outvc_state[vc]->setState(state, g_eventQueue_ptr->getTime() + 1);
+ m_outvc_state[vc]->setState(state, g_system_ptr->getTime() + 1);
}
inline bool
is_vc_idle(int vc)
{
return (m_outvc_state[vc]->isInState(IDLE_,
- g_eventQueue_ptr->getTime()));
+ g_system_ptr->getTime()));
}
inline void
insert_flit(flit_d *t_flit)
{
m_out_buffer->insert(t_flit);
- g_eventQueue_ptr->scheduleEvent(m_out_link, 1);
+ m_out_link->scheduleEvent(1);
}
private:
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc
index ce36dd753..2a759eb87 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc
@@ -135,13 +135,13 @@ Router_d::route_req(flit_d *t_flit, InputUnit_d *in_unit, int invc)
void
Router_d::vcarb_req()
{
- g_eventQueue_ptr->scheduleEvent(m_vc_alloc, 1);
+ m_vc_alloc->scheduleEvent(1);
}
void
Router_d::swarb_req()
{
- g_eventQueue_ptr->scheduleEvent(m_sw_alloc, 1);
+ m_sw_alloc->scheduleEvent(1);
}
void
@@ -154,7 +154,7 @@ void
Router_d::update_sw_winner(int inport, flit_d *t_flit)
{
m_switch->update_sw_winner(inport, t_flit);
- g_eventQueue_ptr->scheduleEvent(m_switch, 1);
+ m_switch->scheduleEvent(1);
}
void
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc
index afed4b205..530e8f1b2 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc
@@ -177,7 +177,7 @@ SWallocator_d::arbitrate_outports()
t_flit->advance_stage(ST_);
t_flit->set_vc(outvc);
t_flit->set_outport(outport);
- t_flit->set_time(g_eventQueue_ptr->getTime() + 1);
+ t_flit->set_time(g_system_ptr->getTime() + 1);
m_output_unit[outport]->decrement_credit(outvc);
m_router->update_sw_winner(inport, t_flit);
m_global_arbiter_activity++;
@@ -209,7 +209,7 @@ SWallocator_d::check_for_wakeup()
for (int i = 0; i < m_num_inports; i++) {
for (int j = 0; j < m_num_vcs; j++) {
if (m_input_unit[i]->need_stage_nextcycle(j, ACTIVE_, SA_)) {
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ scheduleEvent(1);
return;
}
}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
index c656b43cc..12c00d9d0 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
@@ -64,7 +64,7 @@ void
Switch_d::wakeup()
{
DPRINTF(RubyNetwork, "Switch woke up at time: %lld\n",
- g_eventQueue_ptr->getTime());
+ g_system_ptr->getTime());
for (int inport = 0; inport < m_num_inports; inport++) {
if (!m_switch_buffer[inport]->isReady())
@@ -73,7 +73,7 @@ Switch_d::wakeup()
if (t_flit->is_stage(ST_)) {
int outport = t_flit->get_outport();
t_flit->advance_stage(LT_);
- t_flit->set_time(g_eventQueue_ptr->getTime() + 1);
+ t_flit->set_time(g_system_ptr->getTime() + 1);
// This will take care of waking up the Network Link
m_output_unit[outport]->insert_flit(t_flit);
@@ -89,7 +89,7 @@ Switch_d::check_for_wakeup()
{
for (int inport = 0; inport < m_num_inports; inport++) {
if (m_switch_buffer[inport]->isReadyForNext()) {
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ scheduleEvent(1);
break;
}
}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc
index 03eed6ce2..3940e1d6a 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc
@@ -256,7 +256,7 @@ VCallocator_d::check_for_wakeup()
for (int i = 0; i < m_num_inports; i++) {
for (int j = 0; j < m_num_vcs; j++) {
if (m_input_unit[i]->need_stage_nextcycle(j, VC_AB_, VA_)) {
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ scheduleEvent(1);
return;
}
}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc
index a36e58771..96d873009 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc
@@ -35,7 +35,7 @@ VirtualChannel_d::VirtualChannel_d(int id)
m_id = id;
m_input_buffer = new flitBuffer_d();
m_vc_state.first = IDLE_;
- m_vc_state.second = g_eventQueue_ptr->getTime();
+ m_vc_state.second = g_system_ptr->getTime();
m_enqueue_time = INFINITE_;
}
@@ -55,7 +55,7 @@ VirtualChannel_d::grant_vc(int out_vc)
{
m_output_vc = out_vc;
m_vc_state.first = ACTIVE_;
- m_vc_state.second = g_eventQueue_ptr->getTime() + 1;
+ m_vc_state.second = g_system_ptr->getTime() + 1;
flit_d *t_flit = m_input_buffer->peekTopFlit();
t_flit->advance_stage(SA_);
}
@@ -64,7 +64,7 @@ bool
VirtualChannel_d::need_stage(VC_state_type state, flit_stage stage)
{
if ((m_vc_state.first == state) &&
- (g_eventQueue_ptr->getTime() >= m_vc_state.second)) {
+ (g_system_ptr->getTime() >= m_vc_state.second)) {
if (m_input_buffer->isReady()) {
flit_d *t_flit = m_input_buffer->peekTopFlit();
return(t_flit->is_stage(stage)) ;
@@ -78,7 +78,7 @@ bool
VirtualChannel_d::need_stage_nextcycle(VC_state_type state, flit_stage stage)
{
if ((m_vc_state.first == state) &&
- ((g_eventQueue_ptr->getTime()+1) >= m_vc_state.second)) {
+ ((g_system_ptr->getTime()+1) >= m_vc_state.second)) {
if (m_input_buffer->isReadyForNext()) {
flit_d *t_flit = m_input_buffer->peekTopFlit();
return(t_flit->is_next_stage(stage)) ;
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh
index 3f5c02f84..18553fe2b 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh
@@ -68,7 +68,7 @@ class VirtualChannel_d
set_state(VC_state_type m_state)
{
m_vc_state.first = m_state;
- m_vc_state.second = g_eventQueue_ptr->getTime() + 1;
+ m_vc_state.second = g_system_ptr->getTime() + 1;
}
inline flit_d*
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc
index bba917597..2c4f4e09e 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc
@@ -51,7 +51,7 @@ flitBuffer_d::isReady()
{
if (m_buffer.size() != 0 ) {
flit_d *t_flit = peekTopFlit();
- if (t_flit->get_time() <= g_eventQueue_ptr->getTime())
+ if (t_flit->get_time() <= g_system_ptr->getTime())
return true;
}
return false;
@@ -62,7 +62,7 @@ flitBuffer_d::isReadyForNext()
{
if (m_buffer.size() != 0 ) {
flit_d *t_flit = peekTopFlit();
- if (t_flit->get_time() <= (g_eventQueue_ptr->getTime() + 1))
+ if (t_flit->get_time() <= (g_system_ptr->getTime() + 1))
return true;
}
return false;
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc
index 774b1bc62..93364348e 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc
@@ -34,8 +34,8 @@ flit_d::flit_d(int id, int vc, int vnet, int size, MsgPtr msg_ptr)
{
m_size = size;
m_msg_ptr = msg_ptr;
- m_enqueue_time = g_eventQueue_ptr->getTime();
- m_time = g_eventQueue_ptr->getTime();
+ m_enqueue_time = g_system_ptr->getTime();
+ m_time = g_system_ptr->getTime();
m_id = id;
m_vnet = vnet;
m_vc = vc;
@@ -59,7 +59,7 @@ flit_d::flit_d(int vc, bool is_free_signal)
m_id = 0;
m_vc = vc;
m_is_free_signal = is_free_signal;
- m_time = g_eventQueue_ptr->getTime();
+ m_time = g_system_ptr->getTime();
}
void
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh
index f928e04f6..4295cbf6b 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh
@@ -61,21 +61,21 @@ class flit_d
is_stage(flit_stage t_stage)
{
return (m_stage.first == t_stage &&
- g_eventQueue_ptr->getTime() >= m_stage.second);
+ g_system_ptr->getTime() >= m_stage.second);
}
bool
is_next_stage(flit_stage t_stage)
{
return (m_stage.first == t_stage &&
- (g_eventQueue_ptr->getTime() + 1) >= m_stage.second);
+ (g_system_ptr->getTime() + 1) >= m_stage.second);
}
void
advance_stage(flit_stage t_stage)
{
m_stage.first = t_stage;
- m_stage.second = g_eventQueue_ptr->getTime() + 1;
+ m_stage.second = g_system_ptr->getTime() + 1;
}
std::pair<flit_stage, Time>
get_stage()
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
index a167f5df0..e8aca533a 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
@@ -207,7 +207,7 @@ GarnetNetwork::printLinkStats(ostream& out) const
for (int i = 0; i < m_link_ptr_vector.size(); i++) {
average_link_utilization +=
(double(m_link_ptr_vector[i]->getLinkUtilization())) /
- (double(g_eventQueue_ptr->getTime()-m_ruby_start));
+ (double(g_system_ptr->getTime()-m_ruby_start));
vector<int> vc_load = m_link_ptr_vector[i]->getVcLoad();
for (int j = 0; j < vc_load.size(); j++) {
@@ -226,7 +226,7 @@ GarnetNetwork::printLinkStats(ostream& out) const
continue;
average_vc_load[i] = (double(average_vc_load[i]) /
- (double(g_eventQueue_ptr->getTime()) - m_ruby_start));
+ (double(g_system_ptr->getTime()) - m_ruby_start));
out << "Average VC Load [" << i << "] = " << average_vc_load[i]
<< " flits/cycle " << endl;
}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
index 73425802b..cc7dd7146 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
@@ -67,7 +67,7 @@ NetworkInterface::NetworkInterface(int id, int virtual_networks,
for (int i = 0; i < m_num_vcs; i++) {
m_out_vc_state.push_back(new OutVcState(i));
- m_out_vc_state[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
+ m_out_vc_state[i]->setState(IDLE_, g_system_ptr->getTime());
}
}
@@ -166,18 +166,18 @@ NetworkInterface::flitisizeMessage(MsgPtr msg_ptr, int vnet)
for (int i = 0; i < num_flits; i++) {
m_net_ptr->increment_injected_flits(vnet);
flit *fl = new flit(i, vc, vnet, num_flits, new_msg_ptr);
- fl->set_delay(g_eventQueue_ptr->getTime() - msg_ptr->getTime());
+ fl->set_delay(g_system_ptr->getTime() - msg_ptr->getTime());
m_ni_buffers[vc]->insert(fl);
}
- m_out_vc_state[vc]->setState(VC_AB_, g_eventQueue_ptr->getTime());
+ m_out_vc_state[vc]->setState(VC_AB_, g_system_ptr->getTime());
// setting an output vc request for the next hop.
// This flit will be ready to traverse the link and into the next hop
// only when an output vc is acquired at the next hop
outNetLink->request_vc_link(vc,
new_net_msg_ptr->getInternalDestination(),
- g_eventQueue_ptr->getTime());
+ g_system_ptr->getTime());
}
return true ;
@@ -190,7 +190,7 @@ NetworkInterface::grant_vc(int out_port, int vc, Time grant_time)
{
assert(m_out_vc_state[vc]->isInState(VC_AB_, grant_time));
m_out_vc_state[vc]->grant_vc(grant_time);
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ scheduleEvent(1);
}
// The tail flit corresponding to this vc has been buffered at the next hop
@@ -200,7 +200,7 @@ NetworkInterface::release_vc(int out_port, int vc, Time release_time)
{
assert(m_out_vc_state[vc]->isInState(ACTIVE_, release_time));
m_out_vc_state[vc]->setState(IDLE_, release_time);
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ scheduleEvent(1);
}
// Looking for a free output vc
@@ -220,7 +220,7 @@ NetworkInterface::calculateVC(int vnet)
m_vc_allocator[vnet] = 0;
if (m_out_vc_state[(vnet*m_vc_per_vnet) + delta]->isInState(IDLE_,
- g_eventQueue_ptr->getTime())) {
+ g_system_ptr->getTime())) {
return ((vnet*m_vc_per_vnet) + delta);
}
}
@@ -264,18 +264,18 @@ NetworkInterface::wakeup()
flit *t_flit = inNetLink->consumeLink();
if (t_flit->get_type() == TAIL_ || t_flit->get_type() == HEAD_TAIL_) {
DPRINTF(RubyNetwork, "m_id: %d, Message delivered at time: %lld\n",
- m_id, g_eventQueue_ptr->getTime());
+ m_id, g_system_ptr->getTime());
outNode_ptr[t_flit->get_vnet()]->enqueue(
t_flit->get_msg_ptr(), 1);
// signal the upstream router that this vc can be freed now
inNetLink->release_vc_link(t_flit->get_vc(),
- g_eventQueue_ptr->getTime() + 1);
+ g_system_ptr->getTime() + 1);
}
int vnet = t_flit->get_vnet();
m_net_ptr->increment_received_flits(vnet);
- int network_delay = g_eventQueue_ptr->getTime() -
+ int network_delay = g_system_ptr->getTime() -
t_flit->get_enqueue_time();
int queueing_delay = t_flit->get_delay();
m_net_ptr->increment_network_latency(network_delay, vnet);
@@ -304,16 +304,16 @@ NetworkInterface::scheduleOutputLink()
vc = 0;
if (m_ni_buffers[vc]->isReady()) {
if (m_out_vc_state[vc]->isInState(ACTIVE_,
- g_eventQueue_ptr->getTime()) &&
+ g_system_ptr->getTime()) &&
outNetLink->isBufferNotFull_link(vc)) { // buffer backpressure
// Just removing the flit
flit *t_flit = m_ni_buffers[vc]->getTopFlit();
- t_flit->set_time(g_eventQueue_ptr->getTime() + 1);
+ t_flit->set_time(g_system_ptr->getTime() + 1);
outSrcQueue->insert(t_flit);
// schedule the out link
- g_eventQueue_ptr->scheduleEvent(outNetLink, 1);
+ outNetLink->scheduleEvent(1);
return;
}
}
@@ -325,13 +325,13 @@ NetworkInterface::checkReschedule()
{
for (int vnet = 0; vnet < m_virtual_networks; vnet++) {
if (inNode_ptr[vnet]->isReady()) { // Is there a message waiting
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ scheduleEvent(1);
return;
}
}
for (int vc = 0; vc < m_num_vcs; vc++) {
if (m_ni_buffers[vc]->isReadyForNext()) {
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ scheduleEvent(1);
return;
}
}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
index 7da87e077..fb7c9bd44 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc
@@ -138,9 +138,9 @@ NetworkLink::wakeup()
return;
flit *t_flit = link_srcQueue->getTopFlit();
- t_flit->set_time(g_eventQueue_ptr->getTime() + m_latency);
+ t_flit->set_time(g_system_ptr->getTime() + m_latency);
linkBuffer->insert(t_flit);
- g_eventQueue_ptr->scheduleEvent(link_consumer, m_latency);
+ link_consumer->scheduleEvent(this, m_latency);
m_link_utilized++;
m_vc_load[t_flit->get_vc()]++;
}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
index 791c0cffc..28e9fc497 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
@@ -72,7 +72,7 @@ Router::addInPort(NetworkLink *in_link)
vector<InVcState *> in_vc_vector;
for (int i = 0; i < m_num_vcs; i++) {
in_vc_vector.push_back(new InVcState(i));
- in_vc_vector[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
+ in_vc_vector[i]->setState(IDLE_, g_system_ptr->getTime());
}
m_in_vc_state.push_back(in_vc_vector);
m_in_link.push_back(in_link);
@@ -112,7 +112,7 @@ Router::addOutPort(NetworkLink *out_link, const NetDest& routing_table_entry,
vector<OutVcState *> out_vc_vector;
for (int i = 0; i < m_num_vcs; i++) {
out_vc_vector.push_back(new OutVcState(i));
- out_vc_vector[i]->setState(IDLE_, g_eventQueue_ptr->getTime());
+ out_vc_vector[i]->setState(IDLE_, g_system_ptr->getTime());
}
m_out_vc_state.push_back(out_vc_vector);
m_link_weights.push_back(link_weight);
@@ -138,9 +138,9 @@ Router::request_vc(int in_vc, int in_port, NetDest destination,
int outport = getRoute(destination);
m_in_vc_state[in_port][in_vc]->setRoute(outport);
m_in_vc_state[in_port][in_vc]->setState(VC_AB_, request_time);
- assert(request_time >= g_eventQueue_ptr->getTime());
- if (request_time > g_eventQueue_ptr->getTime())
- g_eventQueue_ptr->scheduleEventAbsolute(m_vc_arbiter, request_time);
+ assert(request_time >= g_system_ptr->getTime());
+ if (request_time > g_system_ptr->getTime())
+ m_vc_arbiter->scheduleEventAbsolute(request_time);
else
vc_arbitrate();
}
@@ -181,22 +181,22 @@ Router::vc_arbitrate()
InVcState *in_vc_state = m_in_vc_state[inport][invc];
- if (in_vc_state->isInState(VC_AB_, g_eventQueue_ptr->getTime())) {
+ if (in_vc_state->isInState(VC_AB_, g_system_ptr->getTime())) {
int outport = in_vc_state->get_outport();
vector<int> valid_vcs = get_valid_vcs(invc);
for (int valid_vc_iter = 0; valid_vc_iter < valid_vcs.size();
valid_vc_iter++) {
if (m_out_vc_state[outport][valid_vcs[valid_vc_iter]]
- ->isInState(IDLE_, g_eventQueue_ptr->getTime())) {
+ ->isInState(IDLE_, g_system_ptr->getTime())) {
in_vc_state->grant_vc(valid_vcs[valid_vc_iter],
- g_eventQueue_ptr->getTime());
+ g_system_ptr->getTime());
m_in_link[inport]->grant_vc_link(invc,
- g_eventQueue_ptr->getTime());
+ g_system_ptr->getTime());
m_out_vc_state[outport][valid_vcs[valid_vc_iter]]
- ->setState(VC_AB_, g_eventQueue_ptr->getTime());
+ ->setState(VC_AB_, g_system_ptr->getTime());
break;
}
}
@@ -233,7 +233,7 @@ Router::grant_vc(int out_port, int vc, Time grant_time)
{
assert(m_out_vc_state[out_port][vc]->isInState(VC_AB_, grant_time));
m_out_vc_state[out_port][vc]->grant_vc(grant_time);
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ scheduleEvent(1);
}
void
@@ -241,7 +241,7 @@ Router::release_vc(int out_port, int vc, Time release_time)
{
assert(m_out_vc_state[out_port][vc]->isInState(ACTIVE_, release_time));
m_out_vc_state[out_port][vc]->setState(IDLE_, release_time);
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ scheduleEvent(1);
}
// This function calculated the output port for a particular destination.
@@ -271,14 +271,13 @@ Router::routeCompute(flit *m_flit, int inport)
assert(m_net_ptr->getNumPipeStages() >= 1);
// Subtract 1 as 1 cycle will be consumed in scheduling the output link
- m_flit->set_time(g_eventQueue_ptr->getTime() +
+ m_flit->set_time(g_system_ptr->getTime() +
(m_net_ptr->getNumPipeStages() - 1));
m_flit->set_vc(outvc);
m_router_buffers[outport][outvc]->insert(m_flit);
if (m_net_ptr->getNumPipeStages() > 1)
- g_eventQueue_ptr->scheduleEvent(this,
- m_net_ptr->getNumPipeStages() - 1 );
+ scheduleEvent(m_net_ptr->getNumPipeStages() - 1 );
if ((m_flit->get_type() == HEAD_) || (m_flit->get_type() == HEAD_TAIL_)) {
NetworkMessage *nm =
safe_cast<NetworkMessage*>(m_flit->get_msg_ptr().get());
@@ -286,24 +285,24 @@ Router::routeCompute(flit *m_flit, int inport)
if (m_net_ptr->getNumPipeStages() > 1) {
m_out_vc_state[outport][outvc]->setState(VC_AB_,
- g_eventQueue_ptr->getTime() + 1);
+ g_system_ptr->getTime() + 1);
m_out_link[outport]->request_vc_link(outvc, destination,
- g_eventQueue_ptr->getTime() + 1);
+ g_system_ptr->getTime() + 1);
} else {
m_out_vc_state[outport][outvc]->setState(VC_AB_,
- g_eventQueue_ptr->getTime());
+ g_system_ptr->getTime());
m_out_link[outport]->request_vc_link(outvc, destination,
- g_eventQueue_ptr->getTime());
+ g_system_ptr->getTime());
}
}
if ((m_flit->get_type() == TAIL_) || (m_flit->get_type() == HEAD_TAIL_)) {
m_in_vc_state[inport][invc]->setState(IDLE_,
- g_eventQueue_ptr->getTime() + 1);
+ g_system_ptr->getTime() + 1);
m_in_link[inport]->release_vc_link(invc,
- g_eventQueue_ptr->getTime() + 1);
+ g_system_ptr->getTime() + 1);
}
}
@@ -328,7 +327,7 @@ Router::wakeup()
// checking the incoming link
if (m_in_link[incoming_port]->isReady()) {
DPRINTF(RubyNetwork, "m_id: %d, Time: %lld\n",
- m_id, g_eventQueue_ptr->getTime());
+ m_id, g_system_ptr->getTime());
t_flit = m_in_link[incoming_port]->peekLink();
routeCompute(t_flit, incoming_port);
m_in_link[incoming_port]->consumeLink();
@@ -366,14 +365,14 @@ Router::scheduleOutputLinks()
// models buffer backpressure
if (m_out_vc_state[port][vc_tolookat]->isInState(ACTIVE_,
- g_eventQueue_ptr->getTime()) &&
+ g_system_ptr->getTime()) &&
m_out_link[port]->isBufferNotFull_link(vc_tolookat)) {
flit *t_flit =
m_router_buffers[port][vc_tolookat]->getTopFlit();
- t_flit->set_time(g_eventQueue_ptr->getTime() + 1 );
+ t_flit->set_time(g_system_ptr->getTime() + 1 );
m_out_src_queue[port]->insert(t_flit);
- g_eventQueue_ptr->scheduleEvent(m_out_link[port], 1);
+ m_out_link[port]->scheduleEvent(1);
break; // done for this port
}
}
@@ -395,7 +394,7 @@ Router::checkReschedule()
for (int port = 0; port < m_out_link.size(); port++) {
for (int vc = 0; vc < m_num_vcs; vc++) {
if (m_router_buffers[port][vc]->isReadyForNext()) {
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ scheduleEvent(1);
return;
}
}
@@ -408,9 +407,9 @@ Router::check_arbiter_reschedule()
for (int port = 0; port < m_in_link.size(); port++) {
for (int vc = 0; vc < m_num_vcs; vc++) {
if (m_in_vc_state[port][vc]->isInState(VC_AB_,
- g_eventQueue_ptr->getTime() + 1)) {
+ g_system_ptr->getTime() + 1)) {
- g_eventQueue_ptr->scheduleEvent(m_vc_arbiter, 1);
+ m_vc_arbiter->scheduleEvent(1);
return;
}
}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc b/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
index 2f5944c62..80b93172a 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
@@ -34,8 +34,8 @@ flit::flit(int id, int vc, int vnet, int size, MsgPtr msg_ptr)
{
m_size = size;
m_msg_ptr = msg_ptr;
- m_enqueue_time = g_eventQueue_ptr->getTime();
- m_time = g_eventQueue_ptr->getTime();
+ m_enqueue_time = g_system_ptr->getTime();
+ m_time = g_system_ptr->getTime();
m_id = id;
m_vnet = vnet;
m_vc = vc;
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc
index 2bb297e03..7fed60762 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flitBuffer.cc
@@ -55,7 +55,7 @@ flitBuffer::isReady()
{
if (m_buffer.size() != 0 ) {
flit *t_flit = m_buffer.front();
- if (t_flit->get_time() <= g_eventQueue_ptr->getTime())
+ if (t_flit->get_time() <= g_system_ptr->getTime())
return true;
}
return false;
@@ -66,7 +66,7 @@ flitBuffer::isReadyForNext()
{
if (m_buffer.size() != 0 ) {
flit *t_flit = m_buffer.front();
- if (t_flit->get_time() <= (g_eventQueue_ptr->getTime() + 1))
+ if (t_flit->get_time() <= (g_system_ptr->getTime() + 1))
return true;
}
return false;
diff --git a/src/mem/ruby/network/orion/NetworkPower.cc b/src/mem/ruby/network/orion/NetworkPower.cc
index 7c9634e56..9ac0dd815 100644
--- a/src/mem/ruby/network/orion/NetworkPower.cc
+++ b/src/mem/ruby/network/orion/NetworkPower.cc
@@ -41,7 +41,7 @@ Router_d::calculate_power()
calculate_performance_numbers();
double sim_cycles;
sim_cycles =
- g_eventQueue_ptr->getTime() - m_network_ptr->getRubyStartTime();
+ g_system_ptr->getTime() - m_network_ptr->getRubyStartTime();
// Number of virtual networks/message classes declared in Ruby
// maybe greater than active virtual networks.
@@ -248,7 +248,7 @@ NetworkLink_d::calculate_power()
orion_cfg_ptr);
double sim_cycles =
- (double)(g_eventQueue_ptr->getTime() - m_net_ptr->getRubyStartTime());
+ (double)(g_system_ptr->getTime() - m_net_ptr->getRubyStartTime());
// Dynamic Power
// Assume half the bits flipped on every link activity
diff --git a/src/mem/ruby/network/simple/PerfectSwitch.cc b/src/mem/ruby/network/simple/PerfectSwitch.cc
index 50b2055b5..66065e22c 100644
--- a/src/mem/ruby/network/simple/PerfectSwitch.cc
+++ b/src/mem/ruby/network/simple/PerfectSwitch.cc
@@ -260,7 +260,7 @@ PerfectSwitch::wakeup()
// There were not enough resources
if (!enough) {
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ scheduleEvent(1);
DPRINTF(RubyNetwork, "Can't deliver message since a node "
"is blocked\n");
DPRINTF(RubyNetwork, "Message: %s\n", (*net_msg_ptr));
diff --git a/src/mem/ruby/network/simple/Throttle.cc b/src/mem/ruby/network/simple/Throttle.cc
index 7936e71dc..05dfc2553 100644
--- a/src/mem/ruby/network/simple/Throttle.cc
+++ b/src/mem/ruby/network/simple/Throttle.cc
@@ -167,7 +167,7 @@ Throttle::wakeup()
DPRINTF(RubyNetwork, "throttle: %d my bw %d bw spent "
"enqueueing net msg %d time: %lld.\n",
m_node, getLinkBandwidth(), m_units_remaining[vnet],
- g_eventQueue_ptr->getTime());
+ g_system_ptr->getTime());
// Move the message
m_out[vnet]->enqueue(m_in[vnet]->peekMsgPtr(), m_link_latency);
@@ -215,7 +215,7 @@ Throttle::wakeup()
// We are out of bandwidth for this cycle, so wakeup next
// cycle and continue
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ scheduleEvent(1);
}
}
@@ -228,7 +228,7 @@ Throttle::printStats(ostream& out) const
void
Throttle::clearStats()
{
- m_ruby_start = g_eventQueue_ptr->getTime();
+ m_ruby_start = g_system_ptr->getTime();
m_links_utilized = 0.0;
for (int i = 0; i < m_message_counters.size(); i++) {
@@ -242,7 +242,7 @@ double
Throttle::getUtilization() const
{
return 100.0 * double(m_links_utilized) /
- double(g_eventQueue_ptr->getTime()-m_ruby_start);
+ double(g_system_ptr->getTime()-m_ruby_start);
}
void
diff --git a/src/mem/ruby/profiler/Profiler.cc b/src/mem/ruby/profiler/Profiler.cc
index c3c337a3c..2ab68d249 100644
--- a/src/mem/ruby/profiler/Profiler.cc
+++ b/src/mem/ruby/profiler/Profiler.cc
@@ -67,7 +67,7 @@ static double process_memory_total();
static double process_memory_resident();
Profiler::Profiler(const Params *p)
- : SimObject(p)
+ : SimObject(p), m_event(this)
{
m_inst_profiler_ptr = NULL;
m_address_profiler_ptr = NULL;
@@ -113,13 +113,13 @@ Profiler::wakeup()
for (int i = 0; i < m_num_of_sequencers; i++) {
perProcCycleCount[i] =
- g_system_ptr->getCycleCount(i) - m_cycles_executed_at_start[i] + 1;
+ g_system_ptr->getTime() - m_cycles_executed_at_start[i] + 1;
// The +1 allows us to avoid division by zero
}
ostream &out = *m_periodic_output_file_ptr;
- out << "ruby_cycles: " << g_eventQueue_ptr->getTime()-m_ruby_start << endl
+ out << "ruby_cycles: " << g_system_ptr->getTime()-m_ruby_start << endl
<< "mbytes_resident: " << process_memory_resident() << endl
<< "mbytes_total: " << process_memory_total() << endl;
@@ -137,7 +137,7 @@ Profiler::wakeup()
}
//g_system_ptr->getNetwork()->printStats(out);
- g_eventQueue_ptr->scheduleEvent(this, m_stats_period);
+ schedule(m_event, curTick() + m_stats_period * g_system_ptr->getClock());
}
void
@@ -151,7 +151,7 @@ Profiler::setPeriodicStatsFile(const string& filename)
}
m_periodic_output_file_ptr = new ofstream(filename.c_str());
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ schedule(m_event, curTick() + g_system_ptr->getClock());
}
void
@@ -161,7 +161,7 @@ Profiler::setPeriodicStatsInterval(integer_t period)
<< " Ruby cycles" << endl;
m_stats_period = period;
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ schedule(m_event, curTick() + g_system_ptr->getClock());
}
void
@@ -185,7 +185,7 @@ Profiler::printStats(ostream& out, bool short_stats)
double minutes = seconds / 60.0;
double hours = minutes / 60.0;
double days = hours / 24.0;
- Time ruby_cycles = g_eventQueue_ptr->getTime()-m_ruby_start;
+ Time ruby_cycles = g_system_ptr->getTime()-m_ruby_start;
if (!short_stats) {
out << "Elapsed_time_in_seconds: " << seconds << endl;
@@ -208,7 +208,7 @@ Profiler::printStats(ostream& out, bool short_stats)
out << "Virtual_time_in_days: " << days << endl;
out << endl;
- out << "Ruby_current_time: " << g_eventQueue_ptr->getTime() << endl;
+ out << "Ruby_current_time: " << g_system_ptr->getTime() << endl;
out << "Ruby_start_time: " << m_ruby_start << endl;
out << "Ruby_cycles: " << ruby_cycles << endl;
out << endl;
@@ -227,7 +227,7 @@ Profiler::printStats(ostream& out, bool short_stats)
for (int i = 0; i < m_num_of_sequencers; i++) {
perProcCycleCount[i] =
- g_system_ptr->getCycleCount(i) - m_cycles_executed_at_start[i] + 1;
+ g_system_ptr->getTime() - m_cycles_executed_at_start[i] + 1;
// The +1 allows us to avoid division by zero
}
@@ -437,14 +437,14 @@ Profiler::printResourceUsage(ostream& out) const
void
Profiler::clearStats()
{
- m_ruby_start = g_eventQueue_ptr->getTime();
+ m_ruby_start = g_system_ptr->getTime();
m_cycles_executed_at_start.resize(m_num_of_sequencers);
for (int i = 0; i < m_num_of_sequencers; i++) {
if (g_system_ptr == NULL) {
m_cycles_executed_at_start[i] = 0;
} else {
- m_cycles_executed_at_start[i] = g_system_ptr->getCycleCount(i);
+ m_cycles_executed_at_start[i] = g_system_ptr->getTime();
}
}
@@ -524,7 +524,7 @@ Profiler::clearStats()
//g_eventQueue_ptr->triggerAllEvents();
// update the start time
- m_ruby_start = g_eventQueue_ptr->getTime();
+ m_ruby_start = g_system_ptr->getTime();
}
void
@@ -723,7 +723,7 @@ Profiler::rubyWatch(int id)
uint64 tr = 0;
Address watch_address = Address(tr);
- DPRINTFN("%7s %3s RUBY WATCH %d\n", g_eventQueue_ptr->getTime(), id,
+ DPRINTFN("%7s %3s RUBY WATCH %d\n", g_system_ptr->getTime(), id,
watch_address);
// don't care about success or failure
diff --git a/src/mem/ruby/profiler/Profiler.hh b/src/mem/ruby/profiler/Profiler.hh
index 7945b6c73..58043dfaf 100644
--- a/src/mem/ruby/profiler/Profiler.hh
+++ b/src/mem/ruby/profiler/Profiler.hh
@@ -58,7 +58,6 @@
#include "mem/protocol/RubyAccessMode.hh"
#include "mem/protocol/RubyRequestType.hh"
#include "mem/ruby/common/Address.hh"
-#include "mem/ruby/common/Consumer.hh"
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/common/Histogram.hh"
#include "mem/ruby/common/Set.hh"
@@ -70,7 +69,7 @@
class RubyRequest;
class AddressProfiler;
-class Profiler : public SimObject, public Consumer
+class Profiler : public SimObject
{
public:
typedef RubyProfilerParams Params;
@@ -244,6 +243,20 @@ class Profiler : public SimObject, public Consumer
bool m_all_instructions;
int m_num_of_sequencers;
+
+ protected:
+ class ProfileEvent : public Event
+ {
+ public:
+ ProfileEvent(Profiler *_profiler)
+ {
+ profiler = _profiler;
+ }
+ private:
+ void process() { profiler->wakeup(); }
+ Profiler *profiler;
+ };
+ ProfileEvent m_event;
};
inline std::ostream&
@@ -255,5 +268,3 @@ operator<<(std::ostream& out, const Profiler& obj)
}
#endif // __MEM_RUBY_PROFILER_PROFILER_HH__
-
-
diff --git a/src/mem/ruby/profiler/StoreTrace.cc b/src/mem/ruby/profiler/StoreTrace.cc
index bcd90ab9d..84b05ea86 100644
--- a/src/mem/ruby/profiler/StoreTrace.cc
+++ b/src/mem/ruby/profiler/StoreTrace.cc
@@ -26,8 +26,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "mem/ruby/eventqueue/RubyEventQueue.hh"
#include "mem/ruby/profiler/StoreTrace.hh"
+#include "sim/core.hh"
using namespace std;
@@ -105,7 +105,7 @@ StoreTrace::clearSummary()
void
StoreTrace::store(NodeID node)
{
- Time current = g_eventQueue_ptr->getTime();
+ Tick current = curTick();
assert((m_last_writer == -1) || (m_last_writer == node));
@@ -127,7 +127,7 @@ void
StoreTrace::downgrade(NodeID node)
{
if (node == m_last_writer) {
- Time current = g_eventQueue_ptr->getTime();
+ Time current = curTick();
assert(m_stores_this_interval != 0);
assert(m_last_store != 0);
assert(m_first_store != 0);
diff --git a/src/mem/ruby/profiler/StoreTrace.hh b/src/mem/ruby/profiler/StoreTrace.hh
index 9c0945c15..293871723 100644
--- a/src/mem/ruby/profiler/StoreTrace.hh
+++ b/src/mem/ruby/profiler/StoreTrace.hh
@@ -32,7 +32,6 @@
#include <iostream>
#include "mem/ruby/common/Address.hh"
-#include "mem/ruby/common/Global.hh"
#include "mem/ruby/common/Histogram.hh"
class StoreTrace
diff --git a/src/mem/ruby/slicc_interface/Message.hh b/src/mem/ruby/slicc_interface/Message.hh
index c57857adb..48156a99a 100644
--- a/src/mem/ruby/slicc_interface/Message.hh
+++ b/src/mem/ruby/slicc_interface/Message.hh
@@ -34,7 +34,7 @@
#include "base/refcnt.hh"
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/common/TypeDefines.hh"
-#include "mem/ruby/eventqueue/RubyEventQueue.hh"
+#include "mem/ruby/system/System.hh"
class Message;
typedef RefCountingPtr<Message> MsgPtr;
@@ -43,8 +43,8 @@ class Message : public RefCounted
{
public:
Message()
- : m_time(g_eventQueue_ptr->getTime()),
- m_LastEnqueueTime(g_eventQueue_ptr->getTime()),
+ : m_time(g_system_ptr->getTime()),
+ m_LastEnqueueTime(g_system_ptr->getTime()),
m_DelayedCycles(0)
{ }
diff --git a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh
index b8fd46dd0..06372c9fc 100644
--- a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh
+++ b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh
@@ -49,7 +49,7 @@ random(int n)
inline Time
get_time()
{
- return g_eventQueue_ptr->getTime();
+ return g_system_ptr->getTime();
}
inline Time
diff --git a/src/mem/ruby/system/CacheMemory.cc b/src/mem/ruby/system/CacheMemory.cc
index 6ba879e90..81d73f5b4 100644
--- a/src/mem/ruby/system/CacheMemory.cc
+++ b/src/mem/ruby/system/CacheMemory.cc
@@ -154,8 +154,7 @@ CacheMemory::tryCacheAccess(const Address& address, RubyRequestType type,
if (loc != -1) {
// Do we even have a tag match?
AbstractCacheEntry* entry = m_cache[cacheSet][loc];
- m_replacementPolicy_ptr->
- touch(cacheSet, loc, g_eventQueue_ptr->getTime());
+ m_replacementPolicy_ptr->touch(cacheSet, loc, curTick());
data_ptr = &(entry->getDataBlk());
if (entry->m_Permission == AccessPermission_Read_Write) {
@@ -183,8 +182,7 @@ CacheMemory::testCacheAccess(const Address& address, RubyRequestType type,
if (loc != -1) {
// Do we even have a tag match?
AbstractCacheEntry* entry = m_cache[cacheSet][loc];
- m_replacementPolicy_ptr->
- touch(cacheSet, loc, g_eventQueue_ptr->getTime());
+ m_replacementPolicy_ptr->touch(cacheSet, loc, curTick());
data_ptr = &(entry->getDataBlk());
return m_cache[cacheSet][loc]->m_Permission !=
@@ -258,8 +256,7 @@ CacheMemory::allocate(const Address& address, AbstractCacheEntry* entry)
set[i]->m_locked = -1;
m_tag_index[address] = i;
- m_replacementPolicy_ptr->
- touch(cacheSet, i, g_eventQueue_ptr->getTime());
+ m_replacementPolicy_ptr->touch(cacheSet, i, curTick());
return entry;
}
@@ -324,8 +321,7 @@ CacheMemory::setMRU(const Address& address)
int loc = findTagInSet(cacheSet, address);
if(loc != -1)
- m_replacementPolicy_ptr->
- touch(cacheSet, loc, g_eventQueue_ptr->getTime());
+ m_replacementPolicy_ptr->touch(cacheSet, loc, curTick());
}
void
@@ -540,4 +536,3 @@ CacheMemory::checkResourceAvailable(CacheResourceType res, Address addr)
return true;
}
}
-
diff --git a/src/mem/ruby/system/CacheMemory.hh b/src/mem/ruby/system/CacheMemory.hh
index 8adc892a7..a4950a09b 100644
--- a/src/mem/ruby/system/CacheMemory.hh
+++ b/src/mem/ruby/system/CacheMemory.hh
@@ -29,7 +29,6 @@
#ifndef __MEM_RUBY_SYSTEM_CACHEMEMORY_HH__
#define __MEM_RUBY_SYSTEM_CACHEMEMORY_HH__
-#include <iostream>
#include <string>
#include <vector>
@@ -172,4 +171,3 @@ class CacheMemory : public SimObject
};
#endif // __MEM_RUBY_SYSTEM_CACHEMEMORY_HH__
-
diff --git a/src/mem/ruby/system/RubyMemoryControl.cc b/src/mem/ruby/system/RubyMemoryControl.cc
index 54585e275..230f652c2 100644
--- a/src/mem/ruby/system/RubyMemoryControl.cc
+++ b/src/mem/ruby/system/RubyMemoryControl.cc
@@ -279,7 +279,7 @@ RubyMemoryControl::~RubyMemoryControl()
void
RubyMemoryControl::enqueue(const MsgPtr& message, int latency)
{
- Time current_time = g_eventQueue_ptr->getTime();
+ Time current_time = g_system_ptr->getTime();
Time arrival_time = current_time + latency;
const MemoryMsg* memMess = safe_cast<const MemoryMsg*>(message.get());
physical_address_t addr = memMess->getAddress().getAddress();
@@ -302,7 +302,7 @@ RubyMemoryControl::enqueueMemRef(MemoryNode& memRef)
DPRINTF(RubyMemory,
"New memory request%7d: %#08x %c arrived at %10d bank = %3x sched %c\n",
m_msg_counter, addr, memRef.m_is_mem_read ? 'R':'W',
- memRef.m_time * g_eventQueue_ptr->getClock(),
+ memRef.m_time * g_system_ptr->getClock(),
bank, m_event.scheduled() ? 'Y':'N');
m_profiler_ptr->profileMemReq(bank);
@@ -347,7 +347,7 @@ bool
RubyMemoryControl::isReady()
{
return ((!m_response_queue.empty()) &&
- (m_response_queue.front().m_time <= g_eventQueue_ptr->getTime()));
+ (m_response_queue.front().m_time <= g_system_ptr->getTime()));
}
void
@@ -377,17 +377,17 @@ RubyMemoryControl::printStats(ostream& out) const
void
RubyMemoryControl::enqueueToDirectory(MemoryNode req, int latency)
{
- Time arrival_time = g_eventQueue_ptr->getTime()
+ Time arrival_time = g_system_ptr->getTime()
+ (latency * m_mem_bus_cycle_multiplier);
req.m_time = arrival_time;
m_response_queue.push_back(req);
DPRINTF(RubyMemory, "Enqueueing msg %#08x %c back to directory at %15d\n",
req.m_addr, req.m_is_mem_read ? 'R':'W',
- arrival_time * g_eventQueue_ptr->getClock());
+ arrival_time * g_system_ptr->getClock());
// schedule the wake up
- g_eventQueue_ptr->scheduleEventAbsolute(m_consumer_ptr, arrival_time);
+ m_consumer_ptr->scheduleEventAbsolute(arrival_time);
}
// getBank returns an integer that is unique for each
diff --git a/src/mem/ruby/system/RubyPort.cc b/src/mem/ruby/system/RubyPort.cc
index c8580bb5c..b24f649a5 100644
--- a/src/mem/ruby/system/RubyPort.cc
+++ b/src/mem/ruby/system/RubyPort.cc
@@ -198,7 +198,7 @@ RubyPort::M5Port::recvTimingReq(PacketPtr pkt)
// send next cycle
ruby_port->pio_port.schedTimingReq(pkt, curTick() +
- g_eventQueue_ptr->getClock());
+ g_system_ptr->getClock());
return true;
}
@@ -651,7 +651,7 @@ RubyPort::M5Port::hitCallback(PacketPtr pkt)
if (needsResponse) {
DPRINTF(RubyPort, "Sending packet back over port\n");
// send next cycle
- schedTimingResp(pkt, curTick() + g_eventQueue_ptr->getClock());
+ schedTimingResp(pkt, curTick() + g_system_ptr->getClock());
} else {
delete pkt;
}
diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc
index a4cdca53f..01d34814f 100644
--- a/src/mem/ruby/system/Sequencer.cc
+++ b/src/mem/ruby/system/Sequencer.cc
@@ -43,11 +43,9 @@
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/profiler/Profiler.hh"
#include "mem/ruby/slicc_interface/RubyRequest.hh"
-#include "mem/ruby/system/CacheMemory.hh"
#include "mem/ruby/system/Sequencer.hh"
#include "mem/ruby/system/System.hh"
#include "mem/packet.hh"
-#include "params/RubySequencer.hh"
using namespace std;
@@ -88,7 +86,7 @@ void
Sequencer::wakeup()
{
// Check for deadlock of any of the requests
- Time current_time = g_eventQueue_ptr->getTime();
+ Time current_time = g_system_ptr->getTime();
// Check across all outstanding requests
int total_outstanding = 0;
@@ -131,7 +129,7 @@ Sequencer::wakeup()
if (m_outstanding_count > 0) {
// If there are still outstanding requests, keep checking
schedule(deadlockCheckEvent,
- m_deadlock_threshold * g_eventQueue_ptr->getClock() +
+ m_deadlock_threshold * g_system_ptr->getClock() +
curTick());
}
}
@@ -156,7 +154,7 @@ Sequencer::printProgress(ostream& out) const
#if 0
int total_demand = 0;
out << "Sequencer Stats Version " << m_version << endl;
- out << "Current time = " << g_eventQueue_ptr->getTime() << endl;
+ out << "Current time = " << g_system_ptr->getTime() << endl;
out << "---------------" << endl;
out << "outstanding requests" << endl;
@@ -212,7 +210,7 @@ Sequencer::insertRequest(PacketPtr pkt, RubyRequestType request_type)
// See if we should schedule a deadlock check
if (deadlockCheckEvent.scheduled() == false) {
schedule(deadlockCheckEvent,
- m_deadlock_threshold * g_eventQueue_ptr->getClock()
+ m_deadlock_threshold * g_system_ptr->getClock()
+ curTick());
}
@@ -239,7 +237,7 @@ Sequencer::insertRequest(PacketPtr pkt, RubyRequestType request_type)
if (r.second) {
RequestTable::iterator i = r.first;
i->second = new SequencerRequest(pkt, request_type,
- g_eventQueue_ptr->getTime());
+ g_system_ptr->getTime());
m_outstanding_count++;
} else {
// There is an outstanding write request for the cache line
@@ -260,7 +258,7 @@ Sequencer::insertRequest(PacketPtr pkt, RubyRequestType request_type)
if (r.second) {
RequestTable::iterator i = r.first;
i->second = new SequencerRequest(pkt, request_type,
- g_eventQueue_ptr->getTime());
+ g_system_ptr->getTime());
m_outstanding_count++;
} else {
// There is an outstanding read request for the cache line
@@ -476,8 +474,8 @@ Sequencer::hitCallback(SequencerRequest* srequest,
m_dataCache_ptr->setMRU(request_line_address);
}
- assert(g_eventQueue_ptr->getTime() >= issued_time);
- Time miss_latency = g_eventQueue_ptr->getTime() - issued_time;
+ assert(g_system_ptr->getTime() >= issued_time);
+ Time miss_latency = g_system_ptr->getTime() - issued_time;
// Profile the miss latency for all non-zero demand misses
if (miss_latency != 0) {
@@ -488,7 +486,7 @@ Sequencer::hitCallback(SequencerRequest* srequest,
initialRequestTime,
forwardRequestTime,
firstResponseTime,
- g_eventQueue_ptr->getTime());
+ g_system_ptr->getTime());
}
if (mach == GenericMachineType_Directory) {
@@ -496,7 +494,7 @@ Sequencer::hitCallback(SequencerRequest* srequest,
initialRequestTime,
forwardRequestTime,
firstResponseTime,
- g_eventQueue_ptr->getTime());
+ g_system_ptr->getTime());
}
DPRINTFR(ProtocolTrace, "%15s %3s %10s%20s %6s>%-6s %s %d cycles\n",
diff --git a/src/mem/ruby/system/Sequencer.hh b/src/mem/ruby/system/Sequencer.hh
index a912347aa..dbdfca38e 100644
--- a/src/mem/ruby/system/Sequencer.hh
+++ b/src/mem/ruby/system/Sequencer.hh
@@ -36,13 +36,11 @@
#include "mem/protocol/RubyRequestType.hh"
#include "mem/protocol/SequencerRequestType.hh"
#include "mem/ruby/common/Address.hh"
-#include "mem/ruby/common/Consumer.hh"
+#include "mem/ruby/system/CacheMemory.hh"
#include "mem/ruby/system/RubyPort.hh"
+#include "params/RubySequencer.hh"
class DataBlock;
-class CacheMemory;
-
-struct RubySequencerParams;
struct SequencerRequest
{
@@ -57,7 +55,7 @@ struct SequencerRequest
std::ostream& operator<<(std::ostream& out, const SequencerRequest& obj);
-class Sequencer : public RubyPort, public Consumer
+class Sequencer : public RubyPort
{
public:
typedef RubySequencerParams Params;
diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc
index b06e8b7ed..7921d306d 100644
--- a/src/mem/ruby/system/System.cc
+++ b/src/mem/ruby/system/System.cc
@@ -77,7 +77,6 @@ RubySystem::RubySystem(const Params *p)
m_memory_size_bits = floorLog2(m_memory_size_bytes);
}
- g_eventQueue_ptr = new RubyEventQueue(p->eventq, m_clock);
g_system_ptr = this;
if (p->no_mem_vec) {
m_mem_vec_ptr = NULL;
@@ -423,13 +422,13 @@ RubySystem::checkGlobalCoherenceInvariant(const Address& addr)
WARN_EXPR(exclusive);
WARN_EXPR(m_chip_vector[i]->getID());
WARN_EXPR(addr);
- WARN_EXPR(g_eventQueue_ptr->getTime());
+ WARN_EXPR(getTime());
ERROR_MSG("Coherence Violation Detected -- 2 exclusive chips");
} else if (sharedDetected) {
WARN_EXPR(lastShared);
WARN_EXPR(m_chip_vector[i]->getID());
WARN_EXPR(addr);
- WARN_EXPR(g_eventQueue_ptr->getTime());
+ WARN_EXPR(getTime());
ERROR_MSG("Coherence Violation Detected -- exclusive chip with >=1 shared");
} else {
exclusive = m_chip_vector[i]->getID();
@@ -442,7 +441,7 @@ RubySystem::checkGlobalCoherenceInvariant(const Address& addr)
WARN_EXPR(lastShared);
WARN_EXPR(exclusive);
WARN_EXPR(addr);
- WARN_EXPR(g_eventQueue_ptr->getTime());
+ WARN_EXPR(getTime());
ERROR_MSG("Coherence Violation Detected -- exclusive chip with >=1 shared");
}
}
diff --git a/src/mem/ruby/system/System.hh b/src/mem/ruby/system/System.hh
index bbb14667f..e6501f7bf 100644
--- a/src/mem/ruby/system/System.hh
+++ b/src/mem/ruby/system/System.hh
@@ -37,7 +37,6 @@
#include "base/callback.hh"
#include "mem/ruby/common/Global.hh"
-#include "mem/ruby/eventqueue/RubyEventQueue.hh"
#include "mem/ruby/recorder/CacheRecorder.hh"
#include "mem/ruby/slicc_interface/AbstractController.hh"
#include "mem/ruby/system/MemoryVector.hh"
@@ -78,6 +77,8 @@ class RubySystem : public SimObject
static int getBlockSizeBits() { return m_block_size_bits; }
static uint64 getMemorySizeBytes() { return m_memory_size_bytes; }
static int getMemorySizeBits() { return m_memory_size_bits; }
+ Tick getTime() const { return curTick() / m_clock; }
+ Tick getClock() const { return m_clock; }
// Public Methods
static Network*
@@ -87,12 +88,6 @@ class RubySystem : public SimObject
return m_network_ptr;
}
- static RubyEventQueue*
- getEventQueue()
- {
- return g_eventQueue_ptr;
- }
-
Profiler*
getProfiler()
{
@@ -111,11 +106,6 @@ class RubySystem : public SimObject
void clearStats() const;
uint64 getInstructionCount(int thread) { return 1; }
- static uint64
- getCycleCount(int thread)
- {
- return g_eventQueue_ptr->getTime();
- }
void print(std::ostream& out) const;
diff --git a/src/mem/ruby/system/TimerTable.cc b/src/mem/ruby/system/TimerTable.cc
index d5df8fe18..6702411a5 100644
--- a/src/mem/ruby/system/TimerTable.cc
+++ b/src/mem/ruby/system/TimerTable.cc
@@ -27,7 +27,7 @@
*/
#include "mem/ruby/common/Global.hh"
-#include "mem/ruby/eventqueue/RubyEventQueue.hh"
+#include "mem/ruby/system/System.hh"
#include "mem/ruby/system/TimerTable.hh"
TimerTable::TimerTable()
@@ -48,7 +48,7 @@ TimerTable::isReady() const
updateNext();
}
assert(m_next_valid);
- return (g_eventQueue_ptr->getTime() >= m_next_time);
+ return (g_system_ptr->getTime() >= m_next_time);
}
const Address&
@@ -69,10 +69,10 @@ TimerTable::set(const Address& address, Time relative_latency)
assert(address == line_address(address));
assert(relative_latency > 0);
assert(!m_map.count(address));
- Time ready_time = g_eventQueue_ptr->getTime() + relative_latency;
+ Time ready_time = g_system_ptr->getTime() + relative_latency;
m_map[address] = ready_time;
assert(m_consumer_ptr != NULL);
- g_eventQueue_ptr->scheduleEventAbsolute(m_consumer_ptr, ready_time);
+ m_consumer_ptr->scheduleEventAbsolute(ready_time);
m_next_valid = false;
// Don't always recalculate the next ready address
diff --git a/src/mem/ruby/system/TimerTable.hh b/src/mem/ruby/system/TimerTable.hh
index e4419d4d3..4335b6605 100644
--- a/src/mem/ruby/system/TimerTable.hh
+++ b/src/mem/ruby/system/TimerTable.hh
@@ -31,12 +31,11 @@
#include <cassert>
#include <iostream>
+#include <map>
#include <string>
#include "mem/ruby/common/Address.hh"
-#include "mem/ruby/common/Global.hh"
-
-class Consumer;
+#include "mem/ruby/common/Consumer.hh"
class TimerTable
{
diff --git a/src/mem/ruby/system/WireBuffer.cc b/src/mem/ruby/system/WireBuffer.cc
index f007d6c51..fb12998be 100644
--- a/src/mem/ruby/system/WireBuffer.cc
+++ b/src/mem/ruby/system/WireBuffer.cc
@@ -74,13 +74,13 @@ void
WireBuffer::enqueue(MsgPtr message, int latency)
{
m_msg_counter++;
- Time current_time = g_eventQueue_ptr->getTime();
+ Time current_time = g_system_ptr->getTime();
Time arrival_time = current_time + latency;
assert(arrival_time > current_time);
MessageBufferNode thisNode(arrival_time, m_msg_counter, message);
m_message_queue.push_back(thisNode);
if (m_consumer_ptr != NULL) {
- g_eventQueue_ptr->scheduleEventAbsolute(m_consumer_ptr, arrival_time);
+ m_consumer_ptr->scheduleEventAbsolute(arrival_time);
} else {
panic("No Consumer for WireBuffer! %s\n", *this);
}
@@ -123,19 +123,18 @@ WireBuffer::recycle()
MessageBufferNode node = m_message_queue.front();
pop_heap(m_message_queue.begin(), m_message_queue.end(),
greater<MessageBufferNode>());
- node.m_time = g_eventQueue_ptr->getTime() + 1;
+ node.m_time = g_system_ptr->getTime() + 1;
m_message_queue.back() = node;
push_heap(m_message_queue.begin(), m_message_queue.end(),
greater<MessageBufferNode>());
- g_eventQueue_ptr->scheduleEventAbsolute(m_consumer_ptr,
- g_eventQueue_ptr->getTime() + 1);
+ m_consumer_ptr->scheduleEventAbsolute(g_system_ptr->getTime() + 1);
}
bool
WireBuffer::isReady()
{
return ((!m_message_queue.empty()) &&
- (m_message_queue.front().m_time <= g_eventQueue_ptr->getTime()));
+ (m_message_queue.front().m_time <= g_system_ptr->getTime()));
}
void
diff --git a/src/mem/ruby/system/WireBuffer.hh b/src/mem/ruby/system/WireBuffer.hh
index bc3afa2da..c22fab70b 100644
--- a/src/mem/ruby/system/WireBuffer.hh
+++ b/src/mem/ruby/system/WireBuffer.hh
@@ -38,7 +38,6 @@
#include "mem/ruby/buffers/MessageBufferNode.hh"
#include "mem/ruby/common/Global.hh"
-#include "mem/ruby/eventqueue/RubyEventQueue.hh"
#include "params/RubyWireBuffer.hh"
#include "sim/sim_object.hh"
diff --git a/src/mem/slicc/ast/AST.py b/src/mem/slicc/ast/AST.py
index b74867114..b99451019 100644
--- a/src/mem/slicc/ast/AST.py
+++ b/src/mem/slicc/ast/AST.py
@@ -56,7 +56,7 @@ class AST(PairContainer):
code('''
char c;
cerr << "Runtime Error at ${{self.location}}, Ruby Time: "
- << g_eventQueue_ptr->getTime() << ": "
+ << g_system_ptr->getTime() << ": "
<< $message
<< ", PID: " << getpid() << endl
<< "press return to continue." << endl;
diff --git a/src/mem/slicc/ast/FuncCallExprAST.py b/src/mem/slicc/ast/FuncCallExprAST.py
index 3747d0dfd..ab6261de2 100644
--- a/src/mem/slicc/ast/FuncCallExprAST.py
+++ b/src/mem/slicc/ast/FuncCallExprAST.py
@@ -142,7 +142,7 @@ class FuncCallExprAST(ExprAST):
}
if (result == TransitionResult_ResourceStall) {
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ scheduleEvent(this, 1);
// Cannot do anything with this transition, go check next doable transition (mostly likely of next port)
}
@@ -173,7 +173,7 @@ class FuncCallExprAST(ExprAST):
}
if (result1 == TransitionResult_ResourceStall) {
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ scheduleEvent(this, 1);
// Cannot do anything with this transition, go check next
// doable transition (mostly likely of next port)
}
diff --git a/src/mem/slicc/symbols/StateMachine.py b/src/mem/slicc/symbols/StateMachine.py
index 39f3a4b43..83ad88e8b 100644
--- a/src/mem/slicc/symbols/StateMachine.py
+++ b/src/mem/slicc/symbols/StateMachine.py
@@ -1037,7 +1037,7 @@ ${ident}_Controller::wakeup()
g_system_ptr->getProfiler()->controllerBusy(m_machineID);
// Wakeup in another cycle and try again
- g_eventQueue_ptr->scheduleEvent(this, 1);
+ scheduleEvent(this, 1);
break;
}
''')
@@ -1064,7 +1064,6 @@ ${ident}_Controller::wakeup()
code('''
break; // If we got this far, we have nothing left todo
}
- // g_eventQueue_ptr->scheduleEvent(this, 1);
}
''')
@@ -1126,11 +1125,8 @@ ${ident}_Controller::doTransition(${ident}_Event event,
${ident}_State next_state = state;
DPRINTF(RubyGenerated, "%s, Time: %lld, state: %s, event: %s, addr: %s\\n",
- *this,
- g_eventQueue_ptr->getTime(),
- ${ident}_State_to_string(state),
- ${ident}_Event_to_string(event),
- addr);
+ *this, g_system_ptr->getTime(), ${ident}_State_to_string(state),
+ ${ident}_Event_to_string(event), addr);
TransitionResult result =
''')
@@ -1302,7 +1298,7 @@ if (!checkResourceAvailable(%s_RequestType_%s, addr)) {
default:
fatal("Invalid transition\\n"
"%s time: %d addr: %s event: %s state: %s\\n",
- name(), g_eventQueue_ptr->getTime(), addr, event, state);
+ name(), g_system_ptr->getTime(), addr, event, state);
}
return TransitionResult_Valid;
}
diff --git a/src/mem/slicc/symbols/Type.py b/src/mem/slicc/symbols/Type.py
index ad00f2ac1..42ee8894a 100644
--- a/src/mem/slicc/symbols/Type.py
+++ b/src/mem/slicc/symbols/Type.py
@@ -415,7 +415,7 @@ ${{self.c_ident}}::print(ostream& out) const
code('out << "${{dm.ident}} = " << m_${{dm.ident}} << " ";''')
if self.isMessage:
- code('out << "Time = " << getTime() * g_eventQueue_ptr->getClock() << " ";')
+ code('out << "Time = " << getTime() * g_system_ptr->getClock() << " ";')
code.dedent()
# Trailer