X86: Don't fetch in the simple CPU if you're in the ROM.
This commit is contained in:
parent
f245358343
commit
0756dbb37a
|
@ -718,31 +718,37 @@ AtomicSimpleCPU::tick()
|
||||||
|
|
||||||
checkPcEventQueue();
|
checkPcEventQueue();
|
||||||
|
|
||||||
Fault fault = setupFetchRequest(&ifetch_req);
|
Fault fault = NoFault;
|
||||||
|
|
||||||
|
bool fromRom = isRomMicroPC(thread->readMicroPC());
|
||||||
|
if (!fromRom)
|
||||||
|
fault = setupFetchRequest(&ifetch_req);
|
||||||
|
|
||||||
if (fault == NoFault) {
|
if (fault == NoFault) {
|
||||||
Tick icache_latency = 0;
|
Tick icache_latency = 0;
|
||||||
bool icache_access = false;
|
bool icache_access = false;
|
||||||
dcache_access = false; // assume no dcache access
|
dcache_access = false; // assume no dcache access
|
||||||
|
|
||||||
//Fetch more instruction memory if necessary
|
if (!fromRom) {
|
||||||
//if(predecoder.needMoreBytes())
|
//Fetch more instruction memory if necessary
|
||||||
//{
|
//if(predecoder.needMoreBytes())
|
||||||
icache_access = true;
|
//{
|
||||||
Packet ifetch_pkt = Packet(&ifetch_req, MemCmd::ReadReq,
|
icache_access = true;
|
||||||
Packet::Broadcast);
|
Packet ifetch_pkt = Packet(&ifetch_req, MemCmd::ReadReq,
|
||||||
ifetch_pkt.dataStatic(&inst);
|
Packet::Broadcast);
|
||||||
|
ifetch_pkt.dataStatic(&inst);
|
||||||
|
|
||||||
if (hasPhysMemPort && ifetch_pkt.getAddr() == physMemAddr)
|
if (hasPhysMemPort && ifetch_pkt.getAddr() == physMemAddr)
|
||||||
icache_latency = physmemPort.sendAtomic(&ifetch_pkt);
|
icache_latency = physmemPort.sendAtomic(&ifetch_pkt);
|
||||||
else
|
else
|
||||||
icache_latency = icachePort.sendAtomic(&ifetch_pkt);
|
icache_latency = icachePort.sendAtomic(&ifetch_pkt);
|
||||||
|
|
||||||
assert(!ifetch_pkt.isError());
|
assert(!ifetch_pkt.isError());
|
||||||
|
|
||||||
// ifetch_req is initialized to read the instruction directly
|
// ifetch_req is initialized to read the instruction directly
|
||||||
// into the CPU object's inst field.
|
// into the CPU object's inst field.
|
||||||
//}
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
preExecute();
|
preExecute();
|
||||||
|
|
||||||
|
|
|
@ -531,28 +531,35 @@ TimingSimpleCPU::fetch()
|
||||||
|
|
||||||
checkPcEventQueue();
|
checkPcEventQueue();
|
||||||
|
|
||||||
Request *ifetch_req = new Request();
|
bool fromRom = isRomMicroPC(thread->readMicroPC());
|
||||||
ifetch_req->setThreadContext(cpuId, /* thread ID */ 0);
|
|
||||||
Fault fault = setupFetchRequest(ifetch_req);
|
|
||||||
|
|
||||||
ifetch_pkt = new Packet(ifetch_req, MemCmd::ReadReq, Packet::Broadcast);
|
if (!fromRom) {
|
||||||
ifetch_pkt->dataStatic(&inst);
|
Request *ifetch_req = new Request();
|
||||||
|
ifetch_req->setThreadContext(cpuId, /* thread ID */ 0);
|
||||||
|
Fault fault = setupFetchRequest(ifetch_req);
|
||||||
|
|
||||||
if (fault == NoFault) {
|
ifetch_pkt = new Packet(ifetch_req, MemCmd::ReadReq, Packet::Broadcast);
|
||||||
if (!icachePort.sendTiming(ifetch_pkt)) {
|
ifetch_pkt->dataStatic(&inst);
|
||||||
// Need to wait for retry
|
|
||||||
_status = IcacheRetry;
|
if (fault == NoFault) {
|
||||||
|
if (!icachePort.sendTiming(ifetch_pkt)) {
|
||||||
|
// Need to wait for retry
|
||||||
|
_status = IcacheRetry;
|
||||||
|
} else {
|
||||||
|
// Need to wait for cache to respond
|
||||||
|
_status = IcacheWaitResponse;
|
||||||
|
// ownership of packet transferred to memory system
|
||||||
|
ifetch_pkt = NULL;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Need to wait for cache to respond
|
delete ifetch_req;
|
||||||
_status = IcacheWaitResponse;
|
delete ifetch_pkt;
|
||||||
// ownership of packet transferred to memory system
|
// fetch fault: advance directly to next instruction (fault handler)
|
||||||
ifetch_pkt = NULL;
|
advanceInst(fault);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
delete ifetch_req;
|
_status = IcacheWaitResponse;
|
||||||
delete ifetch_pkt;
|
completeIfetch(NULL);
|
||||||
// fetch fault: advance directly to next instruction (fault handler)
|
|
||||||
advanceInst(fault);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
numCycles += tickToCycles(curTick - previousTick);
|
numCycles += tickToCycles(curTick - previousTick);
|
||||||
|
@ -581,7 +588,8 @@ TimingSimpleCPU::completeIfetch(PacketPtr pkt)
|
||||||
|
|
||||||
// received a response from the icache: execute the received
|
// received a response from the icache: execute the received
|
||||||
// instruction
|
// instruction
|
||||||
assert(!pkt->isError());
|
|
||||||
|
assert(!pkt || !pkt->isError());
|
||||||
assert(_status == IcacheWaitResponse);
|
assert(_status == IcacheWaitResponse);
|
||||||
|
|
||||||
_status = Running;
|
_status = Running;
|
||||||
|
@ -590,8 +598,10 @@ TimingSimpleCPU::completeIfetch(PacketPtr pkt)
|
||||||
previousTick = curTick;
|
previousTick = curTick;
|
||||||
|
|
||||||
if (getState() == SimObject::Draining) {
|
if (getState() == SimObject::Draining) {
|
||||||
delete pkt->req;
|
if (pkt) {
|
||||||
delete pkt;
|
delete pkt->req;
|
||||||
|
delete pkt;
|
||||||
|
}
|
||||||
|
|
||||||
completeDrain();
|
completeDrain();
|
||||||
return;
|
return;
|
||||||
|
@ -658,8 +668,10 @@ TimingSimpleCPU::completeIfetch(PacketPtr pkt)
|
||||||
advanceInst(fault);
|
advanceInst(fault);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pkt->req;
|
if (pkt) {
|
||||||
delete pkt;
|
delete pkt->req;
|
||||||
|
delete pkt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue