cache/memtest: fixes for functional accesses.
authorSteve Reinhardt <stever@eecs.umich.edu>
Fri, 27 Jul 2007 19:46:45 +0000 (12:46 -0700)
committerSteve Reinhardt <stever@eecs.umich.edu>
Fri, 27 Jul 2007 19:46:45 +0000 (12:46 -0700)
--HG--
extra : convert_revision : 688ba4d882cad2c96cf44c9e46999f74266e02ee

src/cpu/memtest/memtest.cc
src/mem/cache/cache_impl.hh
src/mem/cache/miss/mshr.cc
src/mem/cache/miss/mshr.hh
src/mem/cache/miss/mshr_queue.cc
src/mem/cache/miss/mshr_queue.hh

index 86a33f44b02b7e32c8c67be5b7d1af723ea47003..83417c514cd1078215457be8355d6821dac5d2a2 100644 (file)
@@ -359,7 +359,6 @@ MemTest::tick()
 
         if (probe) {
             cachePort.sendFunctional(pkt);
-            pkt->makeAtomicResponse();
             completeRequest(pkt);
         } else {
             sendPkt(pkt);
@@ -393,7 +392,6 @@ MemTest::tick()
 
         if (probe) {
             cachePort.sendFunctional(pkt);
-            pkt->makeAtomicResponse();
             completeRequest(pkt);
         } else {
             sendPkt(pkt);
index 150cf80b7a72bd4fe538b8c0d761e880774edbc3..c1b01d6762ed70a278561bd282a7e4035e1293e4 100644 (file)
@@ -641,33 +641,12 @@ Cache<TagStore>::functionalAccess(PacketPtr pkt,
         return;
     }
 
-    // Need to check for outstanding misses and writes
-
-    // There can only be one matching outstanding miss.
-    MSHR *mshr = mshrQueue.findMatch(blk_addr);
-    if (mshr) {
-        MSHR::TargetList *targets = mshr->getTargetList();
-        MSHR::TargetList::iterator i = targets->begin();
-        MSHR::TargetList::iterator end = targets->end();
-        for (; i != end; ++i) {
-            PacketPtr targetPkt = i->pkt;
-            if (pkt->checkFunctional(targetPkt))
-                return;
-        }
+    // Need to check for outstanding misses and writes; if neither one
+    // satisfies, then forward to other side of cache.
+    if (!(mshrQueue.checkFunctional(pkt, blk_addr) ||
+          writeBuffer.checkFunctional(pkt, blk_addr))) {
+        otherSidePort->checkAndSendFunctional(pkt);
     }
-
-    // There can be many matching outstanding writes.
-    std::vector<MSHR*> writes;
-    assert(!writeBuffer.findMatches(blk_addr, writes));
-/*  Need to change this to iterate through targets in mshr??
-    for (int i = 0; i < writes.size(); ++i) {
-        MSHR *mshr = writes[i];
-        if (pkt->checkFunctional(mshr->addr, mshr->size, mshr->writeData))
-            return;
-    }
-*/
-
-    otherSidePort->checkAndSendFunctional(pkt);
 }
 
 
index 5ba3d1ec5a5f21ae0d0734ba85e25cef4ee22dd8..7796773a398aeabf5b01d09d8d3568f5aa7fa34e 100644 (file)
@@ -118,6 +118,20 @@ MSHR::TargetList::clearDownstreamPending()
 }
 
 
+bool
+MSHR::TargetList::checkFunctional(PacketPtr pkt)
+{
+    Iterator end_i = end();
+    for (Iterator i = begin(); i != end_i; ++i) {
+        if (pkt->checkFunctional(i->pkt)) {
+            return true;
+        }
+    }
+
+    return false;
+}
+
+
 void
 MSHR::allocate(Addr _addr, int _size, PacketPtr target,
                Tick whenReady, Counter _order)
index e850a86338269f74f26b79e95577b6922d4b77b6..c865ca3acb59fbef778c3b1f26bde088a8d804bd 100644 (file)
@@ -82,6 +82,7 @@ class MSHR : public Packet::SenderState
         void add(PacketPtr pkt, Tick readyTime, Counter order, bool cpuSide);
         void replaceUpgrades();
         void clearDownstreamPending();
+        bool checkFunctional(PacketPtr pkt);
     };
 
     /** A list of MSHRs. */
@@ -230,6 +231,11 @@ public:
 
     void handleFill(Packet *pkt, CacheBlk *blk);
 
+    bool checkFunctional(PacketPtr pkt) {
+        return (targets->checkFunctional(pkt) ||
+                deferredTargets->checkFunctional(pkt));
+    }
+
     /**
      * Prints the contents of this MSHR to stderr.
      */
index 50a28fb3c8ff8e81b7ce43c1412578c87e3fc469..911329e0cb345f1cdb603d6fbd252bc4be3c87f4 100644 (file)
@@ -84,9 +84,24 @@ MSHRQueue::findMatches(Addr addr, vector<MSHR*>& matches) const
         }
     }
     return retval;
+}
+
 
+bool
+MSHRQueue::checkFunctional(PacketPtr pkt, Addr blk_addr)
+{
+    MSHR::ConstIterator i = allocatedList.begin();
+    MSHR::ConstIterator end = allocatedList.end();
+    for (; i != end; ++i) {
+        MSHR *mshr = *i;
+        if (mshr->addr == blk_addr && mshr->checkFunctional(pkt)) {
+            return true;
+        }
+    }
+    return false;
 }
 
+
 MSHR *
 MSHRQueue::findPending(Addr addr, int size) const
 {
index 1f1d59e98b803ee503f9e8d4503c6f661c5bc43e..447ebfc5a92a31d1df2e0102cd6beb33e327de0d 100644 (file)
@@ -115,6 +115,8 @@ class MSHRQueue
      */
     MSHR *findPending(Addr addr, int size) const;
 
+    bool checkFunctional(PacketPtr pkt, Addr blk_addr);
+
     /**
      * Allocates a new MSHR for the request and size. This places the request
      * as the first target in the MSHR.