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 --- 711 unchanged lines hidden (view full) --- 720 // We must have just got suspended by a PC event 721 if (_status == Idle) 722 return; 723 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 thread->itb->translateTiming(ifetch_req, tc, &fetchTranslation, 733 BaseTLB::Execute); 734 } else { 735 _status = IcacheWaitResponse; 736 completeIfetch(NULL); --- 30 unchanged lines hidden (view full) --- 767 numCycles += tickToCycles(curTick() - previousTick); 768 previousTick = curTick(); 769} 770 771 772void 773TimingSimpleCPU::advanceInst(Fault fault) 774{ |
775 776 if (_status == Faulting) 777 return; 778 779 if (fault != NoFault) { |
780 advancePC(fault); |
781 DPRINTF(SimpleCPU, "Fault occured, scheduling fetch event\n"); 782 reschedule(fetchEvent, nextCycle(), true); 783 _status = Faulting; 784 return; 785 } |
786 |
787 788 if (!stayAtPC) 789 advancePC(fault); 790 |
791 if (_status == Running) { 792 // kick off fetch of next instruction... callback from icache 793 // response will cause that instruction to be executed, 794 // keeping the CPU running. 795 fetch(); 796 } 797} 798 799 800void 801TimingSimpleCPU::completeIfetch(PacketPtr pkt) 802{ |
803 // received a response from the icache: execute the received 804 // instruction 805 806 assert(!pkt || !pkt->isError()); 807 assert(_status == IcacheWaitResponse); 808 809 _status = Running; 810 --- 74 unchanged lines hidden (view full) --- 885 Tick next_tick = cpu->nextCycle(curTick()); 886 887 if (next_tick == curTick()) 888 cpu->completeIfetch(pkt); 889 else 890 tickEvent.schedule(pkt, next_tick); 891 892 return true; |
893 } else if (pkt->wasNacked()) { |
894 assert(cpu->_status == IcacheWaitResponse); 895 pkt->reinitNacked(); 896 if (!sendTiming(pkt)) { 897 cpu->_status = IcacheRetry; 898 cpu->ifetch_pkt = pkt; 899 } 900 } 901 //Snooping a Coherence Request, do nothing --- 236 unchanged lines hidden --- |