gem5  v20.0.0.3
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Minor::Fetch2 Class Reference

This stage receives lines of data from Fetch1, separates them into instructions and passes them to Decode. More...

#include <fetch2.hh>

Inheritance diagram for Minor::Fetch2:
Named

Classes

struct  Fetch2ThreadInfo
 Data members after this line are cycle-to-cycle state. More...
 

Public Member Functions

 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)
 
void evaluate ()
 Pass on input/buffer data to the output if you can. More...
 
void minorTrace () const
 
void regStats ()
 
bool isDrained ()
 Is this stage drained? For Fetch2, draining is initiated by Execute halting Fetch1 causing Fetch2 to naturally drain. More...
 
- Public Member Functions inherited from Named
 Named (const std::string &name_)
 
const std::string & name () const
 

Public Attributes

std::vector< InputBuffer< ForwardLineData > > inputBuffer
 

Protected Member Functions

const ForwardLineDatagetInput (ThreadID tid)
 Get a piece of data to work on from the inputBuffer, or 0 if there is no data. More...
 
void popInput (ThreadID tid)
 Pop an element off the input buffer, if there are any. More...
 
void dumpAllInput (ThreadID tid)
 Dump the whole contents of the input buffer. More...
 
void updateBranchPrediction (const BranchData &branch)
 Update local branch prediction structures from feedback from Execute. More...
 
void predictBranch (MinorDynInstPtr inst, BranchData &branch)
 Predicts branches for the given instruction. More...
 
ThreadID getScheduledThread ()
 Use the current threading policy to determine the next thread to fetch from. More...
 

Protected Attributes

MinorCPUcpu
 Pointer back to the containing CPU. More...
 
Latch< ForwardLineData >::Output inp
 Input port carrying lines from Fetch1. More...
 
Latch< BranchData >::Output branchInp
 Input port carrying branches from Execute. More...
 
Latch< BranchData >::Input predictionOut
 Output port carrying predictions back to Fetch1. More...
 
Latch< ForwardInstData >::Input out
 Output port carrying instructions into Decode. More...
 
std::vector< InputBuffer< ForwardInstData > > & nextStageReserve
 Interface to reserve space in the next stage. More...
 
unsigned int outputWidth
 Width of output of this stage/input of next in instructions. More...
 
bool processMoreThanOneInput
 If true, more than one input word can be processed each cycle if there is room in the output to contain its processed data. More...
 
BPredUnitbranchPredictor
 Branch predictor passed from Python configuration. More...
 
std::vector< Fetch2ThreadInfofetchInfo
 
ThreadID threadPriority
 
Stats::Scalar intInstructions
 Stats. More...
 
Stats::Scalar fpInstructions
 
Stats::Scalar vecInstructions
 
Stats::Scalar loadInstructions
 
Stats::Scalar storeInstructions
 
Stats::Scalar amoInstructions
 
- Protected Attributes inherited from Named
const std::string _name
 

Detailed Description

This stage receives lines of data from Fetch1, separates them into instructions and passes them to Decode.

Definition at line 59 of file fetch2.hh.

Constructor & Destructor Documentation

◆ Fetch2()

Minor::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 at line 53 of file fetch2.cc.

References fatal, inputBuffer, outputWidth, and sc_dt::to_string().

Member Function Documentation

◆ dumpAllInput()

void Minor::Fetch2::dumpAllInput ( ThreadID  tid)
protected

Dump the whole contents of the input buffer.

Useful after a prediction changes control flow

Definition at line 114 of file fetch2.cc.

References DPRINTF, fetchInfo, inputBuffer, and popInput().

Referenced by evaluate().

◆ evaluate()

void Minor::Fetch2::evaluate ( )

Pass on input/buffer data to the output if you can.

Reserve a slot in the next stage and output data

Definition at line 237 of file fetch2.cc.

References ActivityRecorder::activateStage(), ActivityRecorder::activity(), MinorCPU::activityRecorder, ArmISA::advancePC(), amoInstructions, Minor::Fetch2::Fetch2ThreadInfo::blocked, branchInp, cpu, decoder, DPRINTF, DTRACE, dumpAllInput(), Minor::Fetch2::Fetch2ThreadInfo::expectedStreamSeqNum, Minor::ForwardLineData::fault, Minor::Pipeline::Fetch2StageId, fetchInfo, Minor::Fetch2::Fetch2ThreadInfo::fetchSeqNum, fpInstructions, BaseCPU::getContext(), ThreadContext::getDecoderPtr(), getInput(), getScheduledThread(), Minor::Fetch2::Fetch2ThreadInfo::havePC, ArmISA::i, Minor::ForwardLineData::id, inp, inputBuffer, Minor::Fetch2::Fetch2ThreadInfo::inputIndex, Minor::ForwardInstData::insts, intInstructions, InvalidThreadID, StaticInst::isAtomic(), Minor::BranchData::isBubble(), Minor::ForwardInstData::isBubble(), Minor::ForwardLineData::isFault(), StaticInst::isFloating(), StaticInst::isInteger(), StaticInst::isLoad(), StaticInst::isStore(), Minor::BranchData::isStreamChange(), StaticInst::isVector(), Minor::Fetch2::Fetch2ThreadInfo::lastStreamSeqNum, Minor::ForwardLineData::line, Minor::ForwardLineData::lineBaseAddr, Minor::ForwardLineData::lineWidth, loadInstructions, nextStageReserve, BaseCPU::numThreads, out, outputWidth, Minor::Fetch2::Fetch2ThreadInfo::pc, Minor::ForwardLineData::pc, BaseCPU::PCMask, popInput(), predictBranch(), predictionOut, Minor::InstId::predictionSeqNum, Minor::Fetch2::Fetch2ThreadInfo::predictionSeqNum, processMoreThanOneInput, Minor::ForwardInstData::resize(), storeInstructions, Minor::InstId::streamSeqNum, Minor::InstId::threadId, Minor::BranchData::threadId, Minor::ForwardInstData::threadId, updateBranchPrediction(), and vecInstructions.

Referenced by Minor::Pipeline::evaluate().

◆ getInput()

const ForwardLineData * Minor::Fetch2::getInput ( ThreadID  tid)
protected

Get a piece of data to work on from the inputBuffer, or 0 if there is no data.

Definition at line 92 of file fetch2.cc.

References inputBuffer.

Referenced by evaluate(), and getScheduledThread().

◆ getScheduledThread()

ThreadID Minor::Fetch2::getScheduledThread ( )
inlineprotected

Use the current threading policy to determine the next thread to fetch from.

Definition at line 564 of file fetch2.cc.

References cpu, fetchInfo, getInput(), InvalidThreadID, panic, MinorCPU::randomPriority(), MinorCPU::roundRobinPriority(), MinorCPU::threadPolicy, and threadPriority.

Referenced by evaluate().

◆ isDrained()

bool Minor::Fetch2::isDrained ( )

Is this stage drained? For Fetch2, draining is initiated by Execute halting Fetch1 causing Fetch2 to naturally drain.

Branch predictions are ignored by Fetch1 during halt

Definition at line 594 of file fetch2.cc.

References inp, inputBuffer, and predictionOut.

Referenced by Minor::Pipeline::isDrained().

◆ minorTrace()

void Minor::Fetch2::minorTrace ( ) const

Definition at line 642 of file fetch2.cc.

References data, fetchInfo, inputBuffer, MINORTRACE, and out.

Referenced by Minor::Pipeline::minorTrace().

◆ popInput()

void Minor::Fetch2::popInput ( ThreadID  tid)
protected

Pop an element off the input buffer, if there are any.

Definition at line 103 of file fetch2.cc.

References fetchInfo, and inputBuffer.

Referenced by dumpAllInput(), and evaluate().

◆ predictBranch()

void Minor::Fetch2::predictBranch ( MinorDynInstPtr  inst,
BranchData branch 
)
protected

Predicts branches for the given instruction.

Updates the instruction's predicted... fields and also the branch which carries the prediction to Fetch1

Definition at line 186 of file fetch2.cc.

References Minor::BranchData::BranchPrediction, branchPredictor, DPRINTF, Minor::Fetch2::Fetch2ThreadInfo::expectedStreamSeqNum, fetchInfo, BPredUnit::predict(), Minor::Fetch2::Fetch2ThreadInfo::predictionSeqNum, and Minor::BranchData::target.

Referenced by evaluate().

◆ regStats()

void Minor::Fetch2::regStats ( )

◆ updateBranchPrediction()

void Minor::Fetch2::updateBranchPrediction ( const BranchData branch)
protected

Member Data Documentation

◆ amoInstructions

Stats::Scalar Minor::Fetch2::amoInstructions
protected

Definition at line 172 of file fetch2.hh.

Referenced by evaluate(), and regStats().

◆ branchInp

Latch<BranchData>::Output Minor::Fetch2::branchInp
protected

Input port carrying branches from Execute.

This is a snoop of the data provided to F1.

Definition at line 70 of file fetch2.hh.

Referenced by evaluate().

◆ branchPredictor

BPredUnit& Minor::Fetch2::branchPredictor
protected

Branch predictor passed from Python configuration.

Definition at line 89 of file fetch2.hh.

Referenced by predictBranch(), and updateBranchPrediction().

◆ cpu

MinorCPU& Minor::Fetch2::cpu
protected

Pointer back to the containing CPU.

Definition at line 63 of file fetch2.hh.

Referenced by evaluate(), and getScheduledThread().

◆ fetchInfo

std::vector<Fetch2ThreadInfo> Minor::Fetch2::fetchInfo
protected

◆ fpInstructions

Stats::Scalar Minor::Fetch2::fpInstructions
protected

Definition at line 168 of file fetch2.hh.

Referenced by evaluate(), and regStats().

◆ inp

Latch<ForwardLineData>::Output Minor::Fetch2::inp
protected

Input port carrying lines from Fetch1.

Definition at line 66 of file fetch2.hh.

Referenced by evaluate(), and isDrained().

◆ inputBuffer

std::vector<InputBuffer<ForwardLineData> > Minor::Fetch2::inputBuffer

Definition at line 93 of file fetch2.hh.

Referenced by dumpAllInput(), evaluate(), Fetch2(), getInput(), isDrained(), minorTrace(), and popInput().

◆ intInstructions

Stats::Scalar Minor::Fetch2::intInstructions
protected

Stats.

Definition at line 167 of file fetch2.hh.

Referenced by evaluate(), and regStats().

◆ loadInstructions

Stats::Scalar Minor::Fetch2::loadInstructions
protected

Definition at line 170 of file fetch2.hh.

Referenced by evaluate(), and regStats().

◆ nextStageReserve

std::vector<InputBuffer<ForwardInstData> >& Minor::Fetch2::nextStageReserve
protected

Interface to reserve space in the next stage.

Definition at line 79 of file fetch2.hh.

Referenced by evaluate().

◆ out

Latch<ForwardInstData>::Input Minor::Fetch2::out
protected

Output port carrying instructions into Decode.

Definition at line 76 of file fetch2.hh.

Referenced by evaluate(), and minorTrace().

◆ outputWidth

unsigned int Minor::Fetch2::outputWidth
protected

Width of output of this stage/input of next in instructions.

Definition at line 82 of file fetch2.hh.

Referenced by evaluate(), and Fetch2().

◆ predictionOut

Latch<BranchData>::Input Minor::Fetch2::predictionOut
protected

Output port carrying predictions back to Fetch1.

Definition at line 73 of file fetch2.hh.

Referenced by evaluate(), and isDrained().

◆ processMoreThanOneInput

bool Minor::Fetch2::processMoreThanOneInput
protected

If true, more than one input word can be processed each cycle if there is room in the output to contain its processed data.

Definition at line 86 of file fetch2.hh.

Referenced by evaluate().

◆ storeInstructions

Stats::Scalar Minor::Fetch2::storeInstructions
protected

Definition at line 171 of file fetch2.hh.

Referenced by evaluate(), and regStats().

◆ threadPriority

ThreadID Minor::Fetch2::threadPriority
protected

Definition at line 164 of file fetch2.hh.

Referenced by getScheduledThread().

◆ vecInstructions

Stats::Scalar Minor::Fetch2::vecInstructions
protected

Definition at line 169 of file fetch2.hh.

Referenced by evaluate(), and regStats().


The documentation for this class was generated from the following files:

Generated on Fri Jul 3 2020 15:53:50 for gem5 by doxygen 1.8.13