diff options
author | Brandon Potter <brandon.potter@amd.com> | 2015-07-10 16:05:23 -0500 |
---|---|---|
committer | Brandon Potter <brandon.potter@amd.com> | 2015-07-10 16:05:23 -0500 |
commit | f9a370f1728fe5d752fa6962ba23774eec8c883e (patch) | |
tree | a81a0331b75c72ec801d1ecf1ce62a8bc6f3d112 /src/mem/ruby/system/DMASequencer.cc | |
parent | c38f5098b152ea1e1dde96220d3f9e50d3411780 (diff) | |
download | gem5-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/system/DMASequencer.cc')
-rw-r--r-- | src/mem/ruby/system/DMASequencer.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mem/ruby/system/DMASequencer.cc b/src/mem/ruby/system/DMASequencer.cc index 646601ad4..7f12fda4c 100644 --- a/src/mem/ruby/system/DMASequencer.cc +++ b/src/mem/ruby/system/DMASequencer.cc @@ -38,8 +38,9 @@ #include "sim/system.hh" DMASequencer::DMASequencer(const Params *p) - : MemObject(p), m_version(p->version), m_controller(NULL), - m_mandatory_q_ptr(NULL), m_usingRubyTester(p->using_ruby_tester), + : MemObject(p), m_ruby_system(p->ruby_system), m_version(p->version), + m_controller(NULL), m_mandatory_q_ptr(NULL), + m_usingRubyTester(p->using_ruby_tester), slave_port(csprintf("%s.slave", name()), this, 0, p->ruby_system, p->ruby_system->getAccessBackingStore()), system(p->system), retry(false) @@ -77,7 +78,7 @@ DMASequencer::MemSlavePort::MemSlavePort(const std::string &_name, DMASequencer *_port, PortID id, RubySystem* _ruby_system, bool _access_backing_store) : QueuedSlavePort(_name, _port, queue, id), queue(*_port, *this), - ruby_system(_ruby_system), access_backing_store(_access_backing_store) + m_ruby_system(_ruby_system), access_backing_store(_access_backing_store) { DPRINTF(RubyDma, "Created slave memport on ruby sequencer %s\n", _name); } @@ -190,7 +191,7 @@ DMASequencer::MemSlavePort::hitCallback(PacketPtr pkt) // turn packet around to go back to requester if response expected if (access_backing_store) { - ruby_system->getPhysMem()->access(pkt); + m_ruby_system->getPhysMem()->access(pkt); } else if (needsResponse) { pkt->makeResponse(); } @@ -198,7 +199,9 @@ DMASequencer::MemSlavePort::hitCallback(PacketPtr pkt) if (needsResponse) { DPRINTF(RubyDma, "Sending packet back over port\n"); // send next cycle - schedTimingResp(pkt, curTick() + g_system_ptr->clockPeriod()); + DMASequencer *seq = static_cast<DMASequencer *>(&owner); + RubySystem *rs = seq->m_ruby_system; + schedTimingResp(pkt, curTick() + rs->clockPeriod()); } else { delete pkt; } |