rename_map.hh (2665:a124942bacb8) | rename_map.hh (2670:9107b8bd08cd) |
---|---|
1/* 2 * Copyright (c) 2004-2005 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 */ 30 31// Todo: Create destructor. 32// Have it so that there's a more meaningful name given to the variable 33// that marks the beginning of the FP registers. 34 | 1/* 2 * Copyright (c) 2004-2005 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 */ 30 31// Todo: Create destructor. 32// Have it so that there's a more meaningful name given to the variable 33// that marks the beginning of the FP registers. 34 |
35#ifndef __CPU_O3_CPU_RENAME_MAP_HH__ 36#define __CPU_O3_CPU_RENAME_MAP_HH__ | 35#ifndef __CPU_O3_RENAME_MAP_HH__ 36#define __CPU_O3_RENAME_MAP_HH__ |
37 38#include <iostream> 39#include <utility> 40#include <vector> 41 42#include "cpu/o3/free_list.hh" 43//For RegIndex 44#include "arch/isa_traits.hh" --- 15 unchanged lines hidden (view full) --- 60 * return the physical register that a logical register has been 61 * renamed to, and the previous physical register that the same 62 * logical register was previously mapped to. 63 */ 64 typedef std::pair<PhysRegIndex, PhysRegIndex> RenameInfo; 65 66 public: 67 //Constructor | 37 38#include <iostream> 39#include <utility> 40#include <vector> 41 42#include "cpu/o3/free_list.hh" 43//For RegIndex 44#include "arch/isa_traits.hh" --- 15 unchanged lines hidden (view full) --- 60 * return the physical register that a logical register has been 61 * renamed to, and the previous physical register that the same 62 * logical register was previously mapped to. 63 */ 64 typedef std::pair<PhysRegIndex, PhysRegIndex> RenameInfo; 65 66 public: 67 //Constructor |
68 SimpleRenameMap(unsigned _numLogicalIntRegs, 69 unsigned _numPhysicalIntRegs, 70 unsigned _numLogicalFloatRegs, 71 unsigned _numPhysicalFloatRegs, 72 unsigned _numMiscRegs, 73 RegIndex _intZeroReg, 74 RegIndex _floatZeroReg); | 68 SimpleRenameMap() {}; |
75 76 /** Destructor. */ 77 ~SimpleRenameMap(); 78 | 69 70 /** Destructor. */ 71 ~SimpleRenameMap(); 72 |
73 void init(unsigned _numLogicalIntRegs, 74 unsigned _numPhysicalIntRegs, 75 PhysRegIndex &_int_reg_start, 76 77 unsigned _numLogicalFloatRegs, 78 unsigned _numPhysicalFloatRegs, 79 PhysRegIndex &_float_reg_start, 80 81 unsigned _numMiscRegs, 82 83 RegIndex _intZeroReg, 84 RegIndex _floatZeroReg, 85 86 int id, 87 bool bindRegs); 88 |
|
79 void setFreeList(SimpleFreeList *fl_ptr); 80 81 //Tell rename map to get a free physical register for a given 82 //architected register. Not sure it should have a return value, 83 //but perhaps it should have some sort of fault in case there are 84 //no free registers. 85 RenameInfo rename(RegIndex arch_reg); 86 87 PhysRegIndex lookup(RegIndex phys_reg); 88 | 89 void setFreeList(SimpleFreeList *fl_ptr); 90 91 //Tell rename map to get a free physical register for a given 92 //architected register. Not sure it should have a return value, 93 //but perhaps it should have some sort of fault in case there are 94 //no free registers. 95 RenameInfo rename(RegIndex arch_reg); 96 97 PhysRegIndex lookup(RegIndex phys_reg); 98 |
89 bool isReady(PhysRegIndex arch_reg); 90 | |
91 /** 92 * Marks the given register as ready, meaning that its value has been 93 * calculated and written to the register file. 94 * @param ready_reg The index of the physical register that is now ready. 95 */ | 99 /** 100 * Marks the given register as ready, meaning that its value has been 101 * calculated and written to the register file. 102 * @param ready_reg The index of the physical register that is now ready. 103 */ |
96 void markAsReady(PhysRegIndex ready_reg); 97 | |
98 void setEntry(RegIndex arch_reg, PhysRegIndex renamed_reg); 99 | 104 void setEntry(RegIndex arch_reg, PhysRegIndex renamed_reg); 105 |
100 void squash(std::vector<RegIndex> freed_regs, 101 std::vector<UnmapInfo> unmaps); 102 | |
103 int numFreeEntries(); 104 105 private: | 106 int numFreeEntries(); 107 108 private: |
109 /** Rename Map ID */ 110 int id; 111 |
|
106 /** Number of logical integer registers. */ 107 int numLogicalIntRegs; 108 109 /** Number of physical integer registers. */ 110 int numPhysicalIntRegs; 111 112 /** Number of logical floating point registers. */ 113 int numLogicalFloatRegs; --- 26 unchanged lines hidden (view full) --- 140 PhysRegIndex physical_reg; 141 bool valid; 142 143 RenameEntry() 144 : physical_reg(0), valid(false) 145 { } 146 }; 147 | 112 /** Number of logical integer registers. */ 113 int numLogicalIntRegs; 114 115 /** Number of physical integer registers. */ 116 int numPhysicalIntRegs; 117 118 /** Number of logical floating point registers. */ 119 int numLogicalFloatRegs; --- 26 unchanged lines hidden (view full) --- 146 PhysRegIndex physical_reg; 147 bool valid; 148 149 RenameEntry() 150 : physical_reg(0), valid(false) 151 { } 152 }; 153 |
154 //Change this to private 155 private: |
|
148 /** Integer rename map. */ | 156 /** Integer rename map. */ |
149 RenameEntry *intRenameMap; | 157 std::vector<RenameEntry> intRenameMap; |
150 151 /** Floating point rename map. */ | 158 159 /** Floating point rename map. */ |
152 RenameEntry *floatRenameMap; | 160 std::vector<RenameEntry> floatRenameMap; |
153 | 161 |
162 private: |
|
154 /** Free list interface. */ 155 SimpleFreeList *freeList; | 163 /** Free list interface. */ 164 SimpleFreeList *freeList; |
156 157 // Might want to make all these scoreboards into one large scoreboard. 158 159 /** Scoreboard of physical integer registers, saying whether or not they 160 * are ready. 161 */ 162 std::vector<bool> intScoreboard; 163 164 /** Scoreboard of physical floating registers, saying whether or not they 165 * are ready. 166 */ 167 std::vector<bool> floatScoreboard; 168 169 /** Scoreboard of miscellaneous registers, saying whether or not they 170 * are ready. 171 */ 172 std::vector<bool> miscScoreboard; | |
173}; 174 | 165}; 166 |
175#endif //__CPU_O3_CPU_RENAME_MAP_HH__ | 167#endif //__CPU_O3_RENAME_MAP_HH__ |