using namespace std;
SimpleCPU::TickEvent::TickEvent(SimpleCPU *c)
- : Event(&mainEventQueue, CPU_Tick_Pri), cpu(c)
+ : Event(&mainEventQueue, CPU_Tick_Pri), cpu(c), multiplier(1)
{
}
void
SimpleCPU::TickEvent::process()
{
- cpu->tick();
+ int count = multiplier;
+ do {
+ cpu->tick();
+ } while (--count > 0 && cpu->status() == Running);
}
const char *
.desc("Number of memory references")
;
+ notIdleFraction
+ .name(name() + ".not_idle_fraction")
+ .desc("Percentage of non-idle cycles")
+ ;
+
idleFraction
.name(name() + ".idle_fraction")
.desc("Percentage of idle cycles")
SimObjectParam<BaseMem *> dcache;
Param<bool> defer_registration;
+ Param<int> multiplier;
END_DECLARE_SIM_OBJECT_PARAMS(SimpleCPU)
INIT_PARAM_DFLT(icache, "L1 instruction cache object", NULL),
INIT_PARAM_DFLT(dcache, "L1 data cache object", NULL),
INIT_PARAM_DFLT(defer_registration, "defer registration with system "
- "(for sampling)", false)
+ "(for sampling)", false),
+
+ INIT_PARAM_DFLT(multiplier, "clock multiplier", 1)
END_INIT_SIM_OBJECT_PARAMS(SimpleCPU)
#endif // FULL_SYSTEM
+ cpu->setTickMultiplier(multiplier);
+
return cpu;
}
void tick();
private:
- class TickEvent : public Event
+ struct TickEvent : public Event
{
- private:
SimpleCPU *cpu;
+ int multiplier;
- public:
TickEvent(SimpleCPU *c);
void process();
const char *description();
tickEvent.squash();
}
+ public:
+ void setTickMultiplier(int multiplier)
+ {
+ tickEvent.multiplier = multiplier;
+ }
+
private:
Trace::InstRecord *traceData;
template<typename T>