rename_map.hh (2632:1bb2f91485ea) rename_map.hh (2654:9559cfa91b9d)
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;

--- 16 unchanged lines hidden (view full) ---

25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29// Todo: Create destructor.
30// Have it so that there's a more meaningful name given to the variable
31// that marks the beginning of the FP registers.
32
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;

--- 16 unchanged lines hidden (view full) ---

25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29// Todo: Create destructor.
30// Have it so that there's a more meaningful name given to the variable
31// that marks the beginning of the FP registers.
32
33#ifndef __CPU_O3_CPU_RENAME_MAP_HH__
34#define __CPU_O3_CPU_RENAME_MAP_HH__
33#ifndef __CPU_O3_RENAME_MAP_HH__
34#define __CPU_O3_RENAME_MAP_HH__
35
36#include <iostream>
37#include <utility>
38#include <vector>
39
40#include "cpu/o3/free_list.hh"
41//For RegIndex
42#include "arch/isa_traits.hh"

--- 15 unchanged lines hidden (view full) ---

58 * return the physical register that a logical register has been
59 * renamed to, and the previous physical register that the same
60 * logical register was previously mapped to.
61 */
62 typedef std::pair<PhysRegIndex, PhysRegIndex> RenameInfo;
63
64 public:
65 //Constructor
35
36#include <iostream>
37#include <utility>
38#include <vector>
39
40#include "cpu/o3/free_list.hh"
41//For RegIndex
42#include "arch/isa_traits.hh"

--- 15 unchanged lines hidden (view full) ---

58 * return the physical register that a logical register has been
59 * renamed to, and the previous physical register that the same
60 * logical register was previously mapped to.
61 */
62 typedef std::pair<PhysRegIndex, PhysRegIndex> RenameInfo;
63
64 public:
65 //Constructor
66 SimpleRenameMap(unsigned _numLogicalIntRegs,
67 unsigned _numPhysicalIntRegs,
68 unsigned _numLogicalFloatRegs,
69 unsigned _numPhysicalFloatRegs,
70 unsigned _numMiscRegs,
71 RegIndex _intZeroReg,
72 RegIndex _floatZeroReg);
66 SimpleRenameMap() {};
73
74 /** Destructor. */
75 ~SimpleRenameMap();
76
67
68 /** Destructor. */
69 ~SimpleRenameMap();
70
71 void init(unsigned _numLogicalIntRegs,
72 unsigned _numPhysicalIntRegs,
73 PhysRegIndex &_int_reg_start,
74
75 unsigned _numLogicalFloatRegs,
76 unsigned _numPhysicalFloatRegs,
77 PhysRegIndex &_float_reg_start,
78
79 unsigned _numMiscRegs,
80
81 RegIndex _intZeroReg,
82 RegIndex _floatZeroReg,
83
84 int id,
85 bool bindRegs);
86
77 void setFreeList(SimpleFreeList *fl_ptr);
78
79 //Tell rename map to get a free physical register for a given
80 //architected register. Not sure it should have a return value,
81 //but perhaps it should have some sort of fault in case there are
82 //no free registers.
83 RenameInfo rename(RegIndex arch_reg);
84
85 PhysRegIndex lookup(RegIndex phys_reg);
86
87 void setFreeList(SimpleFreeList *fl_ptr);
88
89 //Tell rename map to get a free physical register for a given
90 //architected register. Not sure it should have a return value,
91 //but perhaps it should have some sort of fault in case there are
92 //no free registers.
93 RenameInfo rename(RegIndex arch_reg);
94
95 PhysRegIndex lookup(RegIndex phys_reg);
96
87 bool isReady(PhysRegIndex arch_reg);
88
89 /**
90 * Marks the given register as ready, meaning that its value has been
91 * calculated and written to the register file.
92 * @param ready_reg The index of the physical register that is now ready.
93 */
97 /**
98 * Marks the given register as ready, meaning that its value has been
99 * calculated and written to the register file.
100 * @param ready_reg The index of the physical register that is now ready.
101 */
94 void markAsReady(PhysRegIndex ready_reg);
95
96 void setEntry(RegIndex arch_reg, PhysRegIndex renamed_reg);
97
102 void setEntry(RegIndex arch_reg, PhysRegIndex renamed_reg);
103
98 void squash(std::vector<RegIndex> freed_regs,
99 std::vector<UnmapInfo> unmaps);
100
101 int numFreeEntries();
102
103 private:
104 int numFreeEntries();
105
106 private:
107 /** Rename Map ID */
108 int id;
109
104 /** Number of logical integer registers. */
105 int numLogicalIntRegs;
106
107 /** Number of physical integer registers. */
108 int numPhysicalIntRegs;
109
110 /** Number of logical floating point registers. */
111 int numLogicalFloatRegs;

--- 26 unchanged lines hidden (view full) ---

138 PhysRegIndex physical_reg;
139 bool valid;
140
141 RenameEntry()
142 : physical_reg(0), valid(false)
143 { }
144 };
145
110 /** Number of logical integer registers. */
111 int numLogicalIntRegs;
112
113 /** Number of physical integer registers. */
114 int numPhysicalIntRegs;
115
116 /** Number of logical floating point registers. */
117 int numLogicalFloatRegs;

--- 26 unchanged lines hidden (view full) ---

144 PhysRegIndex physical_reg;
145 bool valid;
146
147 RenameEntry()
148 : physical_reg(0), valid(false)
149 { }
150 };
151
152 //Change this to private
153 private:
146 /** Integer rename map. */
154 /** Integer rename map. */
147 RenameEntry *intRenameMap;
155 std::vector<RenameEntry> intRenameMap;
148
149 /** Floating point rename map. */
156
157 /** Floating point rename map. */
150 RenameEntry *floatRenameMap;
158 std::vector<RenameEntry> floatRenameMap;
151
159
160 private:
152 /** Free list interface. */
153 SimpleFreeList *freeList;
161 /** Free list interface. */
162 SimpleFreeList *freeList;
154
155 // Might want to make all these scoreboards into one large scoreboard.
156
157 /** Scoreboard of physical integer registers, saying whether or not they
158 * are ready.
159 */
160 std::vector<bool> intScoreboard;
161
162 /** Scoreboard of physical floating registers, saying whether or not they
163 * are ready.
164 */
165 std::vector<bool> floatScoreboard;
166
167 /** Scoreboard of miscellaneous registers, saying whether or not they
168 * are ready.
169 */
170 std::vector<bool> miscScoreboard;
171};
172
163};
164
173#endif //__CPU_O3_CPU_RENAME_MAP_HH__
165#endif //__CPU_O3_RENAME_MAP_HH__