summaryrefslogtreecommitdiff
path: root/src/cpu/simple
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/simple')
-rw-r--r--src/cpu/simple/atomic.cc16
-rw-r--r--src/cpu/simple/base.cc6
2 files changed, 16 insertions, 6 deletions
diff --git a/src/cpu/simple/atomic.cc b/src/cpu/simple/atomic.cc
index bfb80dc0f..dace83ac0 100644
--- a/src/cpu/simple/atomic.cc
+++ b/src/cpu/simple/atomic.cc
@@ -179,8 +179,11 @@ AtomicSimpleCPU::resume()
changeState(SimObject::Running);
if (thread->status() == ThreadContext::Active) {
- if (!tickEvent.scheduled())
- tickEvent.schedule(curTick);
+ if (!tickEvent.scheduled()) {
+ Tick nextTick = curTick + cycles(1) - 1;
+ nextTick -= (nextTick % (cycles(1)));
+ tickEvent.schedule(nextTick);
+ }
}
}
}
@@ -208,7 +211,9 @@ AtomicSimpleCPU::takeOverFrom(BaseCPU *oldCPU)
ThreadContext *tc = threadContexts[i];
if (tc->status() == ThreadContext::Active && _status != Running) {
_status = Running;
- tickEvent.schedule(curTick);
+ Tick nextTick = curTick + cycles(1) - 1;
+ nextTick -= (nextTick % (cycles(1)));
+ tickEvent.schedule(nextTick);
break;
}
}
@@ -225,7 +230,10 @@ AtomicSimpleCPU::activateContext(int thread_num, int delay)
assert(!tickEvent.scheduled());
notIdleFraction++;
- tickEvent.schedule(curTick + cycles(delay));
+ //Make sure ticks are still on multiples of cycles
+ Tick nextTick = curTick + cycles(delay + 1) - 1;
+ nextTick -= (nextTick % (cycles(1)));
+ tickEvent.schedule(nextTick);
_status = Running;
}
diff --git a/src/cpu/simple/base.cc b/src/cpu/simple/base.cc
index dc06c17f5..47b3b938f 100644
--- a/src/cpu/simple/base.cc
+++ b/src/cpu/simple/base.cc
@@ -401,13 +401,15 @@ BaseSimpleCPU::preExecute()
StaticInstPtr instPtr = StaticInst::decode(makeExtMI(inst, thread->getTC()));
if (instPtr->isMacroOp()) {
curMacroStaticInst = instPtr;
- curStaticInst = curMacroStaticInst->fetchMicroOp(0);
+ curStaticInst = curMacroStaticInst->
+ fetchMicroOp(thread->readMicroPC());
} else {
curStaticInst = instPtr;
}
} else {
//Read the next micro op from the macro op
- curStaticInst = curMacroStaticInst->fetchMicroOp(thread->readMicroPC());
+ curStaticInst = curMacroStaticInst->
+ fetchMicroOp(thread->readMicroPC());
}