diff options
author | Brad Beckmann <Brad.Beckmann@amd.com> | 2010-01-29 20:29:19 -0800 |
---|---|---|
committer | Brad Beckmann <Brad.Beckmann@amd.com> | 2010-01-29 20:29:19 -0800 |
commit | 2a0555470cfc66ab70544e97578c048822ec9282 (patch) | |
tree | 6f96f3fb5bf9f27b0c2c9032715907fa7939bc49 /src/mem/ruby | |
parent | 3b290a35aca3f6aba8226dde8387f38a9de39093 (diff) | |
download | gem5-2a0555470cfc66ab70544e97578c048822ec9282.tar.xz |
ruby: Converted MOESI_hammer dma cntrl to new config system
Diffstat (limited to 'src/mem/ruby')
-rw-r--r-- | src/mem/ruby/system/DMASequencer.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/mem/ruby/system/DMASequencer.cc b/src/mem/ruby/system/DMASequencer.cc index 330e9f6af..007f92b80 100644 --- a/src/mem/ruby/system/DMASequencer.cc +++ b/src/mem/ruby/system/DMASequencer.cc @@ -8,6 +8,10 @@ #include "mem/protocol/SequencerRequestType.hh" #include "mem/ruby/system/System.hh" +// +// Fix me: This code needs comments! +// + DMASequencer::DMASequencer(const Params *p) : RubyPort(p) { @@ -15,6 +19,7 @@ DMASequencer::DMASequencer(const Params *p) void DMASequencer::init() { + RubyPort::init(); m_is_busy = false; m_data_block_mask = ~ (~0 << RubySystem::getBlockSizeBits()); } @@ -58,11 +63,16 @@ int64_t DMASequencer::makeRequest(const RubyRequest & request) msg.getLineAddress() = line_address(msg.getPhysicalAddress()); msg.getType() = write ? SequencerRequestType_ST : SequencerRequestType_LD; int offset = paddr & m_data_block_mask; + msg.getLen() = (offset + len) <= RubySystem::getBlockSizeBytes() ? len : RubySystem::getBlockSizeBytes() - offset; - if (write) + + if (write) { msg.getDataBlk().setData(data, offset, msg.getLen()); + } + + assert(m_mandatory_q_ptr != NULL); m_mandatory_q_ptr->enqueue(msg); active_request.bytes_issued += msg.getLen(); @@ -82,14 +92,18 @@ void DMASequencer::issueNext() SequencerMsg msg; msg.getPhysicalAddress() = Address(active_request.start_paddr + active_request.bytes_completed); + assert((msg.getPhysicalAddress().getAddress() & m_data_block_mask) == 0); msg.getLineAddress() = line_address(msg.getPhysicalAddress()); + msg.getType() = (active_request.write ? SequencerRequestType_ST : SequencerRequestType_LD); + msg.getLen() = (active_request.len - active_request.bytes_completed < RubySystem::getBlockSizeBytes() ? active_request.len - active_request.bytes_completed : RubySystem::getBlockSizeBytes()); + if (active_request.write) { msg.getDataBlk().setData(&active_request.data[active_request.bytes_completed], 0, msg.getLen()); @@ -97,6 +111,8 @@ void DMASequencer::issueNext() } else { msg.getType() = SequencerRequestType_LD; } + + assert(m_mandatory_q_ptr != NULL); m_mandatory_q_ptr->enqueue(msg); active_request.bytes_issued += msg.getLen(); } |