traffic_gen.cc (9402:f6e3c60f04e5) | traffic_gen.cc (9403:af9066bc088c) |
---|---|
1/* 2 * Copyright (c) 2012 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 339 unchanged lines hidden (view full) --- 348TrafficGen::StateGraph::BaseGen::BaseGen(QueuedMasterPort& _port, 349 MasterID master_id, 350 Tick _duration) 351 : port(_port), masterID(master_id), duration(_duration) 352{ 353} 354 355void | 1/* 2 * Copyright (c) 2012 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 339 unchanged lines hidden (view full) --- 348TrafficGen::StateGraph::BaseGen::BaseGen(QueuedMasterPort& _port, 349 MasterID master_id, 350 Tick _duration) 351 : port(_port), masterID(master_id), duration(_duration) 352{ 353} 354 355void |
356TrafficGen::StateGraph::BaseGen::send(Addr addr, unsigned size, 357 const MemCmd& cmd) 358{ 359 // Create new request 360 Request::Flags flags; 361 Request *req = new Request(addr, size, flags, masterID); 362 363 // Embed it in a packet 364 PacketPtr pkt = new Packet(req, cmd); 365 366 uint8_t* pkt_data = new uint8_t[req->getSize()]; 367 pkt->dataDynamicArray(pkt_data); 368 369 if (cmd.isWrite()) { 370 memset(pkt_data, 0xA, req->getSize()); 371 } 372 373 port.schedTimingReq(pkt, curTick()); 374} 375 376void |
|
356TrafficGen::StateGraph::LinearGen::enter() 357{ 358 // reset the address and the data counter 359 nextAddr = startAddr; 360 dataManipulated = 0; 361 362 // this test only needs to happen once, but cannot be performed 363 // before init() is called and the ports are connected --- 11 unchanged lines hidden (view full) --- 375 (readPercent == 100 || random_mt.random<uint8_t>(0, 100) < readPercent); 376 377 assert((readPercent == 0 && !isRead) || (readPercent == 100 && isRead) || 378 readPercent != 100); 379 380 DPRINTF(TrafficGen, "LinearGen::execute: %c to addr %x, size %d\n", 381 isRead ? 'r' : 'w', nextAddr, blocksize); 382 | 377TrafficGen::StateGraph::LinearGen::enter() 378{ 379 // reset the address and the data counter 380 nextAddr = startAddr; 381 dataManipulated = 0; 382 383 // this test only needs to happen once, but cannot be performed 384 // before init() is called and the ports are connected --- 11 unchanged lines hidden (view full) --- 396 (readPercent == 100 || random_mt.random<uint8_t>(0, 100) < readPercent); 397 398 assert((readPercent == 0 && !isRead) || (readPercent == 100 && isRead) || 399 readPercent != 100); 400 401 DPRINTF(TrafficGen, "LinearGen::execute: %c to addr %x, size %d\n", 402 isRead ? 'r' : 'w', nextAddr, blocksize); 403 |
383 // Create new request 384 Request::Flags flags; 385 Request *req = new Request(nextAddr, blocksize, flags, masterID); | 404 send(nextAddr, blocksize, isRead ? MemCmd::ReadReq : MemCmd::WriteReq); |
386 | 405 |
387 PacketPtr pkt = new Packet(req, isRead ? MemCmd::ReadReq : 388 MemCmd::WriteReq); 389 390 uint8_t* pkt_data = new uint8_t[req->getSize()]; 391 pkt->dataDynamicArray(pkt_data); 392 393 if (!isRead) { 394 memset(pkt_data, 0xA, req->getSize()); 395 } 396 397 port.schedTimingReq(pkt, curTick()); 398 | |
399 // increment the address 400 nextAddr += blocksize; 401 402 // Add the amount of data manipulated to the total 403 dataManipulated += blocksize; 404} 405 406Tick --- 47 unchanged lines hidden (view full) --- 454 Addr addr = random_mt.random<Addr>(startAddr, endAddr - 1); 455 456 // round down to start address of block 457 addr -= addr % blocksize; 458 459 DPRINTF(TrafficGen, "RandomGen::execute: %c to addr %x, size %d\n", 460 isRead ? 'r' : 'w', addr, blocksize); 461 | 406 // increment the address 407 nextAddr += blocksize; 408 409 // Add the amount of data manipulated to the total 410 dataManipulated += blocksize; 411} 412 413Tick --- 47 unchanged lines hidden (view full) --- 461 Addr addr = random_mt.random<Addr>(startAddr, endAddr - 1); 462 463 // round down to start address of block 464 addr -= addr % blocksize; 465 466 DPRINTF(TrafficGen, "RandomGen::execute: %c to addr %x, size %d\n", 467 isRead ? 'r' : 'w', addr, blocksize); 468 |
462 // create new request packet 463 Request::Flags flags; 464 Request *req = new Request(addr, blocksize, flags, masterID); | 469 // send a new request packet 470 send(addr, blocksize, isRead ? MemCmd::ReadReq : MemCmd::WriteReq); |
465 | 471 |
466 PacketPtr pkt = new Packet(req, isRead ? MemCmd::ReadReq : 467 MemCmd::WriteReq); 468 469 uint8_t* pkt_data = new uint8_t[req->getSize()]; 470 pkt->dataDynamicArray(pkt_data); 471 472 if (!isRead) { 473 memset(pkt_data, 0xA, req->getSize()); 474 } 475 476 port.schedTimingReq(pkt, curTick()); 477 | |
478 // Add the amount of data manipulated to the total 479 dataManipulated += blocksize; 480} 481 482Tick 483TrafficGen::StateGraph::RandomGen::nextExecuteTick() 484{ 485 // Check to see if we have reached the data limit. If dataLimit is --- 105 unchanged lines hidden (view full) --- 591 assert(currElement.isValid()); 592 593 DPRINTF(TrafficGen, "TraceGen::execute: %c %d %d %d\n", 594 currElement.cmd.isRead() ? 'r' : 'w', 595 currElement.addr, 596 currElement.blocksize, 597 currElement.tick); 598 | 472 // Add the amount of data manipulated to the total 473 dataManipulated += blocksize; 474} 475 476Tick 477TrafficGen::StateGraph::RandomGen::nextExecuteTick() 478{ 479 // Check to see if we have reached the data limit. If dataLimit is --- 105 unchanged lines hidden (view full) --- 585 assert(currElement.isValid()); 586 587 DPRINTF(TrafficGen, "TraceGen::execute: %c %d %d %d\n", 588 currElement.cmd.isRead() ? 'r' : 'w', 589 currElement.addr, 590 currElement.blocksize, 591 currElement.tick); 592 |
599 Request::Flags flags; 600 Request *req = new Request(currElement.addr + addrOffset, 601 currElement.blocksize, flags, masterID); 602 603 PacketPtr pkt = new Packet(req, currElement.cmd); 604 605 uint8_t* pkt_data = new uint8_t[req->getSize()]; 606 pkt->dataDynamicArray(pkt_data); 607 608 if (currElement.cmd.isWrite()) { 609 memset(pkt_data, 0xA, req->getSize()); 610 } 611 612 port.schedTimingReq(pkt, curTick()); | 593 send(currElement.addr + addrOffset, currElement.blocksize, 594 currElement.cmd); |
613} 614 615void 616TrafficGen::StateGraph::TraceGen::exit() { 617 // Check if we reached the end of the trace file. If we did not 618 // then we want to generate a warning stating that not the entire 619 // trace was played. 620 if (!traceComplete) { --- 17 unchanged lines hidden --- | 595} 596 597void 598TrafficGen::StateGraph::TraceGen::exit() { 599 // Check if we reached the end of the trace file. If we did not 600 // then we want to generate a warning stating that not the entire 601 // trace was played. 602 if (!traceComplete) { --- 17 unchanged lines hidden --- |