summaryrefslogtreecommitdiff
path: root/src/mem/ruby/structures/RubyMemoryControl.cc
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2014-11-06 05:42:20 -0600
committerNilay Vaish <nilay@cs.wisc.edu>2014-11-06 05:42:20 -0600
commitd25b722e4a9500f2d4b2ca937900bf093242ddfa (patch)
tree8eaa415786c9f2ac2ffff67799068381fdbaf90f /src/mem/ruby/structures/RubyMemoryControl.cc
parent0baaed60ab961b8eb3399ee2c34adeea7335f5b3 (diff)
downloadgem5-d25b722e4a9500f2d4b2ca937900bf093242ddfa.tar.xz
ruby: coherence protocols: remove data block from dirctory entry
This patch removes the data block present in the directory entry structure of each protocol in gem5's mainline. Firstly, this is required for moving towards common set of memory controllers for classic and ruby memory systems. Secondly, the data block was being misused in several places. It was being used for having free access to the physical memory instead of calling on the memory controller. From now on, the directory controller will not have a direct visibility into the physical memory. The Memory Vector object now resides in the Memory Controller class. This also means that some significant changes are being made to the functional accesses in ruby.
Diffstat (limited to 'src/mem/ruby/structures/RubyMemoryControl.cc')
-rw-r--r--src/mem/ruby/structures/RubyMemoryControl.cc27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/mem/ruby/structures/RubyMemoryControl.cc b/src/mem/ruby/structures/RubyMemoryControl.cc
index 69fd45fe4..2e71c0c2f 100644
--- a/src/mem/ruby/structures/RubyMemoryControl.cc
+++ b/src/mem/ruby/structures/RubyMemoryControl.cc
@@ -173,6 +173,7 @@ RubyMemoryControl::RubyMemoryControl(const Params *p)
void
RubyMemoryControl::init()
{
+ m_ram = g_system_ptr->getMemoryVector();
m_msg_counter = 0;
assert(m_tFaw <= 62); // must fit in a uint64 shift register
@@ -282,6 +283,19 @@ RubyMemoryControl::enqueue(const MsgPtr& message, Cycles latency)
physical_address_t addr = memMess->getAddr().getAddress();
MemoryRequestType type = memMess->getType();
bool is_mem_read = (type == MemoryRequestType_MEMORY_READ);
+
+ if (is_mem_read) {
+ m_ram->read(memMess->getAddr(), const_cast<uint8_t *>(
+ memMess->getDataBlk().getData(0,
+ RubySystem::getBlockSizeBytes())),
+ RubySystem::getBlockSizeBytes());
+ } else {
+ m_ram->write(memMess->getAddr(), const_cast<uint8_t *>(
+ memMess->getDataBlk().getData(0,
+ RubySystem::getBlockSizeBytes())),
+ RubySystem::getBlockSizeBytes());
+ }
+
MemoryNode *thisReq = new MemoryNode(arrival_time, message, addr,
is_mem_read, !is_mem_read);
enqueueMemRef(thisReq);
@@ -706,7 +720,7 @@ RubyMemoryControl::wakeup()
* being lists.
*/
bool
-RubyMemoryControl::functionalReadBuffers(Packet *pkt)
+RubyMemoryControl::functionalRead(Packet *pkt)
{
for (std::list<MemoryNode *>::iterator it = m_input_queue.begin();
it != m_input_queue.end(); ++it) {
@@ -734,7 +748,10 @@ RubyMemoryControl::functionalReadBuffers(Packet *pkt)
}
}
- return false;
+ m_ram->read(Address(pkt->getAddr()), pkt->getPtr<uint8_t>(true),
+ pkt->getSize());
+
+ return true;
}
/**
@@ -746,7 +763,7 @@ RubyMemoryControl::functionalReadBuffers(Packet *pkt)
* for debugging purposes.
*/
uint32_t
-RubyMemoryControl::functionalWriteBuffers(Packet *pkt)
+RubyMemoryControl::functionalWrite(Packet *pkt)
{
uint32_t num_functional_writes = 0;
@@ -776,6 +793,10 @@ RubyMemoryControl::functionalWriteBuffers(Packet *pkt)
}
}
+ m_ram->write(Address(pkt->getAddr()), pkt->getPtr<uint8_t>(true),
+ pkt->getSize());
+ num_functional_writes++;
+
return num_functional_writes;
}