mem: Fix initial value problem with MemChecker
authorStephan Diestelhorst <stephan.diestelhorst@arm.com>
Mon, 16 Feb 2015 08:34:47 +0000 (03:34 -0500)
committerStephan Diestelhorst <stephan.diestelhorst@arm.com>
Mon, 16 Feb 2015 08:34:47 +0000 (03:34 -0500)
In highly loaded cases, reads might actually overlap with writes to the
initial memory state. The mem checker needs to detect such cases and
permit the read reading either from the writes (what it is doing now) or
read from the initial, unknown value.

This patch adds this logic.

src/mem/mem_checker.cc

index 0b80736602f93dbc7fc181ec38a2e5b7f3d2bd8a..dba4b5025eb78cfa228c6b5c4a18d3f28bb269c7 100644 (file)
@@ -195,6 +195,17 @@ MemChecker::ByteTracker::inExpectedData(Tick start, Tick complete, uint8_t data)
         }
         // Record non-matching, but possible value
         _lastExpectedData.push_back(last_obs.data);
+    } else {
+        // We have not seen any valid observation, and the only writes
+        // observed are overlapping, so anything (in particular the
+        // initialisation value) goes
+        // NOTE: We can overlap with multiple write clusters, here
+        if (!writeClusters.empty() && wc_overlap) {
+            // ensure that all write clusters really overlap this read
+            assert(writeClusters.begin()->start < complete &&
+                   writeClusters.rbegin()->complete > start);
+            return true;
+        }
     }
 
     if (_lastExpectedData.empty()) {