summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2012-10-15 17:27:17 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2012-10-15 17:27:17 -0500
commit07ce90f7aa28a507493da905ba1881972250bb3a (patch)
treed22dbac1eeeef2479d23e383362a09de1984553c /src
parent61434a9943236e8586d9ac772cfe3de3145abb78 (diff)
downloadgem5-07ce90f7aa28a507493da905ba1881972250bb3a.tar.xz
memtest: move check on outstanding requests
The Memtest tester allows for only one request to be outstanding for a particular physical address. The check has been written separately for reads and writes. This patch moves the check earlier than its current position so that it need not be written separately for reads and writes.
Diffstat (limited to 'src')
-rw-r--r--src/cpu/testers/memtest/memtest.cc35
-rw-r--r--src/cpu/testers/memtest/memtest.hh3
2 files changed, 11 insertions, 27 deletions
diff --git a/src/cpu/testers/memtest/memtest.cc b/src/cpu/testers/memtest/memtest.cc
index ea3e5fd9b..37684ec5d 100644
--- a/src/cpu/testers/memtest/memtest.cc
+++ b/src/cpu/testers/memtest/memtest.cc
@@ -183,7 +183,7 @@ MemTest::completeRequest(PacketPtr pkt)
if (pkt->isError()) {
if (!suppress_func_warnings) {
- warn("Functional Access failed for %x at %x\n",
+ warn("Functional %s access failed at %#x\n",
pkt->isWrite() ? "write" : "read", req->getPaddr());
}
} else {
@@ -280,7 +280,6 @@ MemTest::tick()
access_size = 0;
dma_access_size = 0;
- Request *req = new Request();
Request::Flags flags;
Addr paddr;
@@ -290,7 +289,17 @@ MemTest::tick()
} else {
paddr = ((base) ? baseAddr1 : baseAddr2) + offset;
}
+
+ // For now we only allow one outstanding request per address
+ // per tester This means we assume CPU does write forwarding
+ // to reads that alias something in the cpu store buffer.
+ if (outstandingAddrs.find(paddr) != outstandingAddrs.end()) {
+ return;
+ }
+
bool do_functional = (random() % 100 < percentFunctional) && !uncacheable;
+ Request *req = new Request();
+ uint8_t *result = new uint8_t[8];
if (issueDmas) {
paddr &= ~((1 << dma_access_size) - 1);
@@ -303,20 +312,8 @@ MemTest::tick()
}
assert(req->getSize() == 1);
- uint8_t *result = new uint8_t[8];
-
if (cmd < percentReads) {
// read
-
- // For now we only allow one outstanding request per address
- // per tester This means we assume CPU does write forwarding
- // to reads that alias something in the cpu store buffer.
- if (outstandingAddrs.find(paddr) != outstandingAddrs.end()) {
- delete [] result;
- delete req;
- return;
- }
-
outstandingAddrs.insert(paddr);
// ***** NOTE FOR RON: I'm not sure how to access checkMem. - Kevin
@@ -342,16 +339,6 @@ MemTest::tick()
}
} else {
// write
-
- // For now we only allow one outstanding request per addreess
- // per tester. This means we assume CPU does write forwarding
- // to reads that alias something in the cpu store buffer.
- if (outstandingAddrs.find(paddr) != outstandingAddrs.end()) {
- delete [] result;
- delete req;
- return;
- }
-
outstandingAddrs.insert(paddr);
DPRINTF(MemTest, "initiating %swrite at addr %x (blk %x) value %x\n",
diff --git a/src/cpu/testers/memtest/memtest.hh b/src/cpu/testers/memtest/memtest.hh
index cb5f8300f..7052ad429 100644
--- a/src/cpu/testers/memtest/memtest.hh
+++ b/src/cpu/testers/memtest/memtest.hh
@@ -190,6 +190,3 @@ class MemTest : public MemObject
};
#endif // __CPU_MEMTEST_MEMTEST_HH__
-
-
-