scoreboard.cc (8232:b28d06a175be) | scoreboard.cc (9916:9c3a4595cce9) |
---|---|
1/* 2 * Copyright (c) 2005-2006 The Regents of The University of Michigan | 1/* 2 * Copyright (c) 2005-2006 The Regents of The University of Michigan |
3 * Copyright (c) 2013 Advanced Micro Devices, Inc. |
|
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; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the --- 17 unchanged lines hidden (view full) --- 28 * Authors: Korey Sewell 29 * Kevin Lim 30 */ 31 32#include "config/the_isa.hh" 33#include "cpu/o3/scoreboard.hh" 34#include "debug/Scoreboard.hh" 35 | 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer; 10 * redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the --- 17 unchanged lines hidden (view full) --- 29 * Authors: Korey Sewell 30 * Kevin Lim 31 */ 32 33#include "config/the_isa.hh" 34#include "cpu/o3/scoreboard.hh" 35#include "debug/Scoreboard.hh" 36 |
36Scoreboard::Scoreboard(unsigned activeThreads, 37 unsigned _numLogicalIntRegs, 38 unsigned _numPhysicalIntRegs, 39 unsigned _numLogicalFloatRegs, 40 unsigned _numPhysicalFloatRegs, 41 unsigned _numMiscRegs, 42 unsigned _zeroRegIdx) 43 : numLogicalIntRegs(_numLogicalIntRegs), 44 numPhysicalIntRegs(_numPhysicalIntRegs), 45 numLogicalFloatRegs(_numLogicalFloatRegs), 46 numPhysicalFloatRegs(_numPhysicalFloatRegs), 47 numMiscRegs(_numMiscRegs), 48 zeroRegIdx(_zeroRegIdx) | 37Scoreboard::Scoreboard(const std::string &_my_name, 38 unsigned _numPhysicalRegs, unsigned _numMiscRegs, 39 PhysRegIndex _zeroRegIdx, PhysRegIndex _fpZeroRegIdx) 40 : _name(_my_name), 41 regScoreBoard(_numPhysicalRegs, true), 42 numPhysRegs(_numPhysicalRegs), 43 numTotalRegs(_numPhysicalRegs + _numMiscRegs), 44 zeroRegIdx(_zeroRegIdx), fpZeroRegIdx(_fpZeroRegIdx) |
49{ | 45{ |
50 //Get Register Sizes 51 numLogicalRegs = numLogicalIntRegs + numLogicalFloatRegs; 52 numPhysicalRegs = numPhysicalIntRegs + numPhysicalFloatRegs; 53 54 //Resize scoreboard appropriately 55 resize(numPhysicalRegs + (numMiscRegs * activeThreads)); 56 57 //Initialize values 58 for (int i=0; i < numLogicalIntRegs * activeThreads; i++) { 59 assert(indexInBounds(i)); 60 regScoreBoard[i] = 1; 61 } 62 63 for (int i= numPhysicalIntRegs; 64 i < numPhysicalIntRegs + (numLogicalFloatRegs * activeThreads); 65 i++) { 66 assert(indexInBounds(i)); 67 regScoreBoard[i] = 1; 68 } 69 70 for (int i = numPhysicalRegs; 71 i < numPhysicalRegs + (numMiscRegs * activeThreads); 72 i++) { 73 assert(indexInBounds(i)); 74 regScoreBoard[i] = 1; 75 } | |
76} | 46} |
77 78std::string 79Scoreboard::name() const 80{ 81 return "cpu.scoreboard"; 82} 83 84bool 85Scoreboard::getReg(PhysRegIndex phys_reg) 86{ 87#if THE_ISA == ALPHA_ISA 88 // Always ready if int or fp zero reg. 89 if (phys_reg == zeroRegIdx || 90 phys_reg == (zeroRegIdx + numPhysicalIntRegs)) { 91 return 1; 92 } 93#else 94 // Always ready if int zero reg. 95 if (phys_reg == zeroRegIdx) { 96 return 1; 97 } 98#endif 99 100 assert(indexInBounds(phys_reg)); 101 return regScoreBoard[phys_reg]; 102} 103 104void 105Scoreboard::setReg(PhysRegIndex phys_reg) 106{ 107 DPRINTF(Scoreboard, "Setting reg %i as ready\n", phys_reg); 108 109 assert(indexInBounds(phys_reg)); 110 regScoreBoard[phys_reg] = 1; 111} 112 113void 114Scoreboard::unsetReg(PhysRegIndex ready_reg) 115{ 116#if THE_ISA == ALPHA_ISA 117 if (ready_reg == zeroRegIdx || 118 ready_reg == (zeroRegIdx + numPhysicalIntRegs)) { 119 // Don't do anything if int or fp zero reg. 120 return; 121 } 122#else 123 if (ready_reg == zeroRegIdx) { 124 // Don't do anything if int zero reg. 125 return; 126 } 127#endif 128 129 assert(indexInBounds(ready_reg)); 130 regScoreBoard[ready_reg] = 0; 131} | |