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 : robPolicy(params->smtROBPolicy), 60 cpu(_cpu), |
61 numEntries(params->numROBEntries), 62 squashWidth(params->squashWidth), 63 numInstsInROB(0), 64 numThreads(params->numThreads) 65{ |
66 //Figure out rob policy |
67 if (robPolicy == SMTQueuePolicy::Dynamic) { |
68 //Set Max Entries to Total ROB Capacity 69 for (ThreadID tid = 0; tid < numThreads; tid++) { 70 maxEntries[tid] = numEntries; 71 } 72 |
73 } else if (robPolicy == SMTQueuePolicy::Partitioned) { |
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 |
84 } else if (robPolicy == SMTQueuePolicy::Threshold) { |
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 } |
93 } |
94 |
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{ |
155 if (robPolicy != SMTQueuePolicy::Dynamic || numThreads > 1) { |
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 |
164 if (robPolicy == SMTQueuePolicy::Partitioned) { |
165 maxEntries[tid] = numEntries / active_threads; |
166 } else if (robPolicy == SMTQueuePolicy::Threshold && 167 active_threads == 1) { |
168 maxEntries[tid] = numEntries; 169 } 170 } 171 } 172} 173 174template <class Impl> 175int 176ROB<Impl>::entryAmount(ThreadID num_threads) 177{ |
178 if (robPolicy == SMTQueuePolicy::Partitioned) { |
179 return numEntries / num_threads; 180 } else { 181 return 0; 182 } 183} 184 185template <class Impl> 186int --- 373 unchanged lines hidden --- |