diff options
author | Nikos Nikoleris <nikos.nikoleris@arm.com> | 2019-01-03 19:01:04 +0000 |
---|---|---|
committer | Nikos Nikoleris <nikos.nikoleris@arm.com> | 2019-01-17 11:09:08 +0000 |
commit | 1e9f65343c79b2c3b081e785cfec070d25292be7 (patch) | |
tree | c642d8a00623729d8b9bf0aba175b60fdfd2dbff /src/cpu/o3/commit_impl.hh | |
parent | 8c549224a5e7d7a3142a9365d544475601dee41d (diff) | |
download | gem5-1e9f65343c79b2c3b081e785cfec070d25292be7.tar.xz |
cpu-o3: Make the smtCommitPolicy a Param.ScopedEnum
The smtCommitPolicy 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: I3625f2c08a1ae0c3b0dce7a641c6ae1ce3fd79a5
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/15400
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/cpu/o3/commit_impl.hh')
-rw-r--r-- | src/cpu/o3/commit_impl.hh | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/src/cpu/o3/commit_impl.hh b/src/cpu/o3/commit_impl.hh index 40ce8480e..879fad292 100644 --- a/src/cpu/o3/commit_impl.hh +++ b/src/cpu/o3/commit_impl.hh @@ -82,7 +82,8 @@ DefaultCommit<Impl>::processTrapEvent(ThreadID tid) template <class Impl> DefaultCommit<Impl>::DefaultCommit(O3CPU *_cpu, DerivO3CPUParams *params) - : cpu(_cpu), + : commitPolicy(params->smtCommitPolicy), + cpu(_cpu), iewToCommitDelay(params->iewToCommitDelay), commitToIEWDelay(params->commitToIEWDelay), renameToROBDelay(params->renameToROBDelay), @@ -103,33 +104,12 @@ DefaultCommit<Impl>::DefaultCommit(O3CPU *_cpu, DerivO3CPUParams *params) _status = Active; _nextStatus = Inactive; - std::string policy = params->smtCommitPolicy; - - //Convert string to lowercase - std::transform(policy.begin(), policy.end(), policy.begin(), - (int(*)(int)) tolower); - - //Assign commit policy - if (policy == "aggressive"){ - commitPolicy = Aggressive; - - DPRINTF(Commit,"Commit Policy set to Aggressive.\n"); - } else if (policy == "roundrobin"){ - commitPolicy = RoundRobin; + if (commitPolicy == CommitPolicy::RoundRobin) { //Set-Up Priority List for (ThreadID tid = 0; tid < numThreads; tid++) { priority_list.push_back(tid); } - - DPRINTF(Commit,"Commit Policy set to Round Robin.\n"); - } else if (policy == "oldestready"){ - commitPolicy = OldestReady; - - DPRINTF(Commit,"Commit Policy set to Oldest Ready."); - } else { - panic("Invalid SMT commit policy. Options are: Aggressive, " - "RoundRobin, OldestReady"); } for (ThreadID tid = 0; tid < Impl::MaxThreads; tid++) { @@ -1431,16 +1411,16 @@ DefaultCommit<Impl>::getCommittingThread() if (numThreads > 1) { switch (commitPolicy) { - case Aggressive: + case CommitPolicy::Aggressive: //If Policy is Aggressive, commit will call //this function multiple times per //cycle return oldestReady(); - case RoundRobin: + case CommitPolicy::RoundRobin: return roundRobin(); - case OldestReady: + case CommitPolicy::OldestReady: return oldestReady(); default: |