Deleted Added
sdiff udiff text old ( 13453:4a7a060ea26e ) new ( 13562:8fe39a3fc056 )
full compact
1/*
2 * Copyright (c) 2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 42 unchanged lines hidden (view full) ---

51#include "debug/Fetch.hh"
52#include "debug/ROB.hh"
53#include "params/DerivO3CPU.hh"
54
55using namespace std;
56
57template <class Impl>
58ROB<Impl>::ROB(O3CPU *_cpu, DerivO3CPUParams *params)
59 : cpu(_cpu),
60 numEntries(params->numROBEntries),
61 squashWidth(params->squashWidth),
62 numInstsInROB(0),
63 numThreads(params->numThreads)
64{
65 std::string policy = params->smtROBPolicy;
66
67 //Convert string to lowercase
68 std::transform(policy.begin(), policy.end(), policy.begin(),
69 (int(*)(int)) tolower);
70
71 //Figure out rob policy
72 if (policy == "dynamic") {
73 robPolicy = Dynamic;
74
75 //Set Max Entries to Total ROB Capacity
76 for (ThreadID tid = 0; tid < numThreads; tid++) {
77 maxEntries[tid] = numEntries;
78 }
79
80 } else if (policy == "partitioned") {
81 robPolicy = Partitioned;
82 DPRINTF(Fetch, "ROB sharing policy set to Partitioned\n");
83
84 //@todo:make work if part_amt doesnt divide evenly.
85 int part_amt = numEntries / numThreads;
86
87 //Divide ROB up evenly
88 for (ThreadID tid = 0; tid < numThreads; tid++) {
89 maxEntries[tid] = part_amt;
90 }
91
92 } else if (policy == "threshold") {
93 robPolicy = Threshold;
94 DPRINTF(Fetch, "ROB sharing policy set to Threshold\n");
95
96 int threshold = params->smtROBThreshold;;
97
98 //Divide up by threshold amount
99 for (ThreadID tid = 0; tid < numThreads; tid++) {
100 maxEntries[tid] = threshold;
101 }
102 } else {
103 panic("Invalid ROB sharing policy. Options are: Dynamic, "
104 "Partitioned, Threshold");
105 }
106 for (ThreadID tid = numThreads; tid < Impl::MaxThreads; tid++) {
107 maxEntries[tid] = 0;
108 }
109
110 resetState();
111}
112
113template <class Impl>

--- 44 unchanged lines hidden (view full) ---

158{
159 resetState();
160}
161
162template <class Impl>
163void
164ROB<Impl>::resetEntries()
165{
166 if (robPolicy != Dynamic || numThreads > 1) {
167 int active_threads = activeThreads->size();
168
169 list<ThreadID>::iterator threads = activeThreads->begin();
170 list<ThreadID>::iterator end = activeThreads->end();
171
172 while (threads != end) {
173 ThreadID tid = *threads++;
174
175 if (robPolicy == Partitioned) {
176 maxEntries[tid] = numEntries / active_threads;
177 } else if (robPolicy == Threshold && active_threads == 1) {
178 maxEntries[tid] = numEntries;
179 }
180 }
181 }
182}
183
184template <class Impl>
185int
186ROB<Impl>::entryAmount(ThreadID num_threads)
187{
188 if (robPolicy == Partitioned) {
189 return numEntries / num_threads;
190 } else {
191 return 0;
192 }
193}
194
195template <class Impl>
196int

--- 373 unchanged lines hidden ---