1/* 2 * Copyright (c) 2010 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 --- 715 unchanged lines hidden (view full) --- 724 TheISA::PCState pcState = thread->pcState(); 725 bool needToFetch = !isRomMicroPC(pcState.microPC()) && !curMacroStaticInst; 726 727 if (needToFetch) { 728 _status = Running; 729 Request *ifetch_req = new Request(); 730 ifetch_req->setThreadContext(_cpuId, /* thread ID */ 0); 731 setupFetchRequest(ifetch_req); |
732 DPRINTF(SimpleCPU, "Translating address %#x\n", ifetch_req->getVaddr()); |
733 thread->itb->translateTiming(ifetch_req, tc, &fetchTranslation, 734 BaseTLB::Execute); 735 } else { 736 _status = IcacheWaitResponse; 737 completeIfetch(NULL); 738 739 numCycles += tickToCycles(curTick() - previousTick); 740 previousTick = curTick(); 741 } 742} 743 744 745void 746TimingSimpleCPU::sendFetch(Fault fault, RequestPtr req, ThreadContext *tc) 747{ 748 if (fault == NoFault) { |
749 DPRINTF(SimpleCPU, "Sending fetch for addr %#x(pa: %#x)\n", 750 req->getVaddr(), req->getPaddr()); |
751 ifetch_pkt = new Packet(req, MemCmd::ReadReq, Packet::Broadcast); 752 ifetch_pkt->dataStatic(&inst); |
753 DPRINTF(SimpleCPU, " -- pkt addr: %#x\n", ifetch_pkt->getAddr()); |
754 755 if (!icachePort.sendTiming(ifetch_pkt)) { 756 // Need to wait for retry 757 _status = IcacheRetry; 758 } else { 759 // Need to wait for cache to respond 760 _status = IcacheWaitResponse; 761 // ownership of packet transferred to memory system 762 ifetch_pkt = NULL; 763 } 764 } else { |
765 DPRINTF(SimpleCPU, "Translation of addr %#x faulted\n", req->getVaddr()); |
766 delete req; 767 // fetch fault: advance directly to next instruction (fault handler) 768 _status = Running; 769 advanceInst(fault); 770 } 771 772 numCycles += tickToCycles(curTick() - previousTick); 773 previousTick = curTick(); --- 26 unchanged lines hidden (view full) --- 800 fetch(); 801 } 802} 803 804 805void 806TimingSimpleCPU::completeIfetch(PacketPtr pkt) 807{ |
808 DPRINTF(SimpleCPU, "Complete ICache Fetch for addr %#x\n", pkt ? 809 pkt->getAddr() : 0); 810 |
811 // received a response from the icache: execute the received 812 // instruction 813 814 assert(!pkt || !pkt->isError()); 815 assert(_status == IcacheWaitResponse); 816 817 _status = Running; 818 --- 65 unchanged lines hidden (view full) --- 884{ 885 cpu->completeIfetch(pkt); 886} 887 888bool 889TimingSimpleCPU::IcachePort::recvTiming(PacketPtr pkt) 890{ 891 if (pkt->isResponse() && !pkt->wasNacked()) { |
892 DPRINTF(SimpleCPU, "Received timing response %#x\n", pkt->getAddr()); |
893 // delay processing of returned data until next CPU clock edge 894 Tick next_tick = cpu->nextCycle(curTick()); 895 896 if (next_tick == curTick()) 897 cpu->completeIfetch(pkt); 898 else 899 tickEvent.schedule(pkt, next_tick); 900 --- 246 unchanged lines hidden --- |