1. Got rid of unused functions in DirectoryMemory
authorPolina Dudnik <pdudnik@gmail.com>
Mon, 13 Jul 2009 22:22:29 +0000 (17:22 -0500)
committerPolina Dudnik <pdudnik@gmail.com>
Mon, 13 Jul 2009 22:22:29 +0000 (17:22 -0500)
2. Reintroduced RMW_Read and RMW_Write
3. Defined -2 in the Sequencer as well as made a note about mandatory queue

Did not address the issues in the slicc because remaking the atomics altogether to allow
multiple processors to issue atomic requests at once

src/mem/ruby/common/DataBlock.hh
src/mem/ruby/libruby.cc
src/mem/ruby/libruby.hh
src/mem/ruby/recorder/TraceRecord.cc
src/mem/ruby/system/DMASequencer.cc
src/mem/ruby/system/Sequencer.cc

index 01194c0ac884a94d7d915514ed76b0841fc4a646..2a0811f765af12625cc600cd103c8b66be4cb509 100644 (file)
@@ -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
index 185797f593166ff1826eb6e172df548a75f29179..b867fec34d421eb1ba0e6b9c5f32081c6e136549 100644 (file)
@@ -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;
index 5eb5e965c2fdfff9de4e3191e583cbc865cb4c5e..94018e9b97edc2e1ae0c3c8d7a0b1c413d0d2d41 100644 (file)
@@ -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 {
index 6cc33665b4f514036464aeb59b1f8dd144a1c516..8f426d6902d4b47a7707a734ccee28051f1c73eb 100644 (file)
@@ -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;
   }
 }
index ec5e0b49f820df926545e1a7ff23527603bcab67..8f7b1c912223b5208e262e5603ba9b9a6cae4a95 100644 (file)
@@ -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);
   }
 
index eb694fa131daf0f8ef74fc915e687fcf9b3d6b39..1587aa5fa64b0a8dc2716134842d8c0e54a799f9 100644 (file)
@@ -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);
   }