class SMTQueuePolicy(ScopedEnum):
vals = [ 'Dynamic', 'Partitioned', 'Threshold' ]
+class CommitPolicy(ScopedEnum):
+ vals = [ 'Aggressive', 'RoundRobin', 'OldestReady' ]
+
class DerivO3CPU(BaseCPU):
type = 'DerivO3CPU'
cxx_header = 'cpu/o3/deriv.hh'
smtROBPolicy = Param.SMTQueuePolicy('Partitioned',
"SMT ROB Sharing Policy")
smtROBThreshold = Param.Int(100, "SMT ROB Threshold Sharing Parameter")
- smtCommitPolicy = Param.String('RoundRobin', "SMT Commit Policy")
+ smtCommitPolicy = Param.CommitPolicy('RoundRobin', "SMT Commit Policy")
branchPred = Param.BranchPredictor(TournamentBP(numThreads =
Parent.numThreads),
#include "cpu/exetrace.hh"
#include "cpu/inst_seq.hh"
#include "cpu/timebuf.hh"
+#include "enums/CommitPolicy.hh"
#include "sim/probe/probe.hh"
struct DerivO3CPUParams;
SquashAfterPending, //< Committing instructions before a squash.
};
- /** Commit policy for SMT mode. */
- enum CommitPolicy {
- Aggressive,
- RoundRobin,
- OldestReady
- };
-
private:
/** Overall commit status. */
CommitStatus _status;
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),
_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++) {
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: