diff options
Diffstat (limited to 'src/cpu/o3/lsq.hh')
-rw-r--r-- | src/cpu/o3/lsq.hh | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/src/cpu/o3/lsq.hh b/src/cpu/o3/lsq.hh index 0c93121e3..2b2d39bf7 100644 --- a/src/cpu/o3/lsq.hh +++ b/src/cpu/o3/lsq.hh @@ -49,6 +49,7 @@ #include "cpu/o3/lsq_unit.hh" #include "cpu/inst_seq.hh" +#include "enums/SMTQueuePolicy.hh" #include "mem/port.hh" #include "sim/sim_object.hh" @@ -62,13 +63,6 @@ class LSQ { typedef typename Impl::CPUPol::IEW IEW; typedef typename Impl::CPUPol::LSQUnit LSQUnit; - /** SMT policy. */ - enum LSQPolicy { - Dynamic, - Partitioned, - Threshold - }; - /** Constructs an LSQ with the given parameters. */ LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params); ~LSQ() { } @@ -306,40 +300,21 @@ class LSQ { protected: /** The LSQ policy for SMT mode. */ - LSQPolicy lsqPolicy; - - /** Transform a SMT sharing policy string into a LSQPolicy value. */ - static LSQPolicy readLSQPolicy(const std::string& policy) { - std::string policy_ = policy; - std::transform(policy_.begin(), policy_.end(), policy_.begin(), - (int(*)(int)) tolower); - if (policy_ == "dynamic") { - return Dynamic; - } else if (policy_ == "partitioned") { - return Partitioned; - } else if (policy_ == "threshold") { - return Threshold; - } - assert(0 && "Invalid LSQ Sharing Policy.Options Are:{Dynamic," - "Partitioned, Threshold}"); - - // Some compilers complain if there is no return. - return Dynamic; - } + SMTQueuePolicy lsqPolicy; /** Auxiliary function to calculate per-thread max LSQ allocation limit. * Depending on a policy, number of entries and possibly number of threads * and threshold, this function calculates how many resources each thread * can occupy at most. */ - static uint32_t maxLSQAllocation(const LSQPolicy& pol, uint32_t entries, + static uint32_t maxLSQAllocation(SMTQueuePolicy pol, uint32_t entries, uint32_t numThreads, uint32_t SMTThreshold) { - if (pol == Dynamic) { + if (pol == SMTQueuePolicy::Dynamic) { return entries; - } else if (pol == Partitioned) { + } else if (pol == SMTQueuePolicy::Partitioned) { //@todo:make work if part_amt doesnt divide evenly. return entries / numThreads; - } else if (pol == Threshold) { + } else if (pol == SMTQueuePolicy::Threshold) { //Divide up by threshold amount //@todo: Should threads check the max and the total //amount of the LSQ |