diff --git a/src/cpu/base.cc b/src/cpu/base.cc --- a/src/cpu/base.cc +++ b/src/cpu/base.cc @@ -691,6 +691,12 @@ comInstEventQueue[tid]->schedule(event, now + insts); } +uint64_t +BaseCPU::getCurrentInstCount(ThreadID tid) +{ + return Tick(comInstEventQueue[tid]->getCurTick()); +} + AddressMonitor::AddressMonitor() { armed = false; waiting = false; # Node ID 6271a83cca898e55329d69e9aed2e7e4fdcf6fd1 # Parent f3f72c0ab03eac35ff4b2ab14214b66ec9c11c49 diff --git a/src/cpu/BaseCPU.py b/src/cpu/BaseCPU.py --- a/src/cpu/BaseCPU.py +++ b/src/cpu/BaseCPU.py @@ -101,6 +101,7 @@ Counter totalInsts(); void scheduleInstStop(ThreadID tid, Counter insts, const char *cause); void scheduleLoadStop(ThreadID tid, Counter loads, const char *cause); + uint64_t getCurrentInstCount(ThreadID tid); ''') @classmethod diff --git a/src/cpu/base.hh b/src/cpu/base.hh --- a/src/cpu/base.hh +++ b/src/cpu/base.hh @@ -465,6 +465,15 @@ */ void scheduleLoadStop(ThreadID tid, Counter loads, const char *cause); + /** + * Get the number of instructions executed by the specified thread + * on this CPU. Used by Python to control simulation. + * + * @param tid Thread monitor + * @return Number of instructions executed + */ + uint64_t getCurrentInstCount(ThreadID tid); + public: /** * @{