changeset 44a67004d6b4 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=44a67004d6b4
description:
        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.

diffstat:

 src/cpu/o3/lsq.hh      |  5 ++++-
 src/cpu/o3/lsq_impl.hh |  3 +++
 2 files changed, 7 insertions(+), 1 deletions(-)

diffs (42 lines):

diff -r 650fc966ed78 -r 44a67004d6b4 src/cpu/o3/lsq.hh
--- a/src/cpu/o3/lsq.hh Wed Sep 11 15:34:21 2013 -0500
+++ b/src/cpu/o3/lsq.hh Wed Sep 11 15:34:50 2013 -0500
@@ -70,6 +70,9 @@
 
     /** Constructs an LSQ with the given parameters. */
     LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params);
+    ~LSQ() {
+        if (thread) delete [] thread;
+    }
 
     /** Returns the name of the LSQ. */
     std::string name() const;
@@ -316,7 +319,7 @@
     LSQPolicy lsqPolicy;
 
     /** The LSQ units for individual threads. */
-    LSQUnit thread[Impl::MaxThreads];
+    LSQUnit *thread;
 
     /** List of Active Threads in System. */
     std::list<ThreadID> *activeThreads;
diff -r 650fc966ed78 -r 44a67004d6b4 src/cpu/o3/lsq_impl.hh
--- a/src/cpu/o3/lsq_impl.hh    Wed Sep 11 15:34:21 2013 -0500
+++ b/src/cpu/o3/lsq_impl.hh    Wed Sep 11 15:34:50 2013 -0500
@@ -61,6 +61,8 @@
       numThreads(params->numThreads),
       retryTid(-1)
 {
+    assert(numThreads > 0 && numThreads <= Impl::MaxThreads);
+
     //**********************************************/
     //************ Handle SMT Parameters ***********/
     //**********************************************/
@@ -109,6 +111,7 @@
     }
 
     //Initialize LSQs
+    thread = new LSQUnit[numThreads];
     for (ThreadID tid = 0; tid < numThreads; tid++) {
         thread[tid].init(cpu, iew_ptr, params, this,
                          maxLQEntries, maxSQEntries, tid);
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to