summaryrefslogtreecommitdiff
path: root/cpu/base_cpu.cc
diff options
context:
space:
mode:
authorErik Hallnor <ehallnor@umich.edu>2003-10-16 17:04:18 -0400
committerErik Hallnor <ehallnor@umich.edu>2003-10-16 17:04:18 -0400
commit4134477369028e04dd265a43753868c01912c465 (patch)
tree23879b12a0c0079848cd97b294d141ae8cc4acde /cpu/base_cpu.cc
parentea5dc1d5dfabd31bdd62c8435f84ea21bf0f61c7 (diff)
downloadgem5-4134477369028e04dd265a43753868c01912c465.tar.xz
Add a commited loads event queue similar to the one for commited instructions.
Two new parameters for the CPU models, max_loads_any_thread and max_loads_all_threads. cpu/memtest/memtest.cc: cpu/memtest/memtest.hh: Swap out maxReads for the new commited loads model. --HG-- extra : convert_revision : 35031329bbc476122b2203104537a9f8b46addfa
Diffstat (limited to 'cpu/base_cpu.cc')
-rw-r--r--cpu/base_cpu.cc32
1 files changed, 31 insertions, 1 deletions
diff --git a/cpu/base_cpu.cc b/cpu/base_cpu.cc
index 90785946e..2e1d95d88 100644
--- a/cpu/base_cpu.cc
+++ b/cpu/base_cpu.cc
@@ -49,13 +49,17 @@ int maxThreadsPerCPU = 1;
BaseCPU::BaseCPU(const string &_name, int _number_of_threads,
Counter max_insts_any_thread,
Counter max_insts_all_threads,
+ Counter max_loads_any_thread,
+ Counter max_loads_all_threads,
System *_system, int num, Tick freq)
: SimObject(_name), number(num), frequency(freq),
number_of_threads(_number_of_threads), system(_system)
#else
BaseCPU::BaseCPU(const string &_name, int _number_of_threads,
Counter max_insts_any_thread,
- Counter max_insts_all_threads)
+ Counter max_insts_all_threads,
+ Counter max_loads_any_thread,
+ Counter max_loads_all_threads)
: SimObject(_name), number_of_threads(_number_of_threads)
#endif
{
@@ -90,6 +94,32 @@ BaseCPU::BaseCPU(const string &_name, int _number_of_threads,
max_insts_all_threads, *counter);
}
+ // allocate per-thread load-based event queues
+ comLoadEventQueue = new (EventQueue *)[number_of_threads];
+ for (int i = 0; i < number_of_threads; ++i)
+ comLoadEventQueue[i] = new EventQueue("load-based event queue");
+
+ //
+ // set up instruction-count-based termination events, if any
+ //
+ if (max_loads_any_thread != 0)
+ for (int i = 0; i < number_of_threads; ++i)
+ new SimExitEvent(comLoadEventQueue[i], max_loads_any_thread,
+ "a thread reached the max load count");
+
+ if (max_loads_all_threads != 0) {
+ // allocate & initialize shared downcounter: each event will
+ // decrement this when triggered; simulation will terminate
+ // when counter reaches 0
+ int *counter = new int;
+ *counter = number_of_threads;
+ for (int i = 0; i < number_of_threads; ++i)
+ new CountedExitEvent(comLoadEventQueue[i],
+ "all threads reached the max load count",
+ max_loads_all_threads, *counter);
+ }
+
+
#ifdef FULL_SYSTEM
memset(interrupts, 0, sizeof(interrupts));
intstatus = 0;