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.
This commit is contained in:
Nilay Vaish 2012-10-15 17:27:17 -05:00
parent 61434a9943
commit 07ce90f7aa
2 changed files with 11 additions and 27 deletions

View file

@ -183,7 +183,7 @@ MemTest::completeRequest(PacketPtr pkt)
if (pkt->isError()) { if (pkt->isError()) {
if (!suppress_func_warnings) { 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()); pkt->isWrite() ? "write" : "read", req->getPaddr());
} }
} else { } else {
@ -280,7 +280,6 @@ MemTest::tick()
access_size = 0; access_size = 0;
dma_access_size = 0; dma_access_size = 0;
Request *req = new Request();
Request::Flags flags; Request::Flags flags;
Addr paddr; Addr paddr;
@ -290,7 +289,17 @@ MemTest::tick()
} else { } else {
paddr = ((base) ? baseAddr1 : baseAddr2) + offset; 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; bool do_functional = (random() % 100 < percentFunctional) && !uncacheable;
Request *req = new Request();
uint8_t *result = new uint8_t[8];
if (issueDmas) { if (issueDmas) {
paddr &= ~((1 << dma_access_size) - 1); paddr &= ~((1 << dma_access_size) - 1);
@ -303,20 +312,8 @@ MemTest::tick()
} }
assert(req->getSize() == 1); assert(req->getSize() == 1);
uint8_t *result = new uint8_t[8];
if (cmd < percentReads) { if (cmd < percentReads) {
// read // 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); outstandingAddrs.insert(paddr);
// ***** NOTE FOR RON: I'm not sure how to access checkMem. - Kevin // ***** NOTE FOR RON: I'm not sure how to access checkMem. - Kevin
@ -342,16 +339,6 @@ MemTest::tick()
} }
} else { } else {
// write // 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); outstandingAddrs.insert(paddr);
DPRINTF(MemTest, "initiating %swrite at addr %x (blk %x) value %x\n", DPRINTF(MemTest, "initiating %swrite at addr %x (blk %x) value %x\n",

View file

@ -190,6 +190,3 @@ class MemTest : public MemObject
}; };
#endif // __CPU_MEMTEST_MEMTEST_HH__ #endif // __CPU_MEMTEST_MEMTEST_HH__