diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2006-10-27 07:09:14 -0400 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2006-10-27 07:09:14 -0400 |
commit | a46e19f7384eb3e6a03136ddab5ba74716e43eb6 (patch) | |
tree | 5d468a84c5dc7c6385289b88ece673aeeb1e974d | |
parent | d5974eff73a3cb69e50754ba92f65a73c904c2e0 (diff) | |
download | gem5-a46e19f7384eb3e6a03136ddab5ba74716e43eb6.tar.xz |
A more complete attempt to fix the clock skew.
--HG--
extra : convert_revision : b2d505de51fc5fcae5177b2a13140729474e249e
-rw-r--r-- | src/cpu/simple/atomic.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/cpu/simple/atomic.cc b/src/cpu/simple/atomic.cc index b4ea4b216..a72f6361a 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; } } @@ -237,7 +242,7 @@ AtomicSimpleCPU::activateContext(int thread_num, int delay) //Make sure ticks are still on multiples of cycles Tick nextTick = curTick + cycles(1) - 1; nextTick -= (nextTick % (cycles(1))); - tickEvent.schedule(curTick + cycles(delay)); + tickEvent.schedule(nextTick); _status = Running; } |