cpu: Construct ROB with cpu params struct instead of each variable
authorFaissal Sleiman <Faissal.Sleiman@arm.com>
Thu, 31 Oct 2013 18:41:13 +0000 (13:41 -0500)
committerFaissal Sleiman <Faissal.Sleiman@arm.com>
Thu, 31 Oct 2013 18:41:13 +0000 (13:41 -0500)
Most other structures/stages get passed the cpu params struct.

src/cpu/o3/cpu.cc
src/cpu/o3/rob.hh
src/cpu/o3/rob_impl.hh

index f379b106856e7b7130fb922103e434ab027141c9..e13d7a959528d2657c388dd5b5276a4acad3ebc0 100644 (file)
@@ -230,10 +230,7 @@ FullO3CPU<Impl>::FullO3CPU(DerivO3CPUParams *params)
 
       freeList(name() + ".freelist", &regFile),
 
-      rob(this,
-          params->numROBEntries, params->squashWidth,
-          params->smtROBPolicy, params->smtROBThreshold,
-          params->numThreads),
+      rob(this, params),
 
       scoreboard(name() + ".scoreboard",
                  regFile.totalNumPhysRegs(), TheISA::NumMiscRegs,
index 171781ce250d0e0835cbba0083801f18408e3781..b5651de1181ce8a94a605543fcc21f7c078afe70 100644 (file)
@@ -52,6 +52,8 @@
 #include "base/types.hh"
 #include "config/the_isa.hh"
 
+struct DerivO3CPUParams;
+
 /**
  * ROB class.  The ROB is largely what drives squashing.
  */
@@ -91,16 +93,10 @@ class ROB
 
   public:
     /** ROB constructor.
-     *  @param _numEntries      Number of entries in ROB.
-     *  @param _squashWidth     Number of instructions that can be squashed in a
-     *                          single cycle.
-     *  @param _smtROBPolicy    ROB Partitioning Scheme for SMT.
-     *  @param _smtROBThreshold Max Resources(by %) a thread can have in the ROB.
-     *  @param _numThreads      The number of active threads.
+     *  @param _cpu   The cpu object pointer.
+     *  @param params The cpu params including several ROB-specific parameters.
      */
-    ROB(O3CPU *_cpu, unsigned _numEntries, unsigned _squashWidth,
-        std::string smtROBPolicy, unsigned _smtROBThreshold,
-        ThreadID _numThreads);
+    ROB(O3CPU *_cpu, DerivO3CPUParams *params);
 
     std::string name() const;
 
index c8ceb29092e3569d8c1d237eaa598ac87a73a24f..c047981a7b59560058a3fbdb8ba48b386f265b38 100644 (file)
 #include "cpu/o3/rob.hh"
 #include "debug/Fetch.hh"
 #include "debug/ROB.hh"
+#include "params/DerivO3CPU.hh"
 
 using namespace std;
 
 template <class Impl>
-ROB<Impl>::ROB(O3CPU *_cpu, unsigned _numEntries, unsigned _squashWidth,
-               std::string _smtROBPolicy, unsigned _smtROBThreshold,
-               ThreadID _numThreads)
+ROB<Impl>::ROB(O3CPU *_cpu, DerivO3CPUParams *params)
     : cpu(_cpu),
-      numEntries(_numEntries),
-      squashWidth(_squashWidth),
+      numEntries(params->numROBEntries),
+      squashWidth(params->squashWidth),
       numInstsInROB(0),
-      numThreads(_numThreads)
+      numThreads(params->numThreads)
 {
-    std::string policy = _smtROBPolicy;
+    std::string policy = params->smtROBPolicy;
 
     //Convert string to lowercase
     std::transform(policy.begin(), policy.end(), policy.begin(),
@@ -93,7 +92,7 @@ ROB<Impl>::ROB(O3CPU *_cpu, unsigned _numEntries, unsigned _squashWidth,
         robPolicy = Threshold;
         DPRINTF(Fetch, "ROB sharing policy set to Threshold\n");
 
-        int threshold =  _smtROBThreshold;;
+        int threshold =  params->smtROBThreshold;;
 
         //Divide up by threshold amount
         for (ThreadID tid = 0; tid < numThreads; tid++) {