summaryrefslogtreecommitdiff
path: root/src/cpu/base.cc
diff options
context:
space:
mode:
authorKevin Lim <ktlim@umich.edu>2006-11-06 13:27:45 -0500
committerKevin Lim <ktlim@umich.edu>2006-11-06 13:27:45 -0500
commit652281a61c6be7210b575e50566e7efdc82ab6ba (patch)
treeee9532bc451a62a5cc68cb41646794f5165fe14a /src/cpu/base.cc
parent257e09d62622676b84b5166854850024a5f72bcc (diff)
downloadgem5-652281a61c6be7210b575e50566e7efdc82ab6ba.tar.xz
Clean up clock phase drift code a bit.
src/cpu/base.cc: Move clock phase drift code to the base CPU so that any CPU model can use it. src/cpu/base.hh: Added two functions to help get the next cycle the CPU should be scheduled. src/cpu/simple/atomic.cc: src/cpu/simple/timing.cc: Use the function now in BaseCPU. --HG-- extra : convert_revision : 444494b66ffc85fc473c23f57683c5f9458ad80c
Diffstat (limited to 'src/cpu/base.cc')
-rw-r--r--src/cpu/base.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/cpu/base.cc b/src/cpu/base.cc
index ea4b03bf2..55ceea8fb 100644
--- a/src/cpu/base.cc
+++ b/src/cpu/base.cc
@@ -259,6 +259,26 @@ BaseCPU::regStats()
#endif
}
+Tick
+BaseCPU::nextCycle()
+{
+ Tick next_tick = curTick + clock - 1;
+ next_tick -= (next_tick % clock);
+ return next_tick;
+}
+
+Tick
+BaseCPU::nextCycle(Tick begin_tick)
+{
+ Tick next_tick = begin_tick;
+
+ while (next_tick < curTick)
+ next_tick += clock;
+
+ next_tick -= (next_tick % clock);
+ assert(next_tick >= curTick);
+ return next_tick;
+}
void
BaseCPU::registerThreadContexts()