cpu: Dynamically instantiate O3 CPU LSQUnits
Previously, the LSQ would instantiate MaxThreads LSQUnits in the body of it's object, but it would only initialize numThreads LSQUnits as specified by the user. This had the effect of leaving some LSQUnits uninitialized when the number of threads was less than MaxThreads, and when adding statistics to the LSQUnit that must be initialized, this caused the stats initialization check to fail. By dynamically instantiating LSQUnits, they are all initialized and this avoids uninitialized LSQUnits from floating around during runtime.
This commit is contained in:
parent
073b27c257
commit
a1f9081bab
2 changed files with 7 additions and 1 deletions
|
@ -70,6 +70,9 @@ class LSQ {
|
||||||
|
|
||||||
/** Constructs an LSQ with the given parameters. */
|
/** Constructs an LSQ with the given parameters. */
|
||||||
LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params);
|
LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params);
|
||||||
|
~LSQ() {
|
||||||
|
if (thread) delete [] thread;
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns the name of the LSQ. */
|
/** Returns the name of the LSQ. */
|
||||||
std::string name() const;
|
std::string name() const;
|
||||||
|
@ -316,7 +319,7 @@ class LSQ {
|
||||||
LSQPolicy lsqPolicy;
|
LSQPolicy lsqPolicy;
|
||||||
|
|
||||||
/** The LSQ units for individual threads. */
|
/** The LSQ units for individual threads. */
|
||||||
LSQUnit thread[Impl::MaxThreads];
|
LSQUnit *thread;
|
||||||
|
|
||||||
/** List of Active Threads in System. */
|
/** List of Active Threads in System. */
|
||||||
std::list<ThreadID> *activeThreads;
|
std::list<ThreadID> *activeThreads;
|
||||||
|
|
|
@ -61,6 +61,8 @@ LSQ<Impl>::LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params)
|
||||||
numThreads(params->numThreads),
|
numThreads(params->numThreads),
|
||||||
retryTid(-1)
|
retryTid(-1)
|
||||||
{
|
{
|
||||||
|
assert(numThreads > 0 && numThreads <= Impl::MaxThreads);
|
||||||
|
|
||||||
//**********************************************/
|
//**********************************************/
|
||||||
//************ Handle SMT Parameters ***********/
|
//************ Handle SMT Parameters ***********/
|
||||||
//**********************************************/
|
//**********************************************/
|
||||||
|
@ -109,6 +111,7 @@ LSQ<Impl>::LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Initialize LSQs
|
//Initialize LSQs
|
||||||
|
thread = new LSQUnit[numThreads];
|
||||||
for (ThreadID tid = 0; tid < numThreads; tid++) {
|
for (ThreadID tid = 0; tid < numThreads; tid++) {
|
||||||
thread[tid].init(cpu, iew_ptr, params, this,
|
thread[tid].init(cpu, iew_ptr, params, this,
|
||||||
maxLQEntries, maxSQEntries, tid);
|
maxLQEntries, maxSQEntries, tid);
|
||||||
|
|
Loading…
Reference in a new issue