# Node ID 004c06dd157ac2ffa4f2f4ead77edfa1e2db99f0 # Parent 4330a5015ddb79e0f50e01180942afce810d45e4 diff --git a/src/cpu/testers/directedtest/RubyDirectedTester.hh b/src/cpu/testers/directedtest/RubyDirectedTester.hh --- a/src/cpu/testers/directedtest/RubyDirectedTester.hh +++ b/src/cpu/testers/directedtest/RubyDirectedTester.hh @@ -35,7 +35,6 @@ #include #include "mem/ruby/common/DataBlock.hh" -#include "mem/ruby/common/SubBlock.hh" #include "mem/ruby/common/TypeDefines.hh" #include "mem/mem_object.hh" #include "mem/packet.hh" diff --git a/src/cpu/testers/directedtest/SConscript b/src/cpu/testers/directedtest/SConscript --- a/src/cpu/testers/directedtest/SConscript +++ b/src/cpu/testers/directedtest/SConscript @@ -31,7 +31,7 @@ Import('*') # -# Currently the ruby testser relies on Ruby specific objects (SubBlock, etc.) +# Currently the ruby tester relies on Ruby specific objects # When this dependency is removed, the ruby tester should be compiled # independently from Ruby # diff --git a/src/cpu/testers/rubytest/Check.hh b/src/cpu/testers/rubytest/Check.hh --- a/src/cpu/testers/rubytest/Check.hh +++ b/src/cpu/testers/rubytest/Check.hh @@ -37,7 +37,7 @@ #include "mem/protocol/TesterStatus.hh" #include "mem/ruby/common/Address.hh" -class SubBlock; +class DataBlock; const int CHECK_SIZE_BITS = 2; const int CHECK_SIZE = (1 << CHECK_SIZE_BITS); @@ -49,7 +49,8 @@ int _num_readers, RubyTester* _tester); void initiate(); // Does Action or Check or nether - void performCallback(NodeID proc, SubBlock* data, Cycles curTime); + void performCallback(NodeID proc, Addr address, DataBlock *data, + Cycles curTime); Addr getAddress() const { return m_address; } void changeAddress(Addr address); diff --git a/src/cpu/testers/rubytest/Check.cc b/src/cpu/testers/rubytest/Check.cc --- a/src/cpu/testers/rubytest/Check.cc +++ b/src/cpu/testers/rubytest/Check.cc @@ -30,7 +30,6 @@ #include "base/random.hh" #include "cpu/testers/rubytest/Check.hh" #include "debug/RubyTest.hh" -#include "mem/ruby/common/SubBlock.hh" typedef RubyTester::SenderState SenderState; @@ -116,8 +115,8 @@ uint8_t *data = new uint8_t[1]; pkt->dataDynamic(data); - // push the subblock onto the sender state. The sequencer will - // update the subblock on the return + // Push the DataBlock onto the sender state. The sequencer will + // update the DataBlock on the return. pkt->senderState = new SenderState(m_address, req->getSize()); if (port->sendTimingReq(pkt)) { @@ -153,8 +152,8 @@ PacketPtr pkt = new Packet(req, cmd); - // push the subblock onto the sender state. The sequencer will - // update the subblock on the return + // Push the DataBlock onto the sender state. The sequencer will + // update the DataBlock on the return. pkt->senderState = new SenderState(m_address, req->getSize()); if (port->sendTimingReq(pkt)) { @@ -198,8 +197,8 @@ DPRINTF(RubyTest, "Seq write: index %d data 0x%x check 0x%x\n", index, *(pkt->getConstPtr()), *writeData); - // push the subblock onto the sender state. The sequencer will - // update the subblock on the return + // Push the DataBlock onto the sender state. The sequencer will + // update the DataBlock on the return. pkt->senderState = new SenderState(writeAddr, req->getSize()); if (port->sendTimingReq(pkt)) { @@ -252,8 +251,8 @@ DPRINTF(RubyTest, "Seq read: index %d\n", index); - // push the subblock onto the sender state. The sequencer will - // update the subblock on the return + // Push the DataBlock onto the sender state. The sequencer will + // update the DataBlock on the return. pkt->senderState = new SenderState(m_address, req->getSize()); if (port->sendTimingReq(pkt)) { @@ -278,10 +277,9 @@ } void -Check::performCallback(NodeID proc, SubBlock* data, Cycles curTime) +Check::performCallback(NodeID proc, Addr address, DataBlock *data, + Cycles curTime) { - Addr address = data->getAddress(); - // This isn't exactly right since we now have multi-byte checks // assert(getAddress() == address); diff --git a/src/cpu/testers/rubytest/RubyTester.hh b/src/cpu/testers/rubytest/RubyTester.hh --- a/src/cpu/testers/rubytest/RubyTester.hh +++ b/src/cpu/testers/rubytest/RubyTester.hh @@ -49,7 +49,7 @@ #include "cpu/testers/rubytest/CheckTable.hh" #include "mem/mem_object.hh" #include "mem/packet.hh" -#include "mem/ruby/common/SubBlock.hh" +#include "mem/ruby/common/DataBlock.hh" #include "mem/ruby/common/TypeDefines.hh" #include "params/RubyTester.hh" @@ -84,10 +84,10 @@ struct SenderState : public Packet::SenderState { - SubBlock subBlock; - - SenderState(Addr addr, int size) : subBlock(addr, size) {} - + Addr addr; + DataBlock dataBlock; + SenderState(Addr _addr, uint32_t size) : addr(_addr), dataBlock() + { } }; typedef RubyTesterParams Params; @@ -136,7 +136,7 @@ MasterID _masterId; private: - void hitCallback(NodeID proc, SubBlock* data); + void hitCallback(NodeID proc, Addr addr, DataBlock *data); void checkForDeadlock(); diff --git a/src/cpu/testers/rubytest/RubyTester.cc b/src/cpu/testers/rubytest/RubyTester.cc --- a/src/cpu/testers/rubytest/RubyTester.cc +++ b/src/cpu/testers/rubytest/RubyTester.cc @@ -43,9 +43,9 @@ #include "cpu/testers/rubytest/Check.hh" #include "cpu/testers/rubytest/RubyTester.hh" #include "debug/RubyTest.hh" -#include "mem/ruby/common/SubBlock.hh" #include "sim/sim_exit.hh" #include "sim/system.hh" +#include "mem/ruby/system/RubySystem.hh" RubyTester::RubyTester(const Params *p) : MemObject(p), checkStartEvent(this), @@ -172,15 +172,16 @@ bool RubyTester::CpuPort::recvTimingResp(PacketPtr pkt) { - // retrieve the subblock and call hitCallback + // retrieve the DataBlock and call hitCallback RubyTester::SenderState* senderState = safe_cast(pkt->senderState); - SubBlock& subblock = senderState->subBlock; - tester->hitCallback(globalIdx, &subblock); + Addr address = senderState->addr; + DataBlock &datablock = senderState->dataBlock; + tester->hitCallback(globalIdx, address, &datablock); // Now that the tester has completed, delete the senderState - // (includes sublock) and the packet, then return + // (includes DataBlock) and the packet, then return delete pkt->senderState; delete pkt->req; delete pkt; @@ -217,24 +218,24 @@ } void -RubyTester::hitCallback(NodeID proc, SubBlock* data) +RubyTester::hitCallback(NodeID proc, Addr address, DataBlock *data) { // Mark that we made progress m_last_progress_vector[proc] = curCycle(); DPRINTF(RubyTest, "completed request for proc: %d\n", proc); DPRINTFR(RubyTest, " addr: 0x%x, size: %d, data: ", - data->getAddress(), data->getSize()); - for (int byte = 0; byte < data->getSize(); byte++) { + address, RubySystem::getBlockSizeBytes()); + for (int byte = 0; byte < RubySystem::getBlockSizeBytes(); byte++) { DPRINTFR(RubyTest, "%d ", data->getByte(byte)); } DPRINTFR(RubyTest, "\n"); // This tells us our store has 'completed' or for a load gives us // back the data to make the check - Check* check_ptr = m_checkTable_ptr->getCheck(data->getAddress()); + Check* check_ptr = m_checkTable_ptr->getCheck(address); assert(check_ptr != NULL); - check_ptr->performCallback(proc, data, curCycle()); + check_ptr->performCallback(proc, address, data, curCycle()); } void diff --git a/src/cpu/testers/rubytest/SConscript b/src/cpu/testers/rubytest/SConscript --- a/src/cpu/testers/rubytest/SConscript +++ b/src/cpu/testers/rubytest/SConscript @@ -31,7 +31,7 @@ Import('*') # -# Currently the ruby testser relies on Ruby specific objects (SubBlock, etc.) +# Currently the ruby tester relies on Ruby specific objects # When this dependency is removed, the ruby tester should be compiled # independently from Ruby # diff --git a/src/mem/cache/tags/base_set_assoc.hh b/src/mem/cache/tags/base_set_assoc.hh --- a/src/mem/cache/tags/base_set_assoc.hh +++ b/src/mem/cache/tags/base_set_assoc.hh @@ -137,17 +137,6 @@ } /** - * Return the subblock size. In the case of BaseSetAssoc it is always - * the block size. - * @return The block size. - */ - unsigned - getSubBlockSize() const - { - return blkSize; - } - - /** * Return the number of sets this cache has * @return The number of sets. */ diff --git a/src/mem/cache/tags/fa_lru.hh b/src/mem/cache/tags/fa_lru.hh --- a/src/mem/cache/tags/fa_lru.hh +++ b/src/mem/cache/tags/fa_lru.hh @@ -226,16 +226,6 @@ } /** - * Return the subblock size of this cache, always the block size. - * @return The block size. - */ - unsigned - getSubBlockSize() const - { - return blkSize; - } - - /** * Return the number of sets this cache has * @return The number of sets. */ diff --git a/src/mem/ruby/common/SConscript b/src/mem/ruby/common/SConscript --- a/src/mem/ruby/common/SConscript +++ b/src/mem/ruby/common/SConscript @@ -40,5 +40,4 @@ Source('Histogram.cc') Source('IntVec.cc') Source('NetDest.cc') -Source('SubBlock.cc') Source('WriteMask.cc') diff --git a/src/mem/ruby/common/SubBlock.hh b/src/mem/ruby/common/SubBlock.hh deleted file mode 100644 --- a/src/mem/ruby/common/SubBlock.hh +++ /dev/null @@ -1,81 +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_COMMON_SUBBLOCK_HH__ -#define __MEM_RUBY_COMMON_SUBBLOCK_HH__ - -#include -#include - -#include "mem/ruby/common/Address.hh" -#include "mem/ruby/common/DataBlock.hh" - -class SubBlock -{ - public: - SubBlock() { } - SubBlock(Addr addr, int size); - ~SubBlock() { } - - Addr getAddress() const { return m_address; } - void setAddress(Addr addr) { m_address = addr; } - - int getSize() const { return m_data.size(); } - void resize(int size) { m_data.resize(size); } - uint8_t getByte(int offset) const { return m_data[offset]; } - void setByte(int offset, uint8_t data) { m_data[offset] = data; } - - // Shorthands - uint8_t readByte() const { return getByte(0); } - void writeByte(uint8_t data) { setByte(0, data); } - - // Merging to and from DataBlocks - We only need to worry about - // updates when we are using DataBlocks - void mergeTo(DataBlock& data) const { internalMergeTo(data); } - void mergeFrom(const DataBlock& data) { internalMergeFrom(data); } - - void print(std::ostream& out) const; - - private: - void internalMergeTo(DataBlock& data) const; - void internalMergeFrom(const DataBlock& data); - - // Data Members (m_ prefix) - Addr m_address; - std::vector m_data; -}; - -inline std::ostream& -operator<<(std::ostream& out, const SubBlock& obj) -{ - obj.print(out); - out << std::flush; - return out; -} - -#endif // __MEM_RUBY_COMMON_SUBBLOCK_HH__ diff --git a/src/mem/ruby/common/SubBlock.cc b/src/mem/ruby/common/SubBlock.cc deleted file mode 100644 --- a/src/mem/ruby/common/SubBlock.cc +++ /dev/null @@ -1,73 +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 "base/stl_helpers.hh" -#include "mem/ruby/common/SubBlock.hh" - -using m5::stl_helpers::operator<<; - -SubBlock::SubBlock(Addr addr, int size) -{ - m_address = addr; - resize(size); - for (int i = 0; i < size; i++) { - setByte(i, 0); - } -} - -void -SubBlock::internalMergeFrom(const DataBlock& data) -{ - int size = getSize(); - assert(size > 0); - int offset = getOffset(m_address); - for (int i = 0; i < size; i++) { - this->setByte(i, data.getByte(offset + i)); - } -} - -void -SubBlock::internalMergeTo(DataBlock& data) const -{ - int size = getSize(); - assert(size > 0); - int offset = getOffset(m_address); - for (int i = 0; i < size; i++) { - // This will detect crossing a cache line boundary - data.setByte(offset + i, this->getByte(i)); - } -} - -void -SubBlock::print(std::ostream& out) const -{ - out << "[" << m_address << ", " << getSize() << ", " << m_data << "]"; -} - - - diff --git a/src/mem/ruby/system/GPUCoalescer.cc b/src/mem/ruby/system/GPUCoalescer.cc --- a/src/mem/ruby/system/GPUCoalescer.cc +++ b/src/mem/ruby/system/GPUCoalescer.cc @@ -52,7 +52,6 @@ #include "gpu-compute/shader.hh" #include "mem/packet.hh" #include "mem/ruby/common/DataBlock.hh" -#include "mem/ruby/common/SubBlock.hh" #include "mem/ruby/network/MessageBuffer.hh" #include "mem/ruby/profiler/Profiler.hh" #include "mem/ruby/slicc_interface/AbstractController.hh" @@ -603,6 +602,8 @@ Addr request_address = pkt->getAddr(); Addr request_line_address = makeLineAddress(request_address); + Addr offset_address = getOffset(request_address); + RubyRequestType type = srequest->m_type; // Set this cache entry to the most recently used @@ -639,12 +640,11 @@ (type == RubyRequestType_Locked_RMW_Read) || (type == RubyRequestType_Load_Linked)) { memcpy(pkt->getPtr(), - data.getData(getOffset(request_address), - pkt->getSize()), + data.getData(offset_address, pkt->getSize()), pkt->getSize()); } else { data.setData(pkt->getPtr(), - getOffset(request_address), pkt->getSize()); + offset_address, pkt->getSize()); } } else { DPRINTF(MemoryAccess, @@ -654,7 +654,7 @@ } // If using the RubyTester, update the RubyTester sender state's - // subBlock with the recieved data. The tester will later access + // DataBlock with the received data. The tester will later access // this state. // Note: RubyPort will access it's sender state before the // RubyTester. @@ -663,7 +663,9 @@ safe_cast(pkt->senderState); RubyTester::SenderState* testerSenderState = safe_cast(requestSenderState->predecessor); - testerSenderState->subBlock.mergeFrom(data); + testerSenderState->dataBlock.setData( + data.getData(offset_address, pkt->getSize()), + 0, pkt->getSize()); } mylist.push_back(pkt); @@ -1080,6 +1082,8 @@ { assert(address == makeLineAddress(address)); + Addr offset_address = getOffset(address); + DPRINTF(GPUCoalescer, "atomic callback for address %#x\n", address); assert(m_writeRequestTable.count(makeLineAddress(address))); @@ -1116,7 +1120,7 @@ srequest->m_type != RubyRequestType_ATOMIC_NO_RETURN) { /* atomics are done in memory, and return the data *before* the atomic op... */ memcpy(pkt->getPtr(), - data.getData(getOffset(request_address), + data.getData(offset_address, pkt->getSize()), pkt->getSize()); } else { @@ -1127,7 +1131,7 @@ } // If using the RubyTester, update the RubyTester sender state's - // subBlock with the recieved data. The tester will later access + // DataBlock with the received data. The tester will later access // this state. // Note: RubyPort will access it's sender state before the // RubyTester. @@ -1136,7 +1140,9 @@ safe_cast(pkt->senderState); RubyTester::SenderState* testerSenderState = safe_cast(requestSenderState->predecessor); - testerSenderState->subBlock.mergeFrom(data); + testerSenderState->dataBlock.setData( + data.getData(offset_address, pkt->getSize()), + 0, pkt->getSize()); } mylist.push_back(pkt); diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc --- a/src/mem/ruby/system/Sequencer.cc +++ b/src/mem/ruby/system/Sequencer.cc @@ -430,6 +430,7 @@ PacketPtr pkt = srequest->pkt; Addr request_address(pkt->getAddr()); + Addr offset_address = getOffset(request_address); RubyRequestType type = srequest->m_type; Cycles issued_time = srequest->issue_time; @@ -449,7 +450,7 @@ // update the data unless it is a non-data-carrying flush if (RubySystem::getWarmupEnabled()) { data.setData(pkt->getConstPtr(), - getOffset(request_address), pkt->getSize()); + offset_address, pkt->getSize()); } else if (!pkt->isFlush()) { if ((type == RubyRequestType_LD) || (type == RubyRequestType_IFETCH) || @@ -457,18 +458,18 @@ (type == RubyRequestType_Locked_RMW_Read) || (type == RubyRequestType_Load_Linked)) { memcpy(pkt->getPtr(), - data.getData(getOffset(request_address), pkt->getSize()), + data.getData(offset_address, pkt->getSize()), pkt->getSize()); DPRINTF(RubySequencer, "read data %s\n", data); } else { data.setData(pkt->getConstPtr(), - getOffset(request_address), pkt->getSize()); + offset_address, pkt->getSize()); DPRINTF(RubySequencer, "set data %s\n", data); } } // If using the RubyTester, update the RubyTester sender state's - // subBlock with the recieved data. The tester will later access + // DataBlock with the received data. The tester will later access // this state. if (m_usingRubyTester) { DPRINTF(RubySequencer, "hitCallback %s 0x%x using RubyTester\n", @@ -476,7 +477,8 @@ RubyTester::SenderState* testerSenderState = pkt->findNextSenderState(); assert(testerSenderState); - testerSenderState->subBlock.mergeFrom(data); + testerSenderState->dataBlock.setData( + data.getData(offset_address, pkt->getSize()), 0, pkt->getSize()); } delete srequest; diff --git a/src/mem/ruby/system/VIPERCoalescer.cc b/src/mem/ruby/system/VIPERCoalescer.cc --- a/src/mem/ruby/system/VIPERCoalescer.cc +++ b/src/mem/ruby/system/VIPERCoalescer.cc @@ -47,7 +47,6 @@ #include "debug/GPUCoalescer.hh" #include "debug/MemoryAccess.hh" #include "mem/packet.hh" -#include "mem/ruby/common/SubBlock.hh" #include "mem/ruby/network/MessageBuffer.hh" #include "mem/ruby/profiler/Profiler.hh" #include "mem/ruby/slicc_interface/AbstractController.hh"