bool needToFetch = !isRomMicroPC(pcState.microPC()) && !curMacroStaticInst;
if (needToFetch) {
+ _status = Running;
Request *ifetch_req = new Request();
ifetch_req->setThreadContext(_cpuId, /* thread ID */ 0);
setupFetchRequest(ifetch_req);
void
TimingSimpleCPU::advanceInst(Fault fault)
{
- if (fault != NoFault || !stayAtPC)
+
+ if (_status == Faulting)
+ return;
+
+ if (fault != NoFault) {
+ advancePC(fault);
+ DPRINTF(SimpleCPU, "Fault occured, scheduling fetch event\n");
+ reschedule(fetchEvent, nextCycle(), true);
+ _status = Faulting;
+ return;
+ }
+
+
+ if (!stayAtPC)
advancePC(fault);
if (_status == Running) {
void
TimingSimpleCPU::completeIfetch(PacketPtr pkt)
{
- DPRINTF(SimpleCPU, "Complete ICache Fetch\n");
-
// received a response from the icache: execute the received
// instruction
tickEvent.schedule(pkt, next_tick);
return true;
- }
- else if (pkt->wasNacked()) {
+ } else if (pkt->wasNacked()) {
assert(cpu->_status == IcacheWaitResponse);
pkt->reinitNacked();
if (!sendTiming(pkt)) {