summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-08-21 05:49:09 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2012-08-21 05:49:09 -0400
commit016593f2e91564dc9d675ae42dfd37059f9b5589 (patch)
tree9eed2d90618a4eccbd6b3c743c4d7545bfb935dd
parent452217817f421a64bc022a5977e795229af45b30 (diff)
downloadgem5-016593f2e91564dc9d675ae42dfd37059f9b5589.tar.xz
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.
-rw-r--r--src/base/types.hh8
-rw-r--r--src/cpu/o3/cpu.cc6
-rw-r--r--src/sim/eventq.hh8
3 files changed, 9 insertions, 13 deletions
diff --git a/src/base/types.hh b/src/base/types.hh
index 3105059ed..ba6d53ad7 100644
--- a/src/base/types.hh
+++ b/src/base/types.hh
@@ -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 --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc
index 64c54e26a..71d04740c 100644
--- a/src/cpu/o3/cpu.cc
+++ b/src/cpu/o3/cpu.cc
@@ -388,7 +388,7 @@ FullO3CPU<Impl>::FullO3CPU(DerivO3CPUParams *params)
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 @@ FullO3CPU<Impl>::activateContext(ThreadID tid, int delay)
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 --git a/src/sim/eventq.hh b/src/sim/eventq.hh
index 09483f4e2..c46902889 100644
--- a/src/sim/eventq.hh
+++ b/src/sim/eventq.hh
@@ -481,9 +481,7 @@ class EventManager
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 @@ EventQueue::deschedule(Event *event)
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());