diff options
author | Erik Hallnor <ehallnor@umich.edu> | 2003-10-16 17:04:25 -0400 |
---|---|---|
committer | Erik Hallnor <ehallnor@umich.edu> | 2003-10-16 17:04:25 -0400 |
commit | aeaf133d271a75d649451290d2b3ea12b2b744ec (patch) | |
tree | e8c9103896aa63a77350f6b12849ba45e347f5fc /cpu/base_cpu.cc | |
parent | a6788d64dd683c0e7d82f10049d39253c0ea03bb (diff) | |
parent | 4134477369028e04dd265a43753868c01912c465 (diff) | |
download | gem5-aeaf133d271a75d649451290d2b3ea12b2b744ec.tar.xz |
Merge ehallnor@zizzer:/bk/m5
into zizzer.eecs.umich.edu:/y/ehallnor/work/m5
--HG--
extra : convert_revision : 2979dcbf516446b45c7fb94454e4c4f013f480e4
Diffstat (limited to 'cpu/base_cpu.cc')
-rw-r--r-- | cpu/base_cpu.cc | 32 |
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; |