rob_impl.hh (13453:4a7a060ea26e) | rob_impl.hh (13562:8fe39a3fc056) |
---|---|
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) | 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), | 59 : robPolicy(params->smtROBPolicy), 60 cpu(_cpu), |
60 numEntries(params->numROBEntries), 61 squashWidth(params->squashWidth), 62 numInstsInROB(0), 63 numThreads(params->numThreads) 64{ | 61 numEntries(params->numROBEntries), 62 squashWidth(params->squashWidth), 63 numInstsInROB(0), 64 numThreads(params->numThreads) 65{ |
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 | 66 //Figure out rob policy |
72 if (policy == "dynamic") { 73 robPolicy = Dynamic; 74 | 67 if (robPolicy == SMTQueuePolicy::Dynamic) { |
75 //Set Max Entries to Total ROB Capacity 76 for (ThreadID tid = 0; tid < numThreads; tid++) { 77 maxEntries[tid] = numEntries; 78 } 79 | 68 //Set Max Entries to Total ROB Capacity 69 for (ThreadID tid = 0; tid < numThreads; tid++) { 70 maxEntries[tid] = numEntries; 71 } 72 |
80 } else if (policy == "partitioned") { 81 robPolicy = Partitioned; | 73 } else if (robPolicy == SMTQueuePolicy::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 | 74 DPRINTF(Fetch, "ROB sharing policy set to Partitioned\n"); 75 76 //@todo:make work if part_amt doesnt divide evenly. 77 int part_amt = numEntries / numThreads; 78 79 //Divide ROB up evenly 80 for (ThreadID tid = 0; tid < numThreads; tid++) { 81 maxEntries[tid] = part_amt; 82 } 83 |
92 } else if (policy == "threshold") { 93 robPolicy = Threshold; | 84 } else if (robPolicy == SMTQueuePolicy::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 } | 85 DPRINTF(Fetch, "ROB sharing policy set to Threshold\n"); 86 87 int threshold = params->smtROBThreshold;; 88 89 //Divide up by threshold amount 90 for (ThreadID tid = 0; tid < numThreads; tid++) { 91 maxEntries[tid] = threshold; 92 } |
102 } else { 103 panic("Invalid ROB sharing policy. Options are: Dynamic, " 104 "Partitioned, Threshold"); | |
105 } | 93 } |
94 |
|
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{ | 95 for (ThreadID tid = numThreads; tid < Impl::MaxThreads; tid++) { 96 maxEntries[tid] = 0; 97 } 98 99 resetState(); 100} 101 102template <class Impl> --- 44 unchanged lines hidden (view full) --- 147{ 148 resetState(); 149} 150 151template <class Impl> 152void 153ROB<Impl>::resetEntries() 154{ |
166 if (robPolicy != Dynamic || numThreads > 1) { | 155 if (robPolicy != SMTQueuePolicy::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 | 156 int active_threads = activeThreads->size(); 157 158 list<ThreadID>::iterator threads = activeThreads->begin(); 159 list<ThreadID>::iterator end = activeThreads->end(); 160 161 while (threads != end) { 162 ThreadID tid = *threads++; 163 |
175 if (robPolicy == Partitioned) { | 164 if (robPolicy == SMTQueuePolicy::Partitioned) { |
176 maxEntries[tid] = numEntries / active_threads; | 165 maxEntries[tid] = numEntries / active_threads; |
177 } else if (robPolicy == Threshold && active_threads == 1) { | 166 } else if (robPolicy == SMTQueuePolicy::Threshold && 167 active_threads == 1) { |
178 maxEntries[tid] = numEntries; 179 } 180 } 181 } 182} 183 184template <class Impl> 185int 186ROB<Impl>::entryAmount(ThreadID num_threads) 187{ | 168 maxEntries[tid] = numEntries; 169 } 170 } 171 } 172} 173 174template <class Impl> 175int 176ROB<Impl>::entryAmount(ThreadID num_threads) 177{ |
188 if (robPolicy == Partitioned) { | 178 if (robPolicy == SMTQueuePolicy::Partitioned) { |
189 return numEntries / num_threads; 190 } else { 191 return 0; 192 } 193} 194 195template <class Impl> 196int --- 373 unchanged lines hidden --- | 179 return numEntries / num_threads; 180 } else { 181 return 0; 182 } 183} 184 185template <class Impl> 186int --- 373 unchanged lines hidden --- |