summaryrefslogtreecommitdiff
path: root/src/mem/ruby/structures/WireBuffer.cc
diff options
context:
space:
mode:
authorBrandon Potter <brandon.potter@amd.com>2015-07-10 16:05:23 -0500
committerBrandon Potter <brandon.potter@amd.com>2015-07-10 16:05:23 -0500
commitf9a370f1728fe5d752fa6962ba23774eec8c883e (patch)
treea81a0331b75c72ec801d1ecf1ce62a8bc6f3d112 /src/mem/ruby/structures/WireBuffer.cc
parentc38f5098b152ea1e1dde96220d3f9e50d3411780 (diff)
downloadgem5-f9a370f1728fe5d752fa6962ba23774eec8c883e.tar.xz
ruby: replace global g_system_ptr with per-object pointers
This is another step in the process of removing global variables from Ruby to enable multiple RubySystem instances in a single simulation. With possibly multiple RubySystem objects, we can no longer use a global variable to find "the" RubySystem object. Instead, each Ruby component has to carry a pointer to the RubySystem object to which it belongs.
Diffstat (limited to 'src/mem/ruby/structures/WireBuffer.cc')
-rw-r--r--src/mem/ruby/structures/WireBuffer.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mem/ruby/structures/WireBuffer.cc b/src/mem/ruby/structures/WireBuffer.cc
index 3308dbe8e..0375d9446 100644
--- a/src/mem/ruby/structures/WireBuffer.cc
+++ b/src/mem/ruby/structures/WireBuffer.cc
@@ -34,7 +34,6 @@
#include "base/cprintf.hh"
#include "base/stl_helpers.hh"
-#include "mem/ruby/common/Global.hh"
#include "mem/ruby/structures/WireBuffer.hh"
#include "mem/ruby/system/System.hh"
@@ -58,6 +57,7 @@ WireBuffer::WireBuffer(const Params *p)
: SimObject(p)
{
m_msg_counter = 0;
+ m_ruby_system = p->ruby_system;
}
void
@@ -73,7 +73,7 @@ void
WireBuffer::enqueue(MsgPtr message, Cycles latency)
{
m_msg_counter++;
- Cycles current_time = g_system_ptr->curCycle();
+ Cycles current_time = m_ruby_system->curCycle();
Cycles arrival_time = current_time + latency;
assert(arrival_time > current_time);
@@ -82,7 +82,7 @@ WireBuffer::enqueue(MsgPtr message, Cycles latency)
m_message_queue.push_back(message);
if (m_consumer_ptr != NULL) {
m_consumer_ptr->
- scheduleEventAbsolute(g_system_ptr->clockPeriod() * arrival_time);
+ scheduleEventAbsolute(m_ruby_system->clockPeriod() * arrival_time);
} else {
panic("No Consumer for WireBuffer! %s\n", *this);
}
@@ -116,12 +116,12 @@ WireBuffer::recycle()
MsgPtr node = m_message_queue.front();
pop_heap(m_message_queue.begin(), m_message_queue.end(), greater<MsgPtr>());
- node->setLastEnqueueTime(g_system_ptr->curCycle() + Cycles(1));
+ node->setLastEnqueueTime(m_ruby_system->curCycle() + Cycles(1));
m_message_queue.back() = node;
push_heap(m_message_queue.begin(), m_message_queue.end(),
greater<MsgPtr>());
m_consumer_ptr->
- scheduleEventAbsolute(g_system_ptr->curCycle() + Cycles(1));
+ scheduleEventAbsolute(m_ruby_system->curCycle() + Cycles(1));
}
bool
@@ -129,7 +129,7 @@ WireBuffer::isReady()
{
return ((!m_message_queue.empty()) &&
(m_message_queue.front()->getLastEnqueueTime() <=
- g_system_ptr->curCycle()));
+ m_ruby_system->curCycle()));
}
void