regfile.hh (13557:fc33e6048b25) regfile.hh (13610:5d5404ac6288)
1/*
1/*
2 * Copyright (c) 2016 ARM Limited
2 * Copyright (c) 2016-2017 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
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

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

65{
66 private:
67
68 typedef TheISA::CCReg CCReg;
69 using VecElem = TheISA::VecElem;
70 using VecRegContainer = TheISA::VecRegContainer;
71 using PhysIds = std::vector<PhysRegId>;
72 using VecMode = Enums::VecRegRenameMode;
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
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

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

65{
66 private:
67
68 typedef TheISA::CCReg CCReg;
69 using VecElem = TheISA::VecElem;
70 using VecRegContainer = TheISA::VecRegContainer;
71 using PhysIds = std::vector<PhysRegId>;
72 using VecMode = Enums::VecRegRenameMode;
73 using VecPredRegContainer = TheISA::VecPredRegContainer;
73 public:
74 using IdRange = std::pair<PhysIds::const_iterator,
75 PhysIds::const_iterator>;
76 private:
77 static constexpr auto NumVecElemPerVecReg = TheISA::NumVecElemPerVecReg;
78
79 /** Integer register file. */
80 std::vector<RegVal> intRegFile;
81 std::vector<PhysRegId> intRegIds;
82
83 /** Floating point register file. */
84 std::vector<RegVal> floatRegFile;
85 std::vector<PhysRegId> floatRegIds;
86
87 /** Vector register file. */
88 std::vector<VecRegContainer> vectorRegFile;
89 std::vector<PhysRegId> vecRegIds;
90 std::vector<PhysRegId> vecElemIds;
91
74 public:
75 using IdRange = std::pair<PhysIds::const_iterator,
76 PhysIds::const_iterator>;
77 private:
78 static constexpr auto NumVecElemPerVecReg = TheISA::NumVecElemPerVecReg;
79
80 /** Integer register file. */
81 std::vector<RegVal> intRegFile;
82 std::vector<PhysRegId> intRegIds;
83
84 /** Floating point register file. */
85 std::vector<RegVal> floatRegFile;
86 std::vector<PhysRegId> floatRegIds;
87
88 /** Vector register file. */
89 std::vector<VecRegContainer> vectorRegFile;
90 std::vector<PhysRegId> vecRegIds;
91 std::vector<PhysRegId> vecElemIds;
92
93 /** Predicate register file. */
94 std::vector<VecPredRegContainer> vecPredRegFile;
95 std::vector<PhysRegId> vecPredRegIds;
96
92 /** Condition-code register file. */
93 std::vector<CCReg> ccRegFile;
94 std::vector<PhysRegId> ccRegIds;
95
96 /** Misc Reg Ids */
97 std::vector<PhysRegId> miscRegIds;
98
99 /**

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

112 unsigned numPhysicalVecRegs;
113
114 /**
115 * Number of physical vector element registers
116 */
117 unsigned numPhysicalVecElemRegs;
118
119 /**
97 /** Condition-code register file. */
98 std::vector<CCReg> ccRegFile;
99 std::vector<PhysRegId> ccRegIds;
100
101 /** Misc Reg Ids */
102 std::vector<PhysRegId> miscRegIds;
103
104 /**

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

117 unsigned numPhysicalVecRegs;
118
119 /**
120 * Number of physical vector element registers
121 */
122 unsigned numPhysicalVecElemRegs;
123
124 /**
125 * Number of physical predicate registers
126 */
127 unsigned numPhysicalVecPredRegs;
128
129 /**
120 * Number of physical CC registers
121 */
122 unsigned numPhysicalCCRegs;
123
124 /** Total number of physical registers. */
125 unsigned totalNumRegs;
126
127 /** Mode in which vector registers are addressed. */
128 VecMode vecMode;
129
130 public:
131 /**
132 * Constructs a physical register file with the specified amount of
133 * integer and floating point registers.
134 */
135 PhysRegFile(unsigned _numPhysicalIntRegs,
136 unsigned _numPhysicalFloatRegs,
137 unsigned _numPhysicalVecRegs,
130 * Number of physical CC registers
131 */
132 unsigned numPhysicalCCRegs;
133
134 /** Total number of physical registers. */
135 unsigned totalNumRegs;
136
137 /** Mode in which vector registers are addressed. */
138 VecMode vecMode;
139
140 public:
141 /**
142 * Constructs a physical register file with the specified amount of
143 * integer and floating point registers.
144 */
145 PhysRegFile(unsigned _numPhysicalIntRegs,
146 unsigned _numPhysicalFloatRegs,
147 unsigned _numPhysicalVecRegs,
148 unsigned _numPhysicalVecPredRegs,
138 unsigned _numPhysicalCCRegs,
139 VecMode vmode
140 );
141
142 /**
143 * Destructor to free resources
144 */
145 ~PhysRegFile() {}
146
147 /** Initialize the free list */
148 void initFreeList(UnifiedFreeList *freeList);
149
150 /** @return the number of integer physical registers. */
151 unsigned numIntPhysRegs() const { return numPhysicalIntRegs; }
152
153 /** @return the number of floating-point physical registers. */
154 unsigned numFloatPhysRegs() const { return numPhysicalFloatRegs; }
155 /** @return the number of vector physical registers. */
156 unsigned numVecPhysRegs() const { return numPhysicalVecRegs; }
149 unsigned _numPhysicalCCRegs,
150 VecMode vmode
151 );
152
153 /**
154 * Destructor to free resources
155 */
156 ~PhysRegFile() {}
157
158 /** Initialize the free list */
159 void initFreeList(UnifiedFreeList *freeList);
160
161 /** @return the number of integer physical registers. */
162 unsigned numIntPhysRegs() const { return numPhysicalIntRegs; }
163
164 /** @return the number of floating-point physical registers. */
165 unsigned numFloatPhysRegs() const { return numPhysicalFloatRegs; }
166 /** @return the number of vector physical registers. */
167 unsigned numVecPhysRegs() const { return numPhysicalVecRegs; }
168 /** @return the number of predicate physical registers. */
169 unsigned numPredPhysRegs() const { return numPhysicalVecPredRegs; }
157
158 /** @return the number of vector physical registers. */
159 unsigned numVecElemPhysRegs() const { return numPhysicalVecElemRegs; }
160
161 /** @return the number of condition-code physical registers. */
162 unsigned numCCPhysRegs() const { return numPhysicalCCRegs; }
163
164 /** @return the total number of physical registers. */

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

196 /** Reads a vector register. */
197 const VecRegContainer &
198 readVecReg(PhysRegIdPtr phys_reg) const
199 {
200 assert(phys_reg->isVectorPhysReg());
201
202 DPRINTF(IEW, "RegFile: Access to vector register %i, has "
203 "data %s\n", int(phys_reg->index()),
170
171 /** @return the number of vector physical registers. */
172 unsigned numVecElemPhysRegs() const { return numPhysicalVecElemRegs; }
173
174 /** @return the number of condition-code physical registers. */
175 unsigned numCCPhysRegs() const { return numPhysicalCCRegs; }
176
177 /** @return the total number of physical registers. */

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

209 /** Reads a vector register. */
210 const VecRegContainer &
211 readVecReg(PhysRegIdPtr phys_reg) const
212 {
213 assert(phys_reg->isVectorPhysReg());
214
215 DPRINTF(IEW, "RegFile: Access to vector register %i, has "
216 "data %s\n", int(phys_reg->index()),
204 vectorRegFile[phys_reg->index()].as<VecElem>().print());
217 vectorRegFile[phys_reg->index()].print());
205
206 return vectorRegFile[phys_reg->index()];
207 }
208
209 /** Reads a vector register for modification. */
210 VecRegContainer &
211 getWritableVecReg(PhysRegIdPtr phys_reg)
212 {

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

253 const VecElem& val = ret[phys_reg->elemIndex()];
254 DPRINTF(IEW, "RegFile: Access to element %d of vector register %i,"
255 " has data %#x\n", phys_reg->elemIndex(),
256 int(phys_reg->index()), val);
257
258 return val;
259 }
260
218
219 return vectorRegFile[phys_reg->index()];
220 }
221
222 /** Reads a vector register for modification. */
223 VecRegContainer &
224 getWritableVecReg(PhysRegIdPtr phys_reg)
225 {

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

266 const VecElem& val = ret[phys_reg->elemIndex()];
267 DPRINTF(IEW, "RegFile: Access to element %d of vector register %i,"
268 " has data %#x\n", phys_reg->elemIndex(),
269 int(phys_reg->index()), val);
270
271 return val;
272 }
273
274 /** Reads a predicate register. */
275 const VecPredRegContainer& readVecPredReg(PhysRegIdPtr phys_reg) const
276 {
277 assert(phys_reg->isVecPredPhysReg());
278
279 DPRINTF(IEW, "RegFile: Access to predicate register %i, has "
280 "data %s\n", int(phys_reg->index()),
281 vecPredRegFile[phys_reg->index()].print());
282
283 return vecPredRegFile[phys_reg->index()];
284 }
285
286 VecPredRegContainer& getWritableVecPredReg(PhysRegIdPtr phys_reg)
287 {
288 /* const_cast for not duplicating code above. */
289 return const_cast<VecPredRegContainer&>(readVecPredReg(phys_reg));
290 }
291
261 /** Reads a condition-code register. */
262 CCReg
263 readCCReg(PhysRegIdPtr phys_reg)
264 {
265 assert(phys_reg->isCCPhysReg());
266
267 DPRINTF(IEW, "RegFile: Access to cc register %i, has "
268 "data %#x\n", phys_reg->index(),

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

316
317 DPRINTF(IEW, "RegFile: Setting element %d of vector register %i to"
318 " %#x\n", phys_reg->elemIndex(), int(phys_reg->index()), val);
319
320 vectorRegFile[phys_reg->index()].as<VecElem>()[phys_reg->elemIndex()] =
321 val;
322 }
323
292 /** Reads a condition-code register. */
293 CCReg
294 readCCReg(PhysRegIdPtr phys_reg)
295 {
296 assert(phys_reg->isCCPhysReg());
297
298 DPRINTF(IEW, "RegFile: Access to cc register %i, has "
299 "data %#x\n", phys_reg->index(),

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

347
348 DPRINTF(IEW, "RegFile: Setting element %d of vector register %i to"
349 " %#x\n", phys_reg->elemIndex(), int(phys_reg->index()), val);
350
351 vectorRegFile[phys_reg->index()].as<VecElem>()[phys_reg->elemIndex()] =
352 val;
353 }
354
355 /** Sets a predicate register to the given value. */
356 void setVecPredReg(PhysRegIdPtr phys_reg, const VecPredRegContainer& val)
357 {
358 assert(phys_reg->isVecPredPhysReg());
359
360 DPRINTF(IEW, "RegFile: Setting predicate register %i to %s\n",
361 int(phys_reg->index()), val.print());
362
363 vecPredRegFile[phys_reg->index()] = val;
364 }
365
324 /** Sets a condition-code register to the given value. */
325 void
326 setCCReg(PhysRegIdPtr phys_reg, CCReg val)
327 {
328 assert(phys_reg->isCCPhysReg());
329
330 DPRINTF(IEW, "RegFile: Setting cc register %i to %#x\n",
331 phys_reg->index(), (uint64_t)val);

--- 26 unchanged lines hidden ---
366 /** Sets a condition-code register to the given value. */
367 void
368 setCCReg(PhysRegIdPtr phys_reg, CCReg val)
369 {
370 assert(phys_reg->isCCPhysReg());
371
372 DPRINTF(IEW, "RegFile: Setting cc register %i to %#x\n",
373 phys_reg->index(), (uint64_t)val);

--- 26 unchanged lines hidden ---