gem5 v24.0.0.0
Loading...
Searching...
No Matches
fetch2.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013-2014 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
45#ifndef __CPU_MINOR_FETCH2_HH__
46#define __CPU_MINOR_FETCH2_HH__
47
48#include <vector>
49
50#include "base/named.hh"
51#include "cpu/minor/buffers.hh"
52#include "cpu/minor/cpu.hh"
55#include "params/BaseMinorCPU.hh"
56
57namespace gem5
58{
59
60namespace minor
61{
62
65class Fetch2 : public Named
66{
67 protected:
70
73
77
80
83
86
88 unsigned int outputWidth;
89
93
96
97 public:
98 /* Public so that Pipeline can pass it to Fetch1 */
100
101 protected:
159
162
174
175 protected:
179
181 void popInput(ThreadID tid);
182
185 void dumpAllInput(ThreadID tid);
186
189 void updateBranchPrediction(const BranchData &branch);
190
194 void predictBranch(MinorDynInstPtr inst, BranchData &branch);
195
199
200 public:
201 Fetch2(const std::string &name,
202 MinorCPU &cpu_,
203 const BaseMinorCPUParams &params,
205 Latch<BranchData>::Output branchInp_,
206 Latch<BranchData>::Input predictionOut_,
208 std::vector<InputBuffer<ForwardInstData>> &next_stage_input_buffer);
209
210 public:
212 void evaluate();
213
214 void minorTrace() const;
215
216
220 bool isDrained();
221};
222
223} // namespace minor
224} // namespace gem5
225
226#endif /* __CPU_MINOR_FETCH2_HH__ */
Classes for buffer, queue and FIFO behaviour.
MinorCPU is an in-order CPU model with four fixed pipeline stages:
Definition cpu.hh:85
Interface for things with names.
Definition named.hh:39
virtual std::string name() const
Definition named.hh:47
Basically a wrapper class to hold both the branch predictor and the BTB.
Definition bpred_unit.hh:71
Forward data betwen Execute and Fetch1 carrying change-of-address/stream information.
Definition pipe_data.hh:66
This stage receives lines of data from Fetch1, separates them into instructions and passes them to De...
Definition fetch2.hh:66
gem5::minor::Fetch2::Fetch2Stats stats
Fetch2(const std::string &name, MinorCPU &cpu_, const BaseMinorCPUParams &params, Latch< ForwardLineData >::Output inp_, Latch< BranchData >::Output branchInp_, Latch< BranchData >::Input predictionOut_, Latch< ForwardInstData >::Input out_, std::vector< InputBuffer< ForwardInstData > > &next_stage_input_buffer)
Definition fetch2.cc:58
void evaluate()
Pass on input/buffer data to the output if you can.
Definition fetch2.cc:239
void updateBranchPrediction(const BranchData &branch)
Update local branch prediction structures from feedback from Execute.
Definition fetch2.cc:129
const ForwardLineData * getInput(ThreadID tid)
Get a piece of data to work on from the inputBuffer, or 0 if there is no data.
Definition fetch2.cc:97
std::vector< InputBuffer< ForwardLineData > > inputBuffer
Definition fetch2.hh:99
void popInput(ThreadID tid)
Pop an element off the input buffer, if there are any.
Definition fetch2.cc:108
MinorCPU & cpu
Pointer back to the containing CPU.
Definition fetch2.hh:69
branch_prediction::BPredUnit & branchPredictor
Branch predictor passed from Python configuration.
Definition fetch2.hh:95
Latch< ForwardLineData >::Output inp
Input port carrying lines from Fetch1.
Definition fetch2.hh:72
bool isDrained()
Is this stage drained? For Fetch2, draining is initiated by Execute halting Fetch1 causing Fetch2 to ...
Definition fetch2.cc:590
Latch< BranchData >::Input predictionOut
Output port carrying predictions back to Fetch1.
Definition fetch2.hh:79
ThreadID threadPriority
Definition fetch2.hh:161
ThreadID getScheduledThread()
Use the current threading policy to determine the next thread to fetch from.
Definition fetch2.cc:560
Latch< ForwardInstData >::Input out
Output port carrying instructions into Decode.
Definition fetch2.hh:82
void dumpAllInput(ThreadID tid)
Dump the whole contents of the input buffer.
Definition fetch2.cc:119
void predictBranch(MinorDynInstPtr inst, BranchData &branch)
Predicts branches for the given instruction.
Definition fetch2.cc:191
std::vector< InputBuffer< ForwardInstData > > & nextStageReserve
Interface to reserve space in the next stage.
Definition fetch2.hh:85
bool processMoreThanOneInput
If true, more than one input word can be processed each cycle if there is room in the output to conta...
Definition fetch2.hh:92
std::vector< Fetch2ThreadInfo > fetchInfo
Definition fetch2.hh:160
unsigned int outputWidth
Width of output of this stage/input of next in instructions.
Definition fetch2.hh:88
Latch< BranchData >::Output branchInp
Input port carrying branches from Execute.
Definition fetch2.hh:76
void minorTrace() const
Definition fetch2.cc:631
Line fetch data in the forward direction.
Definition pipe_data.hh:187
Like a Queue but with a restricted interface and a setTail function which, when the queue is empty,...
Definition buffers.hh:572
static const InstSeqNum firstFetchSeqNum
Definition dyn_inst.hh:83
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
Encapsulate wires on either input or output of the latch.
Definition buffers.hh:252
Statistics container.
Definition group.hh:93
This is a simple scalar statistic, like a counter.
STL vector class.
Definition stl.hh:37
Top level definition of the Minor in-order CPU model.
Bitfield< 12, 11 > set
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
Minor contains all the definitions within the MinorCPU apart from the CPU class itself.
Contains class definitions for data flowing between pipeline stages in the top-level structure portio...
statistics::Scalar loadInstructions
Definition fetch2.hh:170
statistics::Scalar fpInstructions
Definition fetch2.hh:168
statistics::Scalar intInstructions
Stats.
Definition fetch2.hh:167
statistics::Scalar storeInstructions
Definition fetch2.hh:171
statistics::Scalar amoInstructions
Definition fetch2.hh:172
statistics::Scalar vecInstructions
Definition fetch2.hh:169
Data members after this line are cycle-to-cycle state.
Definition fetch2.hh:105
InstSeqNum expectedStreamSeqNum
Stream sequence number remembered from last time the predictionSeqNum changed.
Definition fetch2.hh:149
InstSeqNum fetchSeqNum
Fetch2 is the source of fetch sequence numbers.
Definition fetch2.hh:143
bool havePC
PC is currently valid.
Definition fetch2.hh:135
InstSeqNum lastStreamSeqNum
Stream sequence number of the last seen line used to identify changes of instruction stream.
Definition fetch2.hh:139
std::unique_ptr< PCStateBase > pc
Remembered program counter value.
Definition fetch2.hh:130
Fetch2ThreadInfo(const Fetch2ThreadInfo &other)
Definition fetch2.hh:108
unsigned int inputIndex
Index into an incompletely processed input line that instructions are to be extracted from.
Definition fetch2.hh:121
InstSeqNum predictionSeqNum
Fetch2 is the source of prediction sequence numbers.
Definition fetch2.hh:154
bool blocked
Blocked indication for report.
Definition fetch2.hh:157

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