summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/clocked_object.hh19
-rw-r--r--src/sim/process.cc2
-rw-r--r--src/sim/pseudo_inst.cc2
3 files changed, 11 insertions, 12 deletions
diff --git a/src/sim/clocked_object.hh b/src/sim/clocked_object.hh
index 050a15a74..78539c9c9 100644
--- a/src/sim/clocked_object.hh
+++ b/src/sim/clocked_object.hh
@@ -64,7 +64,7 @@ class ClockedObject : public SimObject
// The cycle counter value corresponding to the current value of
// 'tick'
- mutable Tick cycle;
+ mutable Cycles cycle;
/**
* Prevent inadvertent use of the copy constructor and assignment
@@ -96,7 +96,7 @@ class ClockedObject : public SimObject
// if not, we have to recalculate the cycle and tick, we
// perform the calculations in terms of relative cycles to
// allow changes to the clock period in the future
- Tick elapsedCycles = divCeil(curTick() - tick, clock);
+ Cycles elapsedCycles(divCeil(curTick() - tick, clock));
cycle += elapsedCycles;
tick += elapsedCycles * clock;
}
@@ -130,22 +130,22 @@ class ClockedObject : public SimObject
*
* @return The tick when the clock edge occurs
*/
- inline Tick clockEdge(int cycles = 0) const
+ inline Tick clockEdge(Cycles cycles = Cycles(0)) const
{
// align tick to the next clock edge
update();
// figure out when this future cycle is
- return tick + ticks(cycles);
+ return tick + clock * cycles;
}
/**
* Determine the current cycle, corresponding to a tick aligned to
* a clock edge.
*
- * @return The current cycle
+ * @return The current cycle count
*/
- inline Tick curCycle() const
+ inline Cycles curCycle() const
{
// align cycle to the next clock edge.
update();
@@ -162,13 +162,12 @@ class ClockedObject : public SimObject
Tick nextCycle() const
{ return clockEdge(); }
- inline Tick frequency() const { return SimClock::Frequency / clock; }
-
- inline Tick ticks(int cycles) const { return clock * cycles; }
+ inline uint64_t frequency() const { return SimClock::Frequency / clock; }
inline Tick clockPeriod() const { return clock; }
- inline Tick tickToCycle(Tick tick) const { return tick / clock; }
+ inline Cycles ticksToCycles(Tick tick) const
+ { return Cycles(tick / clock); }
};
diff --git a/src/sim/process.cc b/src/sim/process.cc
index f92fb91e2..08636b2c4 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -245,7 +245,7 @@ Process::initState()
ThreadContext *tc = system->getThreadContext(contextIds[0]);
// mark this context as active so it will start ticking.
- tc->activate(0);
+ tc->activate(Cycles(0));
}
// map simulator fd sim_fd to target fd tgt_fd
diff --git a/src/sim/pseudo_inst.cc b/src/sim/pseudo_inst.cc
index 8a7f0c469..aafa5672b 100644
--- a/src/sim/pseudo_inst.cc
+++ b/src/sim/pseudo_inst.cc
@@ -172,7 +172,7 @@ quiesceCycles(ThreadContext *tc, uint64_t cycles)
EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
- Tick resume = curTick() + cpu->ticks(cycles);
+ Tick resume = cpu->clockEdge(Cycles(cycles));
cpu->reschedule(quiesceEvent, resume, true);