changeset d152d34a4adf in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=d152d34a4adf
description:
Clock: Make Tick unsigned and remove UTick
This patch makes the Tick unsigned and removes the UTick typedef. The
ticks should never be negative, and there was only one major issue
with removing it, caused by the o3 CPU using a -1 as an initial value.
The patch has no impact on any regressions.
diffstat:
src/base/types.hh | 8 +++-----
src/cpu/o3/cpu.cc | 6 ++++--
src/sim/eventq.hh | 8 ++------
3 files changed, 9 insertions(+), 13 deletions(-)
diffs (68 lines):
diff -r e0bad9d7bbd6 -r d152d34a4adf src/base/types.hh
--- a/src/base/types.hh Tue Aug 21 05:49:01 2012 -0400
+++ b/src/base/types.hh Tue Aug 21 05:49:09 2012 -0400
@@ -51,13 +51,11 @@
typedef int64_t Counter;
/**
- * Clock cycle count type.
- * @note using an unsigned breaks the cache.
+ * Tick count type.
*/
-typedef int64_t Tick;
-typedef uint64_t UTick;
+typedef uint64_t Tick;
-const Tick MaxTick = LL(0x7fffffffffffffff);
+const Tick MaxTick = ULL(0xffffffffffffffff);
/**
* Address type
diff -r e0bad9d7bbd6 -r d152d34a4adf src/cpu/o3/cpu.cc
--- a/src/cpu/o3/cpu.cc Tue Aug 21 05:49:01 2012 -0400
+++ b/src/cpu/o3/cpu.cc Tue Aug 21 05:49:09 2012 -0400
@@ -388,7 +388,7 @@
lastRunningCycle = curTick();
- lastActivatedCycle = -1;
+ lastActivatedCycle = 0;
#if 0
// Give renameMap & rename stage access to the freeList;
for (ThreadID tid = 0; tid < numThreads; tid++)
@@ -752,7 +752,9 @@
activateThread(tid);
}
- if (lastActivatedCycle < curTick()) {
+ // If we are time 0 or if the last activation time is in the past,
+ // schedule the next tick and wake up the fetch unit
+ if (lastActivatedCycle == 0 || lastActivatedCycle < curTick()) {
scheduleTickEvent(delay);
// Be sure to signal that there's some activity so the CPU doesn't
diff -r e0bad9d7bbd6 -r d152d34a4adf src/sim/eventq.hh
--- a/src/sim/eventq.hh Tue Aug 21 05:49:01 2012 -0400
+++ b/src/sim/eventq.hh Tue Aug 21 05:49:09 2012 -0400
@@ -481,9 +481,7 @@
inline void
EventQueue::schedule(Event *event, Tick when)
{
- // Typecasting Tick->Utick here since gcc
- // complains about signed overflow
- assert((UTick)when >= (UTick)curTick());
+ assert(when >= curTick());
assert(!event->scheduled());
assert(event->initialized());
@@ -520,9 +518,7 @@
inline void
EventQueue::reschedule(Event *event, Tick when, bool always)
{
- // Typecasting Tick->Utick here since gcc
- // complains about signed overflow
- assert((UTick)when >= (UTick)curTick());
+ assert(when >= curTick());
assert(always || event->scheduled());
assert(event->initialized());
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev