gem5 v24.0.0.0
Loading...
Searching...
No Matches
rob.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012 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
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Copyright (c) 2004-2006 The Regents of The University of Michigan
15 * All rights reserved.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions are
19 * met: redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer;
21 * redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution;
24 * neither the name of the copyright holders nor the names of its
25 * contributors may be used to endorse or promote products derived from
26 * this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 */
40
41#ifndef __CPU_O3_ROB_HH__
42#define __CPU_O3_ROB_HH__
43
44#include <string>
45#include <utility>
46#include <vector>
47
48#include "base/statistics.hh"
49#include "base/types.hh"
50#include "cpu/inst_seq.hh"
52#include "cpu/o3/limits.hh"
53#include "cpu/reg_class.hh"
54#include "enums/SMTQueuePolicy.hh"
55
56namespace gem5
57{
58
59struct BaseO3CPUParams;
60
61namespace o3
62{
63
64class CPU;
65
66struct DerivO3CPUParams;
67
71class ROB
72{
73 public:
76
84
85 private:
88
90 SMTQueuePolicy robPolicy;
91
92 public:
97 ROB(CPU *_cpu, const BaseO3CPUParams &params);
98
99 std::string name() const;
100
105
107 void drainSanityCheck() const;
108
110 void takeOverFrom();
111
117 void insertInst(const DynInstPtr &inst);
118
123// DynInstPtr readHeadInst();
124
129 const DynInstPtr &readHeadInst(ThreadID tid);
130
134 DynInstPtr findInst(ThreadID tid, InstSeqNum squash_inst);
135
140// DynInstPtr readTailInst();
141
147
149// void retireHead();
150
154 void retireHead(ThreadID tid);
155
157// bool isHeadReady();
158
160 bool isHeadReady(ThreadID tid);
161
163 bool canCommit();
164
166 void resetEntries();
167
169 int entryAmount(ThreadID num_threads);
170
172 unsigned numFreeEntries();
173
175 unsigned numFreeEntries(ThreadID tid);
176
179 { return maxEntries[tid]; }
180
183 { return threadEntries[tid]; }
184
186 bool isFull()
187 { return numInstsInROB == numEntries; }
188
190 bool isFull(ThreadID tid)
191 { return threadEntries[tid] == numEntries; }
192
194 bool isEmpty() const
195 { return numInstsInROB == 0; }
196
198 bool isEmpty(ThreadID tid) const
199 { return threadEntries[tid] == 0; }
200
202 void doSquash(ThreadID tid);
203
207 void squash(InstSeqNum squash_num, ThreadID tid);
208
210 void updateHead();
211
213 void updateTail();
214
216// uint64_t readHeadPC();
217
219// uint64_t readHeadPC(ThreadID tid);
220
222// uint64_t readHeadNextPC();
223
225// uint64_t readHeadNextPC(ThreadID tid);
226
228// InstSeqNum readHeadSeqNum();
229
232// InstSeqNum readHeadSeqNum(ThreadID tid);
233
235// uint64_t readTailPC();
236
238// uint64_t readTailPC(ThreadID tid);
239
241// InstSeqNum readTailSeqNum();
242
244// InstSeqNum readTailSeqNum(ThreadID tid);
245
249 bool isDoneSquashing(ThreadID tid) const
250 { return doneSquashing[tid]; }
251
256
261 int countInsts();
262
267 size_t countInsts(ThreadID tid);
268
269 private:
271 void resetState();
272
275
278
280 unsigned numEntries;
281
284
287
290
292 unsigned squashWidth;
293
294 public:
300
304
305 private:
314
315 public:
318
321
322 private:
325
328
331
332
334 {
336
337 // The number of rob_reads
339 // The number of rob_writes
342};
343
344} // namespace o3
345} // namespace gem5
346
347#endif //__CPU_O3_ROB_HH__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
O3CPU class, has each of the stages (fetch through commit) within it, as well as all of the time buff...
Definition cpu.hh:94
ROB class.
Definition rob.hh:72
bool isFull()
Returns if the ROB is full.
Definition rob.hh:186
bool canCommit()
Is there any commitable head instruction across all threads ready.
Definition rob.cc:279
int countInsts()
This is more of a debugging function than anything.
Definition rob.cc:180
void insertInst(const DynInstPtr &inst)
Function to insert an instruction into the ROB.
Definition rob.cc:197
unsigned getMaxEntries(ThreadID tid)
Returns the maximum number of entries for a specific thread.
Definition rob.hh:178
bool isDoneSquashing()
Checks if the ROB is still in the process of squashing instructions for any thread.
gem5::o3::ROB::ROBStats stats
unsigned numFreeEntries()
Returns the number of total free entries in the ROB.
Definition rob.cc:297
void updateTail()
Updates the tail instruction with the new youngest instruction.
Definition rob.cc:436
InstIt tail
Iterator pointing to the instruction which is the last instruction in the ROB.
Definition rob.hh:299
void resetEntries()
Re-adjust ROB partitioning.
Definition rob.cc:148
void squash(InstSeqNum squash_num, ThreadID tid)
Squashes all instructions younger than the given sequence number for the specific thread.
Definition rob.cc:473
bool isEmpty(ThreadID tid) const
Returns if a specific thread's partition is empty.
Definition rob.hh:198
bool isHeadReady(ThreadID tid)
Is the oldest instruction across all threads ready.
Definition rob.cc:268
ROB(CPU *_cpu, const BaseO3CPUParams &params)
ROB constructor.
Definition rob.cc:58
void retireHead(ThreadID tid)
Retires the head instruction, removing it from the ROB.
Definition rob.cc:234
std::list< DynInstPtr > instList[MaxThreads]
ROB List of Instructions.
Definition rob.hh:289
std::string name() const
Definition rob.cc:121
DynInstPtr findInst(ThreadID tid, InstSeqNum squash_inst)
Returns a pointer to the instruction with the given sequence if it is in the ROB.
Definition rob.cc:534
Status
Possible ROB statuses.
Definition rob.hh:79
@ ROBSquashing
Definition rob.hh:82
InstSeqNum squashedSeqNum[MaxThreads]
The sequence number of the squashed instruction.
Definition rob.hh:324
std::list< ThreadID > * activeThreads
Active Threads in CPU.
Definition rob.hh:277
void updateHead()
Updates the head instruction with the new oldest instruction.
Definition rob.cc:395
void drainSanityCheck() const
Perform sanity checks after a drain.
Definition rob.cc:134
Status robStatus[MaxThreads]
Per-thread ROB status.
Definition rob.hh:87
void doSquash(ThreadID tid)
Executes the squash, marking squashed instructions.
Definition rob.cc:309
const DynInstPtr & readHeadInst(ThreadID tid)
Returns pointer to the head instruction within the ROB.
Definition rob.cc:502
unsigned maxEntries[MaxThreads]
Max Insts a Thread Can Have in the ROB.
Definition rob.hh:286
InstIt head
Iterator pointing to the instruction which is the first instruction in in the ROB.
Definition rob.hh:303
bool isFull(ThreadID tid)
Returns if a specific thread's partition is full.
Definition rob.hh:190
int entryAmount(ThreadID num_threads)
Number of entries needed For 'num_threads' amount of threads.
Definition rob.cc:170
SMTQueuePolicy robPolicy
ROB resource sharing policy for SMT mode.
Definition rob.hh:90
DynInstPtr readTailInst(ThreadID tid)
Returns pointer to the tail instruction within the ROB.
Definition rob.cc:516
unsigned getThreadEntries(ThreadID tid)
Returns the number of entries being used by a specific thread.
Definition rob.hh:182
InstIt squashIt[MaxThreads]
Iterator used for walking through the list of instructions when squashing.
Definition rob.hh:313
void setActiveThreads(std::list< ThreadID > *at_ptr)
Sets pointer to the list of active threads.
Definition rob.cc:127
unsigned numEntries
Number of instructions in the ROB.
Definition rob.hh:280
void resetState()
Reset the ROB state.
Definition rob.cc:104
ThreadID numThreads
Number of active threads.
Definition rob.hh:330
bool doneSquashing[MaxThreads]
Is the ROB done squashing.
Definition rob.hh:327
CPU * cpu
Pointer to the CPU.
Definition rob.hh:274
unsigned squashWidth
Number of instructions that can be squashed in a single cycle.
Definition rob.hh:292
std::list< DynInstPtr >::iterator InstIt
Definition rob.hh:75
bool isEmpty() const
Returns if the ROB is empty.
Definition rob.hh:194
void takeOverFrom()
Takes over another CPU's thread.
Definition rob.cc:142
DynInstPtr dummyInst
Dummy instruction returned if there are no insts left.
Definition rob.hh:320
int numInstsInROB
Number of instructions in the ROB.
Definition rob.hh:317
unsigned threadEntries[MaxThreads]
Entries Per Thread.
Definition rob.hh:283
std::pair< RegIndex, RegIndex > UnmapInfo
Definition rob.hh:74
bool isDoneSquashing(ThreadID tid) const
Reads the PC of the oldest head instruction.
Definition rob.hh:249
Statistics container.
Definition group.hh:93
This is a simple scalar statistic, like a counter.
STL list class.
Definition stl.hh:51
STL pair class.
Definition stl.hh:58
static constexpr int MaxThreads
Definition limits.hh:38
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
int16_t ThreadID
Thread index/ID type.
Definition types.hh:235
uint64_t InstSeqNum
Definition inst_seq.hh:40
Declaration of Statistics objects.
ROBStats(statistics::Group *parent)
Definition rob.cc:524
statistics::Scalar reads
Definition rob.hh:338
statistics::Scalar writes
Definition rob.hh:340

Generated on Tue Jun 18 2024 16:24:02 for gem5 by doxygen 1.11.0