memtest.cc (9294:8fb03b13de02) memtest.cc (9301:1e8d01c15a77)
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 169 unchanged lines hidden (view full) ---

178 //Remove the address from the list of outstanding
179 std::set<unsigned>::iterator removeAddr =
180 outstandingAddrs.find(req->getPaddr());
181 assert(removeAddr != outstandingAddrs.end());
182 outstandingAddrs.erase(removeAddr);
183
184 if (pkt->isError()) {
185 if (!suppress_func_warnings) {
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 169 unchanged lines hidden (view full) ---

178 //Remove the address from the list of outstanding
179 std::set<unsigned>::iterator removeAddr =
180 outstandingAddrs.find(req->getPaddr());
181 assert(removeAddr != outstandingAddrs.end());
182 outstandingAddrs.erase(removeAddr);
183
184 if (pkt->isError()) {
185 if (!suppress_func_warnings) {
186 warn("Functional Access failed for %x at %x\n",
186 warn("Functional %s access failed at %#x\n",
187 pkt->isWrite() ? "write" : "read", req->getPaddr());
188 }
189 } else {
190 if (pkt->isRead()) {
191 if (memcmp(pkt_data, data, pkt->getSize()) != 0) {
192 panic("%s: read of %x (blk %x) @ cycle %d "
193 "returns %x, expected %x\n", name(),
194 req->getPaddr(), blockAddr(req->getPaddr()), curTick(),

--- 80 unchanged lines hidden (view full) ---

275 //mem tester
276 //We can eliminate the lower bits of the offset, and then use the id
277 //to offset within the blks
278 offset = blockAddr(offset);
279 offset += id;
280 access_size = 0;
281 dma_access_size = 0;
282
187 pkt->isWrite() ? "write" : "read", req->getPaddr());
188 }
189 } else {
190 if (pkt->isRead()) {
191 if (memcmp(pkt_data, data, pkt->getSize()) != 0) {
192 panic("%s: read of %x (blk %x) @ cycle %d "
193 "returns %x, expected %x\n", name(),
194 req->getPaddr(), blockAddr(req->getPaddr()), curTick(),

--- 80 unchanged lines hidden (view full) ---

275 //mem tester
276 //We can eliminate the lower bits of the offset, and then use the id
277 //to offset within the blks
278 offset = blockAddr(offset);
279 offset += id;
280 access_size = 0;
281 dma_access_size = 0;
282
283 Request *req = new Request();
284 Request::Flags flags;
285 Addr paddr;
286
287 if (uncacheable) {
288 flags.set(Request::UNCACHEABLE);
289 paddr = uncacheAddr + offset;
290 } else {
291 paddr = ((base) ? baseAddr1 : baseAddr2) + offset;
292 }
283 Request::Flags flags;
284 Addr paddr;
285
286 if (uncacheable) {
287 flags.set(Request::UNCACHEABLE);
288 paddr = uncacheAddr + offset;
289 } else {
290 paddr = ((base) ? baseAddr1 : baseAddr2) + offset;
291 }
292
293 // For now we only allow one outstanding request per address
294 // per tester This means we assume CPU does write forwarding
295 // to reads that alias something in the cpu store buffer.
296 if (outstandingAddrs.find(paddr) != outstandingAddrs.end()) {
297 return;
298 }
299
293 bool do_functional = (random() % 100 < percentFunctional) && !uncacheable;
300 bool do_functional = (random() % 100 < percentFunctional) && !uncacheable;
301 Request *req = new Request();
302 uint8_t *result = new uint8_t[8];
294
295 if (issueDmas) {
296 paddr &= ~((1 << dma_access_size) - 1);
297 req->setPhys(paddr, 1 << dma_access_size, flags, masterId);
298 req->setThreadContext(id,0);
299 } else {
300 paddr &= ~((1 << access_size) - 1);
301 req->setPhys(paddr, 1 << access_size, flags, masterId);
302 req->setThreadContext(id,0);
303 }
304 assert(req->getSize() == 1);
305
303
304 if (issueDmas) {
305 paddr &= ~((1 << dma_access_size) - 1);
306 req->setPhys(paddr, 1 << dma_access_size, flags, masterId);
307 req->setThreadContext(id,0);
308 } else {
309 paddr &= ~((1 << access_size) - 1);
310 req->setPhys(paddr, 1 << access_size, flags, masterId);
311 req->setThreadContext(id,0);
312 }
313 assert(req->getSize() == 1);
314
306 uint8_t *result = new uint8_t[8];
307
308 if (cmd < percentReads) {
309 // read
315 if (cmd < percentReads) {
316 // read
310
311 // For now we only allow one outstanding request per address
312 // per tester This means we assume CPU does write forwarding
313 // to reads that alias something in the cpu store buffer.
314 if (outstandingAddrs.find(paddr) != outstandingAddrs.end()) {
315 delete [] result;
316 delete req;
317 return;
318 }
319
320 outstandingAddrs.insert(paddr);
321
322 // ***** NOTE FOR RON: I'm not sure how to access checkMem. - Kevin
323 funcProxy.readBlob(req->getPaddr(), result, req->getSize());
324
325 DPRINTF(MemTest,
326 "id %d initiating %sread at addr %x (blk %x) expecting %x\n",
327 id, do_functional ? "functional " : "", req->getPaddr(),

--- 9 unchanged lines hidden (view full) ---

337 pkt->setSuppressFuncError();
338 cachePort.sendFunctional(pkt);
339 completeRequest(pkt);
340 } else {
341 sendPkt(pkt);
342 }
343 } else {
344 // write
317 outstandingAddrs.insert(paddr);
318
319 // ***** NOTE FOR RON: I'm not sure how to access checkMem. - Kevin
320 funcProxy.readBlob(req->getPaddr(), result, req->getSize());
321
322 DPRINTF(MemTest,
323 "id %d initiating %sread at addr %x (blk %x) expecting %x\n",
324 id, do_functional ? "functional " : "", req->getPaddr(),

--- 9 unchanged lines hidden (view full) ---

334 pkt->setSuppressFuncError();
335 cachePort.sendFunctional(pkt);
336 completeRequest(pkt);
337 } else {
338 sendPkt(pkt);
339 }
340 } else {
341 // write
345
346 // For now we only allow one outstanding request per addreess
347 // per tester. This means we assume CPU does write forwarding
348 // to reads that alias something in the cpu store buffer.
349 if (outstandingAddrs.find(paddr) != outstandingAddrs.end()) {
350 delete [] result;
351 delete req;
352 return;
353 }
354
355 outstandingAddrs.insert(paddr);
356
357 DPRINTF(MemTest, "initiating %swrite at addr %x (blk %x) value %x\n",
358 do_functional ? "functional " : "", req->getPaddr(),
359 blockAddr(req->getPaddr()), data & 0xff);
360
361 PacketPtr pkt = new Packet(req, MemCmd::WriteReq);
362 uint8_t *pkt_data = new uint8_t[req->getSize()];

--- 38 unchanged lines hidden ---
342 outstandingAddrs.insert(paddr);
343
344 DPRINTF(MemTest, "initiating %swrite at addr %x (blk %x) value %x\n",
345 do_functional ? "functional " : "", req->getPaddr(),
346 blockAddr(req->getPaddr()), data & 0xff);
347
348 PacketPtr pkt = new Packet(req, MemCmd::WriteReq);
349 uint8_t *pkt_data = new uint8_t[req->getSize()];

--- 38 unchanged lines hidden ---