1/* 2 * Copyright (c) 2004-2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 18 unchanged lines hidden (view full) --- 27 * 28 * Authors: Kevin Lim 29 * Korey Sewell 30 */ 31 32#include "config/full_system.hh" 33#include "cpu/o3/rob.hh" 34 |
35#include <list> |
36 37template <class Impl> 38ROB<Impl>::ROB(unsigned _numEntries, unsigned _squashWidth, |
39 std::string _smtROBPolicy, unsigned _smtROBThreshold, |
40 unsigned _numThreads) 41 : numEntries(_numEntries), 42 squashWidth(_squashWidth), 43 numInstsInROB(0), 44 numThreads(_numThreads) 45{ 46 for (int tid=0; tid < numThreads; tid++) { 47 squashedSeqNum[tid] = 0; 48 doneSquashing[tid] = true; 49 threadEntries[tid] = 0; 50 } 51 |
52 std::string policy = _smtROBPolicy; |
53 54 //Convert string to lowercase 55 std::transform(policy.begin(), policy.end(), policy.begin(), 56 (int(*)(int)) tolower); 57 58 //Figure out rob policy 59 if (policy == "dynamic") { 60 robPolicy = Dynamic; --- 52 unchanged lines hidden (view full) --- 113 // Initialize the "universal" ROB head & tail point to invalid 114 // pointers 115 head = instList[0].end(); 116 tail = instList[0].end(); 117} 118 119template <class Impl> 120void |
121ROB<Impl>::setActiveThreads(std::list<unsigned> *at_ptr) |
122{ 123 DPRINTF(ROB, "Setting active threads list pointer.\n"); 124 activeThreads = at_ptr; 125} 126 127template <class Impl> 128void 129ROB<Impl>::switchOut() --- 22 unchanged lines hidden (view full) --- 152 153template <class Impl> 154void 155ROB<Impl>::resetEntries() 156{ 157 if (robPolicy != Dynamic || numThreads > 1) { 158 int active_threads = (*activeThreads).size(); 159 |
160 std::list<unsigned>::iterator threads = (*activeThreads).begin(); 161 std::list<unsigned>::iterator list_end = (*activeThreads).end(); |
162 163 while (threads != list_end) { 164 if (robPolicy == Partitioned) { 165 maxEntries[*threads++] = numEntries / active_threads; 166 } else if (robPolicy == Threshold && active_threads == 1) { 167 maxEntries[*threads++] = numEntries; 168 } 169 } --- 143 unchanged lines hidden (view full) --- 313 return false; 314} 315 316template <class Impl> 317bool 318ROB<Impl>::canCommit() 319{ 320 //@todo: set ActiveThreads through ROB or CPU |
321 std::list<unsigned>::iterator threads = (*activeThreads).begin(); |
322 323 while (threads != (*activeThreads).end()) { 324 unsigned tid = *threads++; 325 326 if (isHeadReady(tid)) { 327 return true; 328 } 329 } --- 97 unchanged lines hidden (view full) --- 427void 428ROB<Impl>::updateHead() 429{ 430 DynInstPtr head_inst; 431 InstSeqNum lowest_num = 0; 432 bool first_valid = true; 433 434 // @todo: set ActiveThreads through ROB or CPU |
435 std::list<unsigned>::iterator threads = (*activeThreads).begin(); |
436 437 while (threads != (*activeThreads).end()) { 438 unsigned thread_num = *threads++; 439 440 if (instList[thread_num].empty()) 441 continue; 442 443 if (first_valid) { --- 23 unchanged lines hidden (view full) --- 467 468template <class Impl> 469void 470ROB<Impl>::updateTail() 471{ 472 tail = instList[0].end(); 473 bool first_valid = true; 474 |
475 std::list<unsigned>::iterator threads = (*activeThreads).begin(); |
476 477 while (threads != (*activeThreads).end()) { 478 unsigned tid = *threads++; 479 480 if (instList[tid].empty()) { 481 continue; 482 } 483 --- 213 unchanged lines hidden --- |