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;
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
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);
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;
RubyRequestType_LD,
RubyRequestType_ST,
RubyRequestType_Locked_Read,
- RubyRequestType_Locked_Write
+ RubyRequestType_Locked_Write,
+ RubyRequestType_RMW_Read,
+ RubyRequestType_RMW_Write
};
enum RubyAccessMode {
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;
}
}
case RubyRequestType_IFETCH:
case RubyRequestType_Locked_Read:
case RubyRequestType_Locked_Write:
+ case RubyRequestType_RMW_Read:
+ case RubyRequestType_RMW_Write:
assert(0);
}
//Sequencer::Sequencer(int core_id, MessageBuffer* mandatory_q)
+#define LLSC_FAIL -2
+
Sequencer::Sequencer(const string & name)
:RubyPort(name)
{
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)) {
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);
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
}
-// -2 means that the LLSC failed
int64_t Sequencer::makeRequest(const RubyRequest & request)
{
assert(Address(request.paddr).getOffset() + request.len <= RubySystem::getBlockSizeBytes());
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)));
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);
}