summaryrefslogtreecommitdiff
path: root/cpu/simple_cpu/simple_cpu.cc
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2004-07-14 23:01:54 -0400
committerNathan Binkert <binkertn@umich.edu>2004-07-14 23:01:54 -0400
commitbc5c52335c73b761aed596d56eadfaa966e012f3 (patch)
tree637f162772670e15a76b881973efe1b126fa66e2 /cpu/simple_cpu/simple_cpu.cc
parent5c20353129101f34c837bd4caa1129a0127d6d19 (diff)
downloadgem5-bc5c52335c73b761aed596d56eadfaa966e012f3.tar.xz
Add a clock multiplier for simple CPU so that it is possible
to do multiple instructions per cycle. --HG-- extra : convert_revision : 5588ae38071f170792aad93899fef6842b7d818d
Diffstat (limited to 'cpu/simple_cpu/simple_cpu.cc')
-rw-r--r--cpu/simple_cpu/simple_cpu.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/cpu/simple_cpu/simple_cpu.cc b/cpu/simple_cpu/simple_cpu.cc
index d70f0ccfa..6c22d7c81 100644
--- a/cpu/simple_cpu/simple_cpu.cc
+++ b/cpu/simple_cpu/simple_cpu.cc
@@ -75,14 +75,17 @@
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 *
@@ -269,6 +272,11 @@ SimpleCPU::regStats()
.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")
@@ -799,6 +807,7 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(SimpleCPU)
SimObjectParam<BaseMem *> dcache;
Param<bool> defer_registration;
+ Param<int> multiplier;
END_DECLARE_SIM_OBJECT_PARAMS(SimpleCPU)
@@ -830,7 +839,9 @@ BEGIN_INIT_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)
@@ -861,6 +872,8 @@ CREATE_SIM_OBJECT(SimpleCPU)
#endif // FULL_SYSTEM
+ cpu->setTickMultiplier(multiplier);
+
return cpu;
}