summaryrefslogtreecommitdiff
path: root/src/cpu/simple/atomic.cc
diff options
context:
space:
mode:
authorKevin Lim <ktlim@umich.edu>2006-10-31 14:44:23 -0500
committerKevin Lim <ktlim@umich.edu>2006-10-31 14:44:23 -0500
commit2fa535f7407ad2a7e1e2ec807b72d11a81fa25aa (patch)
tree29a33ada141edad37b9304227f411a0195520869 /src/cpu/simple/atomic.cc
parente912080d12666482a942eae354e783c3d666c6c9 (diff)
parent7f39644609e19ada9e94c9bbb09c3e625fa6e8ed (diff)
downloadgem5-2fa535f7407ad2a7e1e2ec807b72d11a81fa25aa.tar.xz
Merge ktlim@zizzer:/bk/newmem
into zamp.eecs.umich.edu:/z/ktlim2/clean/o3-merge/newmem --HG-- extra : convert_revision : 88fa7ae5cc32be068787ee381fae9d8de0e9bd0f
Diffstat (limited to 'src/cpu/simple/atomic.cc')
-rw-r--r--src/cpu/simple/atomic.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/cpu/simple/atomic.cc b/src/cpu/simple/atomic.cc
index edba55b0d..11e4d2acb 100644
--- a/src/cpu/simple/atomic.cc
+++ b/src/cpu/simple/atomic.cc
@@ -188,8 +188,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);
+ }
}
}
}
@@ -217,7 +220,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;
}
}
@@ -234,7 +239,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;
}