summaryrefslogtreecommitdiff
path: root/src/mem/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/ruby')
-rw-r--r--src/mem/ruby/common/DataBlock.hh18
-rw-r--r--src/mem/ruby/libruby.cc8
-rw-r--r--src/mem/ruby/libruby.hh4
-rw-r--r--src/mem/ruby/recorder/TraceRecord.cc2
-rw-r--r--src/mem/ruby/system/DMASequencer.cc2
-rw-r--r--src/mem/ruby/system/Sequencer.cc19
6 files changed, 31 insertions, 22 deletions
diff --git a/src/mem/ruby/common/DataBlock.hh b/src/mem/ruby/common/DataBlock.hh
index 01194c0ac..2a0811f76 100644
--- a/src/mem/ruby/common/DataBlock.hh
+++ b/src/mem/ruby/common/DataBlock.hh
@@ -56,9 +56,6 @@ class DataBlock {
uint8 getByte(int whichByte) const;
const uint8* getData(int offset, int len) const;
void setByte(int whichByte, uint8 data);
- const uint8* getBlock() const;
- uint8* copyData(uint8* dest, int offset, int size) const;
- void setBlock(uint8* data) { setData(data, 0, RubySystem::getBlockSizeBytes()); }
void setData(uint8* data, int offset, int len);
void copyPartial(const DataBlock & dblk, int offset, int len);
bool equal(const DataBlock& obj) const;
@@ -149,21 +146,6 @@ void DataBlock::copyPartial(const DataBlock & dblk, int offset, int len)
setData(&dblk.m_data[offset], offset, len);
}
-inline
-const uint8* DataBlock::getBlock() const
-{
- return m_data;
-}
-
-inline
-uint8* DataBlock::copyData(uint8* dest, int offset, int size) const
-{
- assert(offset + size <= RubySystem::getBlockSizeBytes());
- memcpy(dest, m_data + offset, size);
- return dest;
-}
-
-
// ******************* Definitions *******************
// Output operator definition
diff --git a/src/mem/ruby/libruby.cc b/src/mem/ruby/libruby.cc
index 185797f59..b867fec34 100644
--- a/src/mem/ruby/libruby.cc
+++ b/src/mem/ruby/libruby.cc
@@ -24,6 +24,10 @@ string RubyRequestType_to_string(const RubyRequestType& obj)
return "Locked_Read";
case RubyRequestType_Locked_Write:
return "Locked_Write";
+ case RubyRequestType_RMW_Read:
+ return "RMW_Read";
+ case RubyRequestType_RMW_Write:
+ return "RMW_Write";
case RubyRequestType_NULL:
default:
assert(0);
@@ -43,6 +47,10 @@ RubyRequestType string_to_RubyRequestType(std::string str)
return RubyRequestType_Locked_Read;
else if (str == "Locked_Write")
return RubyRequestType_Locked_Write;
+ else if (str == "RMW_Read")
+ return RubyRequestType_RMW_Read;
+ else if (str == "RMW_Write")
+ return RubyRequestType_RMW_Write;
else
assert(0);
return RubyRequestType_NULL;
diff --git a/src/mem/ruby/libruby.hh b/src/mem/ruby/libruby.hh
index 5eb5e965c..94018e9b9 100644
--- a/src/mem/ruby/libruby.hh
+++ b/src/mem/ruby/libruby.hh
@@ -12,7 +12,9 @@ enum RubyRequestType {
RubyRequestType_LD,
RubyRequestType_ST,
RubyRequestType_Locked_Read,
- RubyRequestType_Locked_Write
+ RubyRequestType_Locked_Write,
+ RubyRequestType_RMW_Read,
+ RubyRequestType_RMW_Write
};
enum RubyAccessMode {
diff --git a/src/mem/ruby/recorder/TraceRecord.cc b/src/mem/ruby/recorder/TraceRecord.cc
index 6cc33665b..8f426d690 100644
--- a/src/mem/ruby/recorder/TraceRecord.cc
+++ b/src/mem/ruby/recorder/TraceRecord.cc
@@ -50,7 +50,7 @@ TraceRecord::TraceRecord(const string & sequencer_name, const Address& data_addr
if (m_type == RubyRequestType_Locked_Read) {
m_type = RubyRequestType_ST;
}
- if (m_type == RubyRequestType_Locked_Write) {
+ else if (m_type == RubyRequestType_Locked_Write) {
m_type = RubyRequestType_ST;
}
}
diff --git a/src/mem/ruby/system/DMASequencer.cc b/src/mem/ruby/system/DMASequencer.cc
index ec5e0b49f..8f7b1c912 100644
--- a/src/mem/ruby/system/DMASequencer.cc
+++ b/src/mem/ruby/system/DMASequencer.cc
@@ -48,6 +48,8 @@ int64_t DMASequencer::makeRequest(const RubyRequest & request)
case RubyRequestType_IFETCH:
case RubyRequestType_Locked_Read:
case RubyRequestType_Locked_Write:
+ case RubyRequestType_RMW_Read:
+ case RubyRequestType_RMW_Write:
assert(0);
}
diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc
index eb694fa13..1587aa5fa 100644
--- a/src/mem/ruby/system/Sequencer.cc
+++ b/src/mem/ruby/system/Sequencer.cc
@@ -43,6 +43,8 @@
//Sequencer::Sequencer(int core_id, MessageBuffer* mandatory_q)
+#define LLSC_FAIL -2
+
Sequencer::Sequencer(const string & name)
:RubyPort(name)
{
@@ -201,6 +203,8 @@ bool Sequencer::insertRequest(SequencerRequest* request) {
Address line_addr(request->ruby_request.paddr);
line_addr.makeLineAddress();
if ((request->ruby_request.type == RubyRequestType_ST) ||
+ (request->ruby_request.type == RubyRequestType_RMW_Read) ||
+ (request->ruby_request.type == RubyRequestType_RMW_Write) ||
(request->ruby_request.type == RubyRequestType_Locked_Read) ||
(request->ruby_request.type == RubyRequestType_Locked_Write)) {
if (m_writeRequestTable.exist(line_addr)) {
@@ -238,6 +242,8 @@ void Sequencer::removeRequest(SequencerRequest* srequest) {
Address line_addr(ruby_request.paddr);
line_addr.makeLineAddress();
if ((ruby_request.type == RubyRequestType_ST) ||
+ (ruby_request.type == RubyRequestType_RMW_Read) ||
+ (ruby_request.type == RubyRequestType_RMW_Write) ||
(ruby_request.type == RubyRequestType_Locked_Read) ||
(ruby_request.type == RubyRequestType_Locked_Write)) {
m_writeRequestTable.deallocate(line_addr);
@@ -258,6 +264,8 @@ void Sequencer::writeCallback(const Address& address, DataBlock& data) {
removeRequest(request);
assert((request->ruby_request.type == RubyRequestType_ST) ||
+ (request->ruby_request.type == RubyRequestType_RMW_Read) ||
+ (request->ruby_request.type == RubyRequestType_RMW_Write) ||
(request->ruby_request.type == RubyRequestType_Locked_Read) ||
(request->ruby_request.type == RubyRequestType_Locked_Write));
// POLINA: the assumption is that atomics are only on data cache and not instruction cache
@@ -355,7 +363,6 @@ bool Sequencer::empty() const {
}
-// -2 means that the LLSC failed
int64_t Sequencer::makeRequest(const RubyRequest & request)
{
assert(Address(request.paddr).getOffset() + request.len <= RubySystem::getBlockSizeBytes());
@@ -365,8 +372,10 @@ int64_t Sequencer::makeRequest(const RubyRequest & request)
bool found = insertRequest(srequest);
if (!found)
if (request.type == RubyRequestType_Locked_Write) {
+ // NOTE: it is OK to check the locked flag here as the mandatory queue will be checked first
+ // ensuring that nothing comes between checking the flag and servicing the store
if (!m_dataCache_ptr->isLocked(line_address(Address(request.paddr)), m_version)) {
- return -2;
+ return LLSC_FAIL;
}
else {
m_dataCache_ptr->clearLocked(line_address(Address(request.paddr)));
@@ -402,6 +411,12 @@ void Sequencer::issueRequest(const RubyRequest& request) {
case RubyRequestType_Locked_Write:
ctype = CacheRequestType_ST;
break;
+ case RubyRequestType_RMW_Read:
+ ctype = CacheRequestType_ATOMIC;
+ break;
+ case RubyRequestType_RMW_Write:
+ ctype = CacheRequestType_ATOMIC;
+ break;
default:
assert(0);
}