summaryrefslogtreecommitdiff
path: root/src/mem/ruby/slicc_interface
diff options
context:
space:
mode:
authorTony Gutierrez <anthony.gutierrez@amd.com>2016-01-19 14:05:03 -0500
committerTony Gutierrez <anthony.gutierrez@amd.com>2016-01-19 14:05:03 -0500
commit28e353e0403ea379d244a418e8dc8ee0b48187cf (patch)
tree64bf9dcdf22bf7f60668f790744c11ee8ec2f2bf /src/mem/ruby/slicc_interface
parentd658b6e1cc22de852fef611e28f448257acc298a (diff)
downloadgem5-28e353e0403ea379d244a418e8dc8ee0b48187cf.tar.xz
mem: write combining for ruby protocols
This patch adds support for write-combining in ruby.
Diffstat (limited to 'src/mem/ruby/slicc_interface')
-rw-r--r--src/mem/ruby/slicc_interface/RubyRequest.hh7
-rw-r--r--src/mem/ruby/slicc_interface/RubySlicc_Util.hh38
2 files changed, 45 insertions, 0 deletions
diff --git a/src/mem/ruby/slicc_interface/RubyRequest.hh b/src/mem/ruby/slicc_interface/RubyRequest.hh
index 73f214a20..689d559ce 100644
--- a/src/mem/ruby/slicc_interface/RubyRequest.hh
+++ b/src/mem/ruby/slicc_interface/RubyRequest.hh
@@ -40,6 +40,7 @@
#include "mem/protocol/RubyRequestType.hh"
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/common/DataBlock.hh"
+#include "mem/ruby/common/WriteMask.hh"
class RubyRequest : public Message
{
@@ -54,6 +55,8 @@ class RubyRequest : public Message
uint8_t* data;
PacketPtr pkt;
ContextID m_contextId;
+ WriteMask m_writeMask;
+ DataBlock m_WTData;
int m_wfid;
HSAScope m_scope;
HSASegment m_segment;
@@ -99,6 +102,8 @@ class RubyRequest : public Message
data(_data),
pkt(_pkt),
m_contextId(_core_id),
+ m_writeMask(_wm_size,_wm_mask),
+ m_WTData(_Data),
m_wfid(_proc_id),
m_scope(_scope),
m_segment(_segment)
@@ -125,6 +130,8 @@ class RubyRequest : public Message
data(_data),
pkt(_pkt),
m_contextId(_core_id),
+ m_writeMask(_wm_size,_wm_mask,_atomicOps),
+ m_WTData(_Data),
m_wfid(_proc_id),
m_scope(_scope),
m_segment(_segment)
diff --git a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh
index 55f229d20..4fe065a3f 100644
--- a/src/mem/ruby/slicc_interface/RubySlicc_Util.hh
+++ b/src/mem/ruby/slicc_interface/RubySlicc_Util.hh
@@ -1,5 +1,6 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
+ * Copyright (c) 2013 Advanced Micro Devices, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,6 +42,7 @@
#include "mem/ruby/common/BoolVec.hh"
#include "mem/ruby/common/DataBlock.hh"
#include "mem/ruby/common/TypeDefines.hh"
+#include "mem/ruby/common/WriteMask.hh"
inline Cycles zero_time() { return Cycles(0); }
@@ -88,6 +90,12 @@ inline int max_tokens()
* range for the data block contains the address which the packet needs to
* read, then the data from the data block is written to the packet. True is
* returned if the data block was read, otherwise false is returned.
+ *
+ * This is used during a functional access "search the world" operation. The
+ * functional access looks in every place that might hold a valid data block
+ * and, if it finds one, checks to see if it is holding the address the access
+ * is searching for. During the access check, the WriteMask could be in any
+ * state, including empty.
*/
inline bool
testAndRead(Addr addr, DataBlock& blk, Packet *pkt)
@@ -109,6 +117,36 @@ testAndRead(Addr addr, DataBlock& blk, Packet *pkt)
}
/**
+ * This function accepts an address, a data block, a write mask and a packet.
+ * If the valid address range for the data block contains the address which
+ * the packet needs to read, then the data from the data block is written to
+ * the packet. True is returned if any part of the data block was read,
+ * otherwise false is returned.
+ */
+inline bool
+testAndReadMask(Addr addr, DataBlock& blk, WriteMask& mask, Packet *pkt)
+{
+ Addr pktLineAddr = makeLineAddress(pkt->getAddr());
+ Addr lineAddr = makeLineAddress(addr);
+
+ if (pktLineAddr == lineAddr) {
+ uint8_t *data = pkt->getPtr<uint8_t>();
+ unsigned int size_in_bytes = pkt->getSize();
+ unsigned startByte = pkt->getAddr() - lineAddr;
+ bool was_read = false;
+
+ for (unsigned i = 0; i < size_in_bytes; ++i) {
+ if (mask.test(i + startByte)) {
+ was_read = true;
+ data[i] = blk.getByte(i + startByte);
+ }
+ }
+ return was_read;
+ }
+ return false;
+}
+
+/**
* This function accepts an address, a data block and a packet. If the address
* range for the data block contains the address which the packet needs to
* write, then the data from the packet is written to the data block. True is