gem5  v20.1.0.0
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 "cpu/minor/buffers.hh"
49 #include "cpu/minor/cpu.hh"
50 #include "cpu/minor/pipe_data.hh"
51 #include "cpu/pred/bpred_unit.hh"
52 #include "params/MinorCPU.hh"
53 
54 namespace Minor
55 {
56 
59 class Fetch2 : public Named
60 {
61  protected:
64 
67 
71 
74 
77 
80 
82  unsigned int outputWidth;
83 
87 
90 
91  public:
92  /* Public so that Pipeline can pass it to Fetch1 */
94 
95  protected:
99 
102  inputIndex(0),
103  pc(TheISA::PCState(0)),
104  havePC(false),
105  lastStreamSeqNum(InstId::firstStreamSeqNum),
106  fetchSeqNum(InstId::firstFetchSeqNum),
107  expectedStreamSeqNum(InstId::firstStreamSeqNum),
108  predictionSeqNum(InstId::firstPredictionSeqNum),
109  blocked(false)
110  { }
111 
113  inputIndex(other.inputIndex),
114  pc(other.pc),
115  havePC(other.havePC),
119  blocked(other.blocked)
120  { }
121 
124  unsigned int inputIndex;
125 
126 
134 
138  bool havePC;
139 
143 
147 
153 
158 
160  bool blocked;
161  };
162 
165 
166  struct Fetch2Stats : public Stats::Group
167  {
176  } stats;
177 
178  protected:
181  const ForwardLineData *getInput(ThreadID tid);
182 
184  void popInput(ThreadID tid);
185 
188  void dumpAllInput(ThreadID tid);
189 
192  void updateBranchPrediction(const BranchData &branch);
193 
197  void predictBranch(MinorDynInstPtr inst, BranchData &branch);
198 
202 
203  public:
204  Fetch2(const std::string &name,
205  MinorCPU &cpu_,
206  MinorCPUParams &params,
208  Latch<BranchData>::Output branchInp_,
209  Latch<BranchData>::Input predictionOut_,
211  std::vector<InputBuffer<ForwardInstData>> &next_stage_input_buffer);
212 
213  public:
215  void evaluate();
216 
217  void minorTrace() const;
218 
219 
223  bool isDrained();
224 };
225 
226 }
227 
228 #endif /* __CPU_MINOR_FETCH2_HH__ */
pipe_data.hh
Minor::Fetch2::threadPriority
ThreadID threadPriority
Definition: fetch2.hh:164
Minor::Fetch2::Fetch2ThreadInfo::predictionSeqNum
InstSeqNum predictionSeqNum
Fetch2 is the source of prediction sequence numbers.
Definition: fetch2.hh:157
Minor::Fetch2::fetchInfo
std::vector< Fetch2ThreadInfo > fetchInfo
Definition: fetch2.hh:163
Minor::Fetch2::cpu
MinorCPU & cpu
Pointer back to the containing CPU.
Definition: fetch2.hh:63
Minor::Fetch2::Fetch2ThreadInfo::Fetch2ThreadInfo
Fetch2ThreadInfo()
Default constructor.
Definition: fetch2.hh:101
Minor::Fetch2::Fetch2Stats
Definition: fetch2.hh:166
Minor::Fetch2
This stage receives lines of data from Fetch1, separates them into instructions and passes them to De...
Definition: fetch2.hh:59
ThreadID
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:227
Minor::Fetch2::getScheduledThread
ThreadID getScheduledThread()
Use the current threading policy to determine the next thread to fetch from.
Definition: fetch2.cc:564
Minor::Latch::Input
Encapsulate wires on either input or output of the latch.
Definition: buffers.hh:245
Minor::Fetch2::Fetch2ThreadInfo::lastStreamSeqNum
InstSeqNum lastStreamSeqNum
Stream sequence number of the last seen line used to identify changes of instruction stream.
Definition: fetch2.hh:142
Minor::Fetch2::Fetch2ThreadInfo::fetchSeqNum
InstSeqNum fetchSeqNum
Fetch2 is the source of fetch sequence numbers.
Definition: fetch2.hh:146
Minor::Fetch2::branchPredictor
BPredUnit & branchPredictor
Branch predictor passed from Python configuration.
Definition: fetch2.hh:89
TheISA
Definition: decode_cache.hh:37
Minor::ForwardLineData
Line fetch data in the forward direction.
Definition: pipe_data.hh:171
Minor::Fetch2::out
Latch< ForwardInstData >::Input out
Output port carrying instructions into Decode.
Definition: fetch2.hh:76
cpu.hh
Minor::Fetch2::Fetch2ThreadInfo::Fetch2ThreadInfo
Fetch2ThreadInfo(const Fetch2ThreadInfo &other)
Definition: fetch2.hh:112
Minor::Fetch2::Fetch2ThreadInfo
Data members after this line are cycle-to-cycle state.
Definition: fetch2.hh:98
std::vector
STL vector class.
Definition: stl.hh:37
Minor::Fetch2::predictBranch
void predictBranch(MinorDynInstPtr inst, BranchData &branch)
Predicts branches for the given instruction.
Definition: fetch2.cc:186
Minor::Fetch2::Fetch2Stats::loadInstructions
Stats::Scalar loadInstructions
Definition: fetch2.hh:173
Minor
Definition: activity.cc:44
Minor::Fetch2::evaluate
void evaluate()
Pass on input/buffer data to the output if you can.
Definition: fetch2.cc:237
Minor::Fetch2::inp
Latch< ForwardLineData >::Output inp
Input port carrying lines from Fetch1.
Definition: fetch2.hh:66
Stats::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2533
Minor::Fetch2::branchInp
Latch< BranchData >::Output branchInp
Input port carrying branches from Execute.
Definition: fetch2.hh:70
Minor::Fetch2::popInput
void popInput(ThreadID tid)
Pop an element off the input buffer, if there are any.
Definition: fetch2.cc:103
Minor::Fetch2::Fetch2ThreadInfo::havePC
bool havePC
PC is currently valid.
Definition: fetch2.hh:138
Minor::Fetch2::getInput
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:92
MinorCPU
MinorCPU is an in-order CPU model with four fixed pipeline stages:
Definition: cpu.hh:77
Minor::Latch::Output
Definition: buffers.hh:256
Minor::Fetch2::Fetch2ThreadInfo::blocked
bool blocked
Blocked indication for report.
Definition: fetch2.hh:160
Minor::Fetch2::processMoreThanOneInput
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:86
Minor::Fetch2::outputWidth
unsigned int outputWidth
Width of output of this stage/input of next in instructions.
Definition: fetch2.hh:82
Minor::Fetch2::Fetch2ThreadInfo::expectedStreamSeqNum
InstSeqNum expectedStreamSeqNum
Stream sequence number remembered from last time the predictionSeqNum changed.
Definition: fetch2.hh:152
Minor::Fetch2::Fetch2
Fetch2(const std::string &name, MinorCPU &cpu_, MinorCPUParams &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:53
Minor::Fetch2::Fetch2Stats::storeInstructions
Stats::Scalar storeInstructions
Definition: fetch2.hh:174
Minor::Fetch2::Fetch2Stats::vecInstructions
Stats::Scalar vecInstructions
Definition: fetch2.hh:172
Minor::Fetch2::updateBranchPrediction
void updateBranchPrediction(const BranchData &branch)
Update local branch prediction structures from feedback from Execute.
Definition: fetch2.cc:124
BPredUnit
Basically a wrapper class to hold both the branch predictor and the BTB.
Definition: bpred_unit.hh:62
Minor::Fetch2::stats
Minor::Fetch2::Fetch2Stats stats
Minor::Fetch2::dumpAllInput
void dumpAllInput(ThreadID tid)
Dump the whole contents of the input buffer.
Definition: fetch2.cc:114
Minor::InputBuffer
Like a Queue but with a restricted interface and a setTail function which, when the queue is empty,...
Definition: buffers.hh:565
InstSeqNum
uint64_t InstSeqNum
Definition: inst_seq.hh:37
Minor::Fetch2::Fetch2Stats::Fetch2Stats
Fetch2Stats(MinorCPU *cpu)
Definition: fetch2.cc:605
Minor::Fetch2::predictionOut
Latch< BranchData >::Input predictionOut
Output port carrying predictions back to Fetch1.
Definition: fetch2.hh:73
Named
Definition: trace.hh:147
Minor::BranchData
Forward data betwen Execute and Fetch1 carrying change-of-address/stream information.
Definition: pipe_data.hh:62
Minor::Fetch2::Fetch2Stats::amoInstructions
Stats::Scalar amoInstructions
Definition: fetch2.hh:175
MipsISA::PCState
GenericISA::DelaySlotPCState< MachInst > PCState
Definition: types.hh:41
bpred_unit.hh
Minor::Fetch2::inputBuffer
std::vector< InputBuffer< ForwardLineData > > inputBuffer
Definition: fetch2.hh:93
Stats::Group
Statistics container.
Definition: group.hh:83
Minor::Fetch2::Fetch2ThreadInfo::pc
TheISA::PCState pc
Remembered program counter value.
Definition: fetch2.hh:133
Minor::Fetch2::Fetch2ThreadInfo::inputIndex
unsigned int inputIndex
Index into an incompletely processed input line that instructions are to be extracted from.
Definition: fetch2.hh:124
Minor::Fetch2::isDrained
bool isDrained()
Is this stage drained? For Fetch2, draining is initiated by Execute halting Fetch1 causing Fetch2 to ...
Definition: fetch2.cc:594
Minor::Fetch2::Fetch2Stats::intInstructions
Stats::Scalar intInstructions
Stats.
Definition: fetch2.hh:170
buffers.hh
RefCountingPtr< MinorDynInst >
Named::name
const std::string & name() const
Definition: trace.hh:156
Minor::InstId
Id for lines and instructions.
Definition: dyn_inst.hh:68
Minor::Fetch2::minorTrace
void minorTrace() const
Definition: fetch2.cc:635
Minor::Fetch2::Fetch2Stats::fpInstructions
Stats::Scalar fpInstructions
Definition: fetch2.hh:171
Minor::Fetch2::nextStageReserve
std::vector< InputBuffer< ForwardInstData > > & nextStageReserve
Interface to reserve space in the next stage.
Definition: fetch2.hh:79

Generated on Wed Sep 30 2020 14:02:08 for gem5 by doxygen 1.8.17