diff options
author | Dam Sunwoo <dam.sunwoo@arm.com> | 2013-04-22 13:20:31 -0400 |
---|---|---|
committer | Dam Sunwoo <dam.sunwoo@arm.com> | 2013-04-22 13:20:31 -0400 |
commit | e8381142b061fbdf2f22d958f1c7559e9ffb3bd8 (patch) | |
tree | 452e96de7f6322d62f325992a9ce5d1d2a3c3bbb /src/sim/clocked_object.hh | |
parent | 2c1e34431326381833de289b1d90f2427ba16c98 (diff) | |
download | gem5-e8381142b061fbdf2f22d958f1c7559e9ffb3bd8.tar.xz |
sim: separate nextCycle() and clockEdge() in clockedObjects
Previously, nextCycle() could return the *current* cycle if the current tick was
already aligned with the clock edge. This behavior is not only confusing (not
quite what the function name implies), but also caused problems in the
drainResume() function. When exiting/re-entering the sim loop (e.g., to take
checkpoints), the CPUs will drain and resume. Due to the previous behavior of
nextCycle(), the CPU tick events were being rescheduled in the same ticks that
were already processed before draining. This caused divergence from runs that
did not exit/re-entered the sim loop. (Initially a cycle difference, but a
significant impact later on.)
This patch separates out the two behaviors (nextCycle() and clockEdge()),
uses nextCycle() in drainResume, and uses clockEdge() everywhere else.
Nothing (other than name) should change except for the drainResume timing.
Diffstat (limited to 'src/sim/clocked_object.hh')
-rw-r--r-- | src/sim/clocked_object.hh | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sim/clocked_object.hh b/src/sim/clocked_object.hh index bf132bee1..d836c48cc 100644 --- a/src/sim/clocked_object.hh +++ b/src/sim/clocked_object.hh @@ -172,13 +172,14 @@ class ClockedObject : public SimObject } /** - * Based on the clock of the object, determine the tick when the - * next cycle begins, in other words, return the next clock edge. + * Based on the clock of the object, determine the tick when the next + * cycle begins, in other words, return the next clock edge. + * (This can never be the current tick.) * * @return The tick when the next cycle starts */ Tick nextCycle() const - { return clockEdge(); } + { return clockEdge(Cycles(1)); } inline uint64_t frequency() const { return SimClock::Frequency / clock; } |