summaryrefslogtreecommitdiff
path: root/src/mem/ruby/storebuffer
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2009-07-06 15:49:47 -0700
committerNathan Binkert <nate@binkert.org>2009-07-06 15:49:47 -0700
commita7904e2cf341d5452c5622adfcbdcd268d4ab7d1 (patch)
tree76c744e731c275b393130b869c2c2944807a77af /src/mem/ruby/storebuffer
parent5b080ae0463c9644eb81bd923e25139dfe787e6e (diff)
downloadgem5-a7904e2cf341d5452c5622adfcbdcd268d4ab7d1.tar.xz
ruby: apply some fixes that were overwritten by the recent ruby import.
Diffstat (limited to 'src/mem/ruby/storebuffer')
-rw-r--r--src/mem/ruby/storebuffer/stb_interface.cc2
-rw-r--r--src/mem/ruby/storebuffer/storebuffer.cc28
-rw-r--r--src/mem/ruby/storebuffer/storebuffer.hh18
3 files changed, 36 insertions, 12 deletions
diff --git a/src/mem/ruby/storebuffer/stb_interface.cc b/src/mem/ruby/storebuffer/stb_interface.cc
index df280d9e1..cc93d3b51 100644
--- a/src/mem/ruby/storebuffer/stb_interface.cc
+++ b/src/mem/ruby/storebuffer/stb_interface.cc
@@ -53,12 +53,14 @@ uint64_t handleLoad(StoreBuffer * storebuffer, const RubyRequest & request) {
return storebuffer->handleLoad(request);
}
+#if 0
uint64_t handleAtomic(StoreBuffer * storebuffer, const RubyRequest & request) {
// flush the store buffer
storebuffer->flushStoreBuffer();
// let storebuffer issue atomic
//return storebuffer->issueAtomic(request);
}
+#endif
void flushSTB(StoreBuffer * storebuffer) {
// in in-order can't get a request to flushSTB if already flushing
diff --git a/src/mem/ruby/storebuffer/storebuffer.cc b/src/mem/ruby/storebuffer/storebuffer.cc
index 6d6e4b228..865a31820 100644
--- a/src/mem/ruby/storebuffer/storebuffer.cc
+++ b/src/mem/ruby/storebuffer/storebuffer.cc
@@ -30,11 +30,15 @@
/* Includes */
/*------------------------------------------------------------------------*/
+#include <map>
+
#include "mem/ruby/storebuffer/hfa.hh"
#include "mem/ruby/storebuffer/storebuffer.hh"
-#include <map>
#include "mem/ruby/common/Global.hh"
+
+#ifdef RUBY_TSO_CHECKER
#include "TsoChecker.hh"
+#endif
#define SYSTEM_EXIT ASSERT(0)
@@ -42,7 +46,9 @@
// global map of request id_s to map them back to storebuffer pointers
map <uint64_t, StoreBuffer *> request_map;
+#ifdef RUBY_TSO_CHECKER
Tso::TsoChecker * g_tsoChecker;
+#endif
void hit(int64_t id) {
if (request_map.find(id) == request_map.end()) {
@@ -59,7 +65,7 @@ void hit(int64_t id) {
//*****************************************************************************************
StoreBuffer::StoreBuffer(uint32 id, uint32 block_bits, int storebuffer_size) {
-#ifdef TSO_CHECK
+#ifdef RUBY_TSO_CHECKER
if (id == 0) {
g_tsoChecker = new Tso::TsoChecker();
g_tsoChecker->init(64);
@@ -93,7 +99,7 @@ StoreBuffer::StoreBuffer(uint32 id, uint32 block_bits, int storebuffer_size) {
//******************************************************************************************
StoreBuffer::~StoreBuffer(){
-#ifdef TSO_CHECK
+#ifdef RUBY_TSO_CHECKER
if (m_id == 0) {
delete g_tsoChecker;
}
@@ -266,13 +272,15 @@ void StoreBuffer::returnMatchedData(struct RubyRequest request) {
ASSERT(checkForLoadHit(request) != NO_MATCH);
physical_address_t lineaddr = physical_address & m_block_mask;
bool found = false;
+#ifdef RUBY_TSO_CHECKER
Tso::TsoCheckerCmd * cmd;
+#endif
deque<struct SBEntry>::iterator satisfying_store;
for (deque<struct SBEntry>::iterator it = buffer.begin(); it != buffer.end(); it++) {
if ((it->m_request.paddr & m_block_mask) == lineaddr) {
if (!found) {
found = true;
-#ifdef TSO_CHECK
+#ifdef RUBY_TSO_CHECKER
satisfying_store = it;
cmd = new Tso::TsoCheckerCmd(m_id, // this thread id
iseq, // instruction sequence
@@ -305,7 +313,7 @@ void StoreBuffer::returnMatchedData(struct RubyRequest request) {
}
}
-#ifdef TSO_CHECK
+#ifdef RUBY_TSO_CHECKER
uint64_t tso_data = 0;
memcpy(&tso_data, request.data, request.len);
cmd->setData(tso_data);
@@ -373,7 +381,6 @@ void StoreBuffer::complete(uint64_t id) {
ASSERT(outstanding_requests.find(id) != outstanding_requests.end());
physical_address_t physical_address = outstanding_requests.find(id)->second.paddr;
RubyRequestType type = outstanding_requests.find(id)->second.type;
- int len = outstanding_requests.find(id)->second.len;
#ifdef DEBUG_WRITE_BUFFER
DEBUG_OUT("\n***StoreBuffer: complete BEGIN, contents:\n");
DEBUG_OUT("\n");
@@ -393,7 +400,8 @@ void StoreBuffer::complete(uint64_t id) {
m_buffer_size--;
ASSERT(m_buffer_size >= 0);
-#ifdef TSO_CHECK
+#ifdef RUBY_TSO_CHECKER
+ int len = outstanding_requests.find(id)->second.len;
uint64_t data = 0;
memcpy(&data, from_buffer.m_request.data, 4);
@@ -454,7 +462,7 @@ void StoreBuffer::complete(uint64_t id) {
#endif
} // end if (type == ST)
else if (type == RubyRequestType_LD) {
-#ifdef TSO_CHECK
+#ifdef RUBY_TSO_CHECKER
RubyRequest request = outstanding_requests.find(id)->second;
uint64_t data = 0;
memcpy(&data, request.data, request.len);
@@ -503,7 +511,7 @@ void StoreBuffer::complete(uint64_t id) {
}
}
-
+#ifdef RUBY_TSO_CHECKER
void StoreBuffer::insertTsoLL(Tso::TsoCheckerCmd * cmd) {
uint64_t count = cmd->getIseq();
Tso::TsoCheckerCmd * current = NULL;
@@ -545,7 +553,7 @@ void StoreBuffer::insertTsoLL(Tso::TsoCheckerCmd * cmd) {
previous->setNext(cmd);
}
}
-
+#endif
//***************************************************************************************************
void StoreBuffer::print( void )
diff --git a/src/mem/ruby/storebuffer/storebuffer.hh b/src/mem/ruby/storebuffer/storebuffer.hh
index a5cf99f07..4117a8f38 100644
--- a/src/mem/ruby/storebuffer/storebuffer.hh
+++ b/src/mem/ruby/storebuffer/storebuffer.hh
@@ -31,11 +31,15 @@
#include <map>
#include <deque>
+
+#include "config/ruby_tso_checker.hh"
#include "mem/ruby/storebuffer/hfa.hh"
#include "mem/ruby/libruby.hh"
+
+#ifdef RUBY_TSO_CHECKER
#include "TsoCheckerCmd.hh"
+#endif
-#define TSO_CHECK
/**
* Status for write buffer accesses. The Write buffer can hit in fastpath, be full, or
* successfully enqueue the store request
@@ -49,8 +53,16 @@ enum load_match { NO_MATCH, PARTIAL_MATCH, FULL_MATCH };
struct SBEntry {
struct RubyRequest m_request;
+#ifdef RUBY_TSO_CHECKER
Tso::TsoCheckerCmd * m_next_ptr;
- SBEntry(struct RubyRequest request, void * ptr) { m_request = request; m_next_ptr = (Tso::TsoCheckerCmd*) ptr; }
+#endif
+ SBEntry(struct RubyRequest request, void * ptr)
+ : m_request(request)
+ {
+#ifdef RUBY_TSO_CHECKER
+ m_next_ptr = (Tso::TsoCheckerCmd*) ptr;
+#endif
+ }
};
class StoreBuffer {
@@ -89,8 +101,10 @@ class StoreBuffer {
/// prints out the contents of the Write Buffer
void print();
+#ifdef RUBY_TSO_CHECKER
/// if load completes before store, insert correctly to be issued to TSOChecker
void insertTsoLL(Tso::TsoCheckerCmd * cmd);
+#endif
/// Returns flag indicating whether we are using the write buffer
bool useStoreBuffer() { return m_use_storebuffer; }