Simple CPU: Make sure only instructions which complete without faulting are counted.
--HG-- extra : convert_revision : 01019c7129ed762d8826c3e6519989aa3fc3b5fd
This commit is contained in:
parent
537239b278
commit
e056e49c45
4 changed files with 27 additions and 6 deletions
|
@ -546,6 +546,11 @@ AtomicSimpleCPU::tick()
|
||||||
if(curStaticInst)
|
if(curStaticInst)
|
||||||
{
|
{
|
||||||
fault = curStaticInst->execute(this, traceData);
|
fault = curStaticInst->execute(this, traceData);
|
||||||
|
|
||||||
|
// keep an instruction count
|
||||||
|
if (fault == NoFault)
|
||||||
|
countInst();
|
||||||
|
|
||||||
postExecute();
|
postExecute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -357,12 +357,6 @@ BaseSimpleCPU::preExecute()
|
||||||
thread->setFloatReg(ZeroReg, 0.0);
|
thread->setFloatReg(ZeroReg, 0.0);
|
||||||
#endif // ALPHA_ISA
|
#endif // ALPHA_ISA
|
||||||
|
|
||||||
// keep an instruction count
|
|
||||||
numInst++;
|
|
||||||
numInsts++;
|
|
||||||
|
|
||||||
thread->funcExeInst++;
|
|
||||||
|
|
||||||
// check for instruction-count-based events
|
// check for instruction-count-based events
|
||||||
comInstEventQueue[0]->serviceEvents(numInst);
|
comInstEventQueue[0]->serviceEvents(numInst);
|
||||||
|
|
||||||
|
|
|
@ -157,6 +157,14 @@ class BaseSimpleCPU : public BaseCPU
|
||||||
Counter startNumInst;
|
Counter startNumInst;
|
||||||
Stats::Scalar<> numInsts;
|
Stats::Scalar<> numInsts;
|
||||||
|
|
||||||
|
void countInst()
|
||||||
|
{
|
||||||
|
numInst++;
|
||||||
|
numInsts++;
|
||||||
|
|
||||||
|
thread->funcExeInst++;
|
||||||
|
}
|
||||||
|
|
||||||
virtual Counter totalInstructions() const
|
virtual Counter totalInstructions() const
|
||||||
{
|
{
|
||||||
return numInst - startNumInst;
|
return numInst - startNumInst;
|
||||||
|
|
|
@ -540,13 +540,23 @@ TimingSimpleCPU::completeIfetch(PacketPtr pkt)
|
||||||
delete dcache_pkt->req;
|
delete dcache_pkt->req;
|
||||||
delete dcache_pkt;
|
delete dcache_pkt;
|
||||||
dcache_pkt = NULL;
|
dcache_pkt = NULL;
|
||||||
|
|
||||||
|
// keep an instruction count
|
||||||
|
if (fault == NoFault)
|
||||||
|
countInst();
|
||||||
}
|
}
|
||||||
|
|
||||||
postExecute();
|
postExecute();
|
||||||
advanceInst(fault);
|
advanceInst(fault);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// non-memory instruction: execute completely now
|
// non-memory instruction: execute completely now
|
||||||
Fault fault = curStaticInst->execute(this, traceData);
|
Fault fault = curStaticInst->execute(this, traceData);
|
||||||
|
|
||||||
|
// keep an instruction count
|
||||||
|
if (fault == NoFault)
|
||||||
|
countInst();
|
||||||
|
|
||||||
postExecute();
|
postExecute();
|
||||||
advanceInst(fault);
|
advanceInst(fault);
|
||||||
}
|
}
|
||||||
|
@ -615,6 +625,10 @@ TimingSimpleCPU::completeDataAccess(PacketPtr pkt)
|
||||||
|
|
||||||
Fault fault = curStaticInst->completeAcc(pkt, this, traceData);
|
Fault fault = curStaticInst->completeAcc(pkt, this, traceData);
|
||||||
|
|
||||||
|
// keep an instruction count
|
||||||
|
if (fault == NoFault)
|
||||||
|
countInst();
|
||||||
|
|
||||||
if (pkt->isRead() && pkt->isLocked()) {
|
if (pkt->isRead() && pkt->isLocked()) {
|
||||||
TheISA::handleLockedRead(thread, pkt->req);
|
TheISA::handleLockedRead(thread, pkt->req);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue