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; --- 132 unchanged lines hidden (view full) --- 141 percentFunctional(p->percent_functional), 142 percentUncacheable(p->percent_uncacheable), 143 issueDmas(p->issue_dmas), 144 progressInterval(p->progress_interval), 145 nextProgressMessage(p->progress_interval), 146 percentSourceUnaligned(p->percent_source_unaligned), 147 percentDestUnaligned(p->percent_dest_unaligned), 148 maxLoads(p->max_loads), |
149 atomic(p->atomic), 150 suppress_func_warnings(p->suppress_func_warnings) |
151{ 152 cachePort.snoopRangeSent = false; 153 funcPort.snoopRangeSent = true; 154 155 id = TESTER_ALLOCATOR++; 156 157 // Needs to be masked off once we know the block size. 158 traceBlockAddr = p->trace_addr; 159 baseAddr1 = 0x100000; 160 baseAddr2 = 0x400000; 161 uncacheAddr = 0x800000; 162 163 // set up counters 164 noResponseCycles = 0; 165 numReads = 0; |
166 numWrites = 0; |
167 schedule(tickEvent, 0); 168 169 accessRetry = false; 170 dmaOutstanding = false; 171} 172 173Port * 174MemTest::getPort(const std::string &if_name, int idx) --- 23 unchanged lines hidden (view full) --- 198MemTest::completeRequest(PacketPtr pkt) 199{ 200 Request *req = pkt->req; 201 202 if (issueDmas) { 203 dmaOutstanding = false; 204 } 205 |
206 DPRINTF(MemTest, "completing %s at address %x (blk %x) %s\n", |
207 pkt->isWrite() ? "write" : "read", |
208 req->getPaddr(), blockAddr(req->getPaddr()), 209 pkt->isError() ? "error" : "success"); |
210 211 MemTestSenderState *state = 212 dynamic_cast<MemTestSenderState *>(pkt->senderState); 213 214 uint8_t *data = state->data; 215 uint8_t *pkt_data = pkt->getPtr<uint8_t>(); 216 217 //Remove the address from the list of outstanding 218 std::set<unsigned>::iterator removeAddr = 219 outstandingAddrs.find(req->getPaddr()); 220 assert(removeAddr != outstandingAddrs.end()); 221 outstandingAddrs.erase(removeAddr); 222 |
223 if (pkt->isError()) { 224 if (!suppress_func_warnings) { 225 warn("Functional Access failed for %x at %x\n", 226 pkt->isWrite() ? "write" : "read", req->getPaddr()); |
227 } |
228 } else { 229 if (pkt->isRead()) { 230 if (memcmp(pkt_data, data, pkt->getSize()) != 0) { 231 panic("%s: read of %x (blk %x) @ cycle %d " 232 "returns %x, expected %x\n", name(), 233 req->getPaddr(), blockAddr(req->getPaddr()), curTick(), 234 *pkt_data, *data); 235 } |
236 |
237 numReads++; 238 numReadsStat++; |
239 |
240 if (numReads == (uint64_t)nextProgressMessage) { 241 ccprintf(cerr, "%s: completed %d read, %d write accesses @%d\n", 242 name(), numReads, numWrites, curTick()); 243 nextProgressMessage += progressInterval; 244 } |
245 |
246 if (maxLoads != 0 && numReads >= maxLoads) 247 exitSimLoop("maximum number of loads reached"); 248 } else { 249 assert(pkt->isWrite()); 250 funcPort.writeBlob(req->getPaddr(), pkt_data, req->getSize()); 251 numWrites++; 252 numWritesStat++; 253 } |
254 } 255 256 noResponseCycles = 0; 257 delete state; 258 delete [] data; 259 delete pkt->req; 260 delete pkt; 261} --- 106 unchanged lines hidden (view full) --- 368 369 PacketPtr pkt = new Packet(req, MemCmd::ReadReq, Packet::Broadcast); 370 pkt->setSrc(0); 371 pkt->dataDynamicArray(new uint8_t[req->getSize()]); 372 MemTestSenderState *state = new MemTestSenderState(result); 373 pkt->senderState = state; 374 375 if (do_functional) { |
376 assert(pkt->needsResponse()); 377 pkt->setSuppressFuncError(); |
378 cachePort.sendFunctional(pkt); 379 completeRequest(pkt); 380 } else { 381 sendPkt(pkt); 382 } 383 } else { 384 // write 385 --- 15 unchanged lines hidden (view full) --- 401 PacketPtr pkt = new Packet(req, MemCmd::WriteReq, Packet::Broadcast); 402 pkt->setSrc(0); 403 uint8_t *pkt_data = new uint8_t[req->getSize()]; 404 pkt->dataDynamicArray(pkt_data); 405 memcpy(pkt_data, &data, req->getSize()); 406 MemTestSenderState *state = new MemTestSenderState(result); 407 pkt->senderState = state; 408 |
409 if (do_functional) { |
410 pkt->setSuppressFuncError(); |
411 cachePort.sendFunctional(pkt); 412 completeRequest(pkt); 413 } else { 414 sendPkt(pkt); 415 } 416 } 417} 418 --- 23 unchanged lines hidden --- |