gem5 v24.0.0.0
Loading...
Searching...
No Matches
dyn_inst.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013-2014,2018 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 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are
16 * met: redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer;
18 * redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution;
21 * neither the name of the copyright holders nor the names of its
22 * contributors may be used to endorse or promote products derived from
23 * this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37
46#ifndef __CPU_MINOR_DYN_INST_HH__
47#define __CPU_MINOR_DYN_INST_HH__
48
49#include <iostream>
50
51#include "arch/generic/isa.hh"
52#include "base/named.hh"
53#include "base/refcnt.hh"
54#include "base/types.hh"
55#include "cpu/inst_seq.hh"
56#include "cpu/minor/buffers.hh"
57#include "cpu/static_inst.hh"
58#include "cpu/timing_expr.hh"
59#include "sim/faults.hh"
60#include "sim/insttracer.hh"
61
62namespace gem5
63{
64
65namespace minor
66{
67
68class MinorDynInst;
69
72
75class InstId
76{
77 public:
80 static const InstSeqNum firstStreamSeqNum = 1;
82 static const InstSeqNum firstLineSeqNum = 1;
83 static const InstSeqNum firstFetchSeqNum = 1;
84 static const InstSeqNum firstExecSeqNum = 1;
85
86 public:
89
94
98
102
106
111
112 public:
115 ThreadID thread_id = 0, InstSeqNum stream_seq_num = 0,
116 InstSeqNum prediction_seq_num = 0, InstSeqNum line_seq_num = 0,
117 InstSeqNum fetch_seq_num = 0, InstSeqNum exec_seq_num = 0) :
118 threadId(thread_id), streamSeqNum(stream_seq_num),
119 predictionSeqNum(prediction_seq_num), lineSeqNum(line_seq_num),
120 fetchSeqNum(fetch_seq_num), execSeqNum(exec_seq_num)
121 { }
122
123 public:
124 /* Equal if the thread and last set sequence number matches */
125 bool
126 operator== (const InstId &rhs)
127 {
128 /* If any of fetch and exec sequence number are not set
129 * they need to be 0, so a straight comparison is still
130 * fine */
131 bool ret = (threadId == rhs.threadId &&
132 lineSeqNum == rhs.lineSeqNum &&
133 fetchSeqNum == rhs.fetchSeqNum &&
134 execSeqNum == rhs.execSeqNum);
135
136 /* Stream and prediction *must* match if these are the same id */
137 if (ret) {
138 assert(streamSeqNum == rhs.streamSeqNum &&
140 }
141
142 return ret;
143 }
144};
145
148std::ostream &operator <<(std::ostream &os, const InstId &id);
149
150class MinorDynInst;
151
156std::ostream &operator <<(std::ostream &os, const MinorDynInst &inst);
157
163{
164 private:
168
169 public:
171
173
176
178 std::unique_ptr<PCStateBase> pc;
179
182
185 bool triedToPredict = false;
186
189 bool predictedTaken = false;
190
192 std::unique_ptr<PCStateBase> predictedTarget;
193
197 unsigned int fuIndex = 0;
198
200 bool inLSQ = false;
201
204
206 bool inStoreBuffer = false;
207
211 bool canEarlyIssue = false;
212
214 bool predicate = true;
215
218 bool memAccPredicate = true;
219
225
229
233
238
239 public:
241 staticInst(si), id(id_), fault(fault_), translationFault(NoFault),
242 flatDestRegIdx(si ? si->numDestRegs() : 0)
243 { }
244
245 public:
247 bool isBubble() const { return id.fetchSeqNum == 0; }
248
250 static MinorDynInstPtr bubble() { return bubbleInst; }
251
253 bool isFault() const { return fault != NoFault; }
254
256 bool isInst() const { return !isBubble() && !isFault(); }
257
259 bool isMemRef() const { return isInst() && staticInst->isMemRef(); }
260
263 bool isNoCostInst() const;
264
267 bool isLastOpInInst() const;
268
271 void minorTraceInst(const Named &named_object) const;
272
274 void reportData(std::ostream &os) const;
275
276 bool readPredicate() const { return predicate; }
277
278 void setPredicate(bool val) { predicate = val; }
279
280 bool readMemAccPredicate() const { return memAccPredicate; }
281
283
285};
286
288std::ostream &operator <<(std::ostream &os, const MinorDynInst &inst);
289
290} // namespace minor
291} // namespace gem5
292
293#endif /* __CPU_MINOR_DYN_INST_HH__ */
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
Classes for buffer, queue and FIFO behaviour.
Cycles is a wrapper class for representing cycle counts, i.e.
Definition types.hh:79
Interface for things with names.
Definition named.hh:39
Derive from RefCounted if you want to enable reference counting of this class.
Definition refcnt.hh:61
If you want a reference counting pointer to a mutable object, create it like this:
Definition refcnt.hh:127
bool isMemRef() const
Id for lines and instructions.
Definition dyn_inst.hh:76
static const InstSeqNum firstFetchSeqNum
Definition dyn_inst.hh:83
static const InstSeqNum firstExecSeqNum
Definition dyn_inst.hh:84
InstSeqNum lineSeqNum
Line sequence number.
Definition dyn_inst.hh:101
ThreadID threadId
The thread to which this line/instruction belongs.
Definition dyn_inst.hh:88
InstSeqNum streamSeqNum
The 'stream' this instruction belongs to.
Definition dyn_inst.hh:93
static const InstSeqNum firstLineSeqNum
Definition dyn_inst.hh:82
static const InstSeqNum firstStreamSeqNum
First sequence numbers to use in initialisation of the pipeline and to be expected on the first line/...
Definition dyn_inst.hh:80
static const InstSeqNum firstPredictionSeqNum
Definition dyn_inst.hh:81
bool operator==(const InstId &rhs)
Definition dyn_inst.hh:126
InstSeqNum fetchSeqNum
Fetch sequence number.
Definition dyn_inst.hh:105
InstId(ThreadID thread_id=0, InstSeqNum stream_seq_num=0, InstSeqNum prediction_seq_num=0, InstSeqNum line_seq_num=0, InstSeqNum fetch_seq_num=0, InstSeqNum exec_seq_num=0)
Very boring default constructor.
Definition dyn_inst.hh:114
InstSeqNum execSeqNum
'Execute' sequence number.
Definition dyn_inst.hh:110
InstSeqNum predictionSeqNum
The predicted qualifier to stream, attached by Fetch2 as a consequence of branch prediction.
Definition dyn_inst.hh:97
Dynamic instruction for Minor.
Definition dyn_inst.hh:163
bool inStoreBuffer
The instruction has been sent to the store buffer.
Definition dyn_inst.hh:206
Cycles minimumCommitCycle
Once issued, extraCommitDelay becomes minimumCommitCycle to account for delay in absolute time.
Definition dyn_inst.hh:232
bool memAccPredicate
Flag controlling conditional execution of the memory access associated with the instruction (only mea...
Definition dyn_inst.hh:218
bool isFault() const
Is this a fault rather than instruction.
Definition dyn_inst.hh:253
bool isNoCostInst() const
Is this an instruction that can be executed ‘for free’ and needn't spend time in an FU.
Definition dyn_inst.cc:94
InstSeqNum instToWaitFor
execSeqNum of the latest inst on which this inst depends.
Definition dyn_inst.hh:224
bool isInst() const
Is this a real instruction.
Definition dyn_inst.hh:256
bool readMemAccPredicate() const
Definition dyn_inst.hh:280
TimingExpr * extraCommitDelayExpr
Definition dyn_inst.hh:228
Fault translationFault
Translation fault in case of a mem ref.
Definition dyn_inst.hh:203
bool readPredicate() const
Definition dyn_inst.hh:276
trace::InstRecord * traceData
Trace information for this instruction's execution.
Definition dyn_inst.hh:175
bool predicate
Flag controlling conditional execution of the instruction.
Definition dyn_inst.hh:214
bool inLSQ
This instruction is in the LSQ, not a functional unit.
Definition dyn_inst.hh:200
MinorDynInst(StaticInstPtr si, InstId id_=InstId(), Fault fault_=NoFault)
Definition dyn_inst.hh:240
bool canEarlyIssue
Can this instruction be executed out of order.
Definition dyn_inst.hh:211
Cycles extraCommitDelay
Extra delay at the end of the pipeline.
Definition dyn_inst.hh:227
bool isMemRef() const
Is this a real mem ref instruction.
Definition dyn_inst.hh:259
std::vector< RegId > flatDestRegIdx
Flat register indices so that, when clearing the scoreboard, we have the same register indices as whe...
Definition dyn_inst.hh:237
std::unique_ptr< PCStateBase > predictedTarget
Predicted branch target.
Definition dyn_inst.hh:192
std::unique_ptr< PCStateBase > pc
The fetch address of this instruction.
Definition dyn_inst.hh:178
void setPredicate(bool val)
Definition dyn_inst.hh:278
void minorTraceInst(const Named &named_object) const
Print (possibly verbose) instruction information for MinorTrace using the given Named object's name.
Definition dyn_inst.cc:173
const StaticInstPtr staticInst
Definition dyn_inst.hh:170
static MinorDynInstPtr bubble()
There is a single bubble inst.
Definition dyn_inst.hh:250
bool isLastOpInInst() const
Assuming this is not a fault, is this instruction either a whole instruction or the last microop from...
Definition dyn_inst.cc:87
void reportData(std::ostream &os) const
ReportIF interface.
Definition dyn_inst.cc:100
void setMemAccPredicate(bool val)
Definition dyn_inst.hh:282
static MinorDynInstPtr bubbleInst
A prototypical bubble instruction.
Definition dyn_inst.hh:167
bool predictedTaken
This instruction was predicted to change control flow and the following instructions will have a newe...
Definition dyn_inst.hh:189
Fault fault
This is actually a fault masquerading as an instruction.
Definition dyn_inst.hh:181
bool triedToPredict
Tried to predict the destination of this inst (if a control instruction or a sys call)
Definition dyn_inst.hh:185
bool isBubble() const
The BubbleIF interface.
Definition dyn_inst.hh:247
unsigned int fuIndex
Fields only set during execution.
Definition dyn_inst.hh:197
STL vector class.
Definition stl.hh:37
Bitfield< 6 > si
Bitfield< 17 > os
Definition misc.hh:838
Bitfield< 63 > val
Definition misc.hh:804
RefCountingPtr< MinorDynInst > MinorDynInstPtr
MinorDynInsts are currently reference counted.
Definition dyn_inst.hh:71
std::ostream & operator<<(std::ostream &os, const InstId &id)
Print this id in the usual slash-separated format expected by MinorTrace.
Definition dyn_inst.cc:63
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
std::shared_ptr< FaultBase > Fault
Definition types.hh:249
int16_t ThreadID
Thread index/ID type.
Definition types.hh:235
constexpr decltype(nullptr) NoFault
Definition types.hh:253
uint64_t InstSeqNum
Definition inst_seq.hh:40
Minor contains all the definitions within the MinorCPU apart from the CPU class itself.
Classes for managing reference counted objects.

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