gem5 [DEVELOP-FOR-25.1]
Loading...
Searching...
No Matches
gem5::o3::FetchTarget Class Reference

The fetch target class. More...

#include <ftq.hh>

Public Member Functions

 FetchTarget (const ThreadID _tid, const PCStateBase &_start_pc, FTSeqNum _seqNum)
 Fetch Target Methods -----------------------------—.
Addr startAddress ()
Addr endAddress ()
unsigned size ()
bool inRange (Addr addr)
bool isExitInst (Addr addr)
bool isExitBranch (Addr addr)
bool hasExceeded (Addr addr)
FTSeqNum ftNum ()
 Returns the fetch target number.
ThreadID getTid ()
 Returns the thread ID.
void setPredTarg (const PCStateBase &pred_pc)
 Set the predicted target of the exit branch.
const PCStateBasereadPredTarg ()
 Read the predicted target of the exit branch.
const PCStateBasereadStartPC ()
 Read the start address PC.
const PCStateBasereadEndPC ()
 Read the exit/end address PC.
bool predTaken ()
 Check if the exit branch was predicted taken.
void finalize (const PCStateBase &exit_pc, bool _is_branch, bool pred_taken, const PCStateBase &pred_pc)
 Complete a fetch target with the exit instruction.
std::string toString ()
 Print the fetch target for debugging.

Public Attributes

branch_prediction::BPredUnit::PredictorHistorybpuHistory
 Anchor point to attach a branch predictor history.

Private Attributes

std::unique_ptr< PCStateBasestartPC
 Start address of the fetch target.
std::unique_ptr< PCStateBaseendPC
 End address of the fetch target.
std::unique_ptr< PCStateBasepredPC
 Predicted target address of the fetch target.
const FTSeqNum ftSeqNum
const ThreadID tid
 The thread this FT belongs to.
bool is_branch
 Whether the exit instruction is a branch.
bool taken
 If the exit branch is predicted taken.

Detailed Description

The fetch target class.

A fetch target is used to cary branch prediction information from the decoupled branch predictor to the fetch stage. It is similar to a basic block in that it contains a continous block of instructios and typically ends with a branch. The fetch target may not contain a branch if the block exceeds the maximum size of the fetch target. In this case the next fetch target will start with the susequent address of the current fetch targets end. A fetch target may also span multiple 'surprise' branches which are branches that are never taken and thus not in the BTB and therfore invisible to the branch predictor which will treat these branches as ordinary instructions.

Definition at line 82 of file ftq.hh.

Constructor & Destructor Documentation

◆ FetchTarget()

gem5::o3::FetchTarget::FetchTarget ( const ThreadID _tid,
const PCStateBase & _start_pc,
FTSeqNum _seqNum )

Fetch Target Methods -----------------------------—.

Definition at line 54 of file ftq.cc.

References bpuHistory, ftSeqNum, is_branch, gem5::ArmISA::set, startPC, taken, and tid.

Member Function Documentation

◆ endAddress()

Addr gem5::o3::FetchTarget::endAddress ( )
inline

Definition at line 125 of file ftq.hh.

References endPC, and gem5::MaxAddr.

Referenced by hasExceeded(), inRange(), isExitBranch(), isExitInst(), and size().

◆ finalize()

void gem5::o3::FetchTarget::finalize ( const PCStateBase & exit_pc,
bool _is_branch,
bool pred_taken,
const PCStateBase & pred_pc )

Complete a fetch target with the exit instruction.

Definition at line 66 of file ftq.cc.

References endPC, is_branch, predPC, gem5::ArmISA::set, and taken.

◆ ftNum()

FTSeqNum gem5::o3::FetchTarget::ftNum ( )
inline

Returns the fetch target number.

Definition at line 163 of file ftq.hh.

References ftSeqNum.

◆ getTid()

ThreadID gem5::o3::FetchTarget::getTid ( )
inline

Returns the thread ID.

Definition at line 170 of file ftq.hh.

References tid.

◆ hasExceeded()

bool gem5::o3::FetchTarget::hasExceeded ( Addr addr)
inline

Definition at line 156 of file ftq.hh.

References gem5::X86ISA::addr, and endAddress().

◆ inRange()

bool gem5::o3::FetchTarget::inRange ( Addr addr)
inline

Definition at line 138 of file ftq.hh.

References gem5::X86ISA::addr, endAddress(), and startAddress().

◆ isExitBranch()

bool gem5::o3::FetchTarget::isExitBranch ( Addr addr)
inline

Definition at line 150 of file ftq.hh.

References gem5::X86ISA::addr, endAddress(), and is_branch.

◆ isExitInst()

bool gem5::o3::FetchTarget::isExitInst ( Addr addr)
inline

Definition at line 144 of file ftq.hh.

References gem5::X86ISA::addr, and endAddress().

◆ predTaken()

bool gem5::o3::FetchTarget::predTaken ( )
inline

Check if the exit branch was predicted taken.

Definition at line 208 of file ftq.hh.

References taken.

◆ readEndPC()

const PCStateBase & gem5::o3::FetchTarget::readEndPC ( )
inline

Read the exit/end address PC.

Definition at line 200 of file ftq.hh.

References endPC.

◆ readPredTarg()

const PCStateBase & gem5::o3::FetchTarget::readPredTarg ( )
inline

Read the predicted target of the exit branch.

Definition at line 184 of file ftq.hh.

References predPC.

◆ readStartPC()

const PCStateBase & gem5::o3::FetchTarget::readStartPC ( )
inline

Read the start address PC.

Definition at line 192 of file ftq.hh.

References startPC.

◆ setPredTarg()

void gem5::o3::FetchTarget::setPredTarg ( const PCStateBase & pred_pc)
inline

Set the predicted target of the exit branch.

Definition at line 177 of file ftq.hh.

References predPC, and gem5::ArmISA::set.

◆ size()

unsigned gem5::o3::FetchTarget::size ( )
inline

Definition at line 132 of file ftq.hh.

References endAddress(), and startAddress().

◆ startAddress()

Addr gem5::o3::FetchTarget::startAddress ( )
inline

Definition at line 118 of file ftq.hh.

References startPC.

Referenced by inRange(), and size().

◆ toString()

std::string gem5::o3::FetchTarget::toString ( )

Print the fetch target for debugging.

Definition at line 76 of file ftq.cc.

References endPC, ftSeqNum, is_branch, gem5::ArmISA::ss, and startPC.

Member Data Documentation

◆ bpuHistory

branch_prediction::BPredUnit::PredictorHistory* gem5::o3::FetchTarget::bpuHistory

Anchor point to attach a branch predictor history.

Will carry information while FT is waiting in th FTQ.

Definition at line 114 of file ftq.hh.

Referenced by FetchTarget().

◆ endPC

std::unique_ptr<PCStateBase> gem5::o3::FetchTarget::endPC
private

End address of the fetch target.

Definition at line 93 of file ftq.hh.

Referenced by endAddress(), finalize(), readEndPC(), and toString().

◆ ftSeqNum

const FTSeqNum gem5::o3::FetchTarget::ftSeqNum
private

Definition at line 100 of file ftq.hh.

Referenced by FetchTarget(), ftNum(), and toString().

◆ is_branch

bool gem5::o3::FetchTarget::is_branch
private

Whether the exit instruction is a branch.

Definition at line 106 of file ftq.hh.

Referenced by FetchTarget(), finalize(), isExitBranch(), and toString().

◆ predPC

std::unique_ptr<PCStateBase> gem5::o3::FetchTarget::predPC
private

Predicted target address of the fetch target.

Only valid when the ft ends with branch.

Definition at line 97 of file ftq.hh.

Referenced by finalize(), readPredTarg(), and setPredTarg().

◆ startPC

std::unique_ptr<PCStateBase> gem5::o3::FetchTarget::startPC
private

Start address of the fetch target.

Definition at line 90 of file ftq.hh.

Referenced by FetchTarget(), readStartPC(), startAddress(), and toString().

◆ taken

bool gem5::o3::FetchTarget::taken
private

If the exit branch is predicted taken.

Definition at line 109 of file ftq.hh.

Referenced by FetchTarget(), finalize(), and predTaken().

◆ tid

const ThreadID gem5::o3::FetchTarget::tid
private

The thread this FT belongs to.

Definition at line 103 of file ftq.hh.

Referenced by FetchTarget(), and getTid().


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

Generated on Mon Oct 27 2025 04:13:20 for gem5 by doxygen 1.14.0