cpu: Fix timing CPU drain check

This patch modifies the SimpleTimingCPU drain check to also consider
the fetch event. Previously, there was an assumption that there is
never a fetch event scheduled if the CPU is not executing
microcode. However, when a context is activated, a fetch even is
scheduled, and microPC() is zero.
This commit is contained in:
Andreas Hansson 2013-08-19 03:52:30 -04:00
parent f7d44590cb
commit 7a61f667f0
2 changed files with 5 additions and 3 deletions

View file

@ -109,7 +109,6 @@ TimingSimpleCPU::drain(DrainManager *drain_manager)
if (_status == Idle || if (_status == Idle ||
(_status == BaseSimpleCPU::Running && isDrained())) { (_status == BaseSimpleCPU::Running && isDrained())) {
assert(!fetchEvent.scheduled());
DPRINTF(Drain, "No need to drain.\n"); DPRINTF(Drain, "No need to drain.\n");
return 0; return 0;
} else { } else {

View file

@ -320,11 +320,14 @@ class TimingSimpleCPU : public BaseSimpleCPU
* of a gem5 microcode sequence. * of a gem5 microcode sequence.
* *
* <li>Stay at PC is true. * <li>Stay at PC is true.
*
* <li>A fetch event is scheduled. Normally this would never be the
case with microPC() == 0, but right after a context is
activated it can happen.
* </ul> * </ul>
*/ */
bool isDrained() { bool isDrained() {
return microPC() == 0 && return microPC() == 0 && !stayAtPC && !fetchEvent.scheduled();
!stayAtPC;
} }
/** /**