summaryrefslogtreecommitdiff
path: root/src/cpu/o3/lsq.hh
diff options
context:
space:
mode:
authorNikos Nikoleris <nikos.nikoleris@arm.com>2018-12-24 09:04:16 +0000
committerNikos Nikoleris <nikos.nikoleris@arm.com>2019-01-17 11:09:08 +0000
commit7b4e441c35e6f3d11b050fb0d6aff7919f10d953 (patch)
tree06a27d94287b2fe69360df5a7fa26ff322eff92c /src/cpu/o3/lsq.hh
parent38339e0a7f7ce119feefc95591703df2f851ee4d (diff)
downloadgem5-7b4e441c35e6f3d11b050fb0d6aff7919f10d953.tar.xz
cpu-o3: Make the smtLSQPolicy a Param.ScopedEnum
The smtLSQPolicy is a parameter in the o3 cpu that can have 3 different values. Previously this setting was done through a string and a parser function would turn it into a c++ enum value. This changeset turns the string into a python Param.ScopedEnum. Change-Id: I82041b88bd914c5dc660058d9e3998e3114e7c35 Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15397 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/cpu/o3/lsq.hh')
-rw-r--r--src/cpu/o3/lsq.hh37
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