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

FTQ class. More...

#include <ftq.hh>

Classes

struct  FTQStats

Public Member Functions

 FTQ (CPU *_cpu, const BaseO3CPUParams &params)
 FTQ constructor.
std::string name () const
void regProbePoints ()
 Registers probes.
void resetState (ThreadID tid)
 Reset the FTQ state.
unsigned numFreeEntries (ThreadID tid)
 Returns the number of free entries in a specific FTQ paritition.
unsigned size (ThreadID tid)
 Returns the size of the ftq for a specific partition.
bool isFull (ThreadID tid)
 Returns whether or not a specific thread's queue is full.
bool isEmpty (ThreadID tid) const
 Returns whether or not a specific thread's queue is empty.
void invalidate (ThreadID tid)
 Invalidates all fetch targets in the FTQ.
bool isReady (ThreadID tid)
 Returns if the FTQ is in a ready state and its safe to consmume fetch targets.
void lock (ThreadID tid)
 Locks the fetch target queue for a given thread.
bool isLocked (ThreadID tid)
 Check if the FTQ is locked.
void forAllForward (ThreadID tid, std::function< void(FetchTargetPtr &)> f)
 Iterates forward over all fetch targets in the FTQ from head/front to tail/back and applies a given function.
void forAllBackward (ThreadID tid, std::function< void(FetchTargetPtr &)> f)
 Iterates backward over all fetch targets in the FTQ from tail/back to head/front and applies a given function.
void insert (ThreadID tid, FetchTargetPtr fetchTarget)
 Pushes a fetch target into the back/tail of the FTQ.
void squash (ThreadID tid)
 Squashes all fetch targets in the FTQ for a specific thread.
void squashSanityCheck (ThreadID tid)
 Sanity check to verify that the fetch targets in the ftq do not have a valid bpu_history.
bool isHeadReady (ThreadID tid)
 Is the head entry ready for the fetch stage to be consumed.
FetchTargetPtr readHead (ThreadID tid)
 Returns a pointer to the head fetch target of a specific thread within the FTQ.
bool popHead (ThreadID tid)
 Pops the head fetch target once its fully processed.
void printFTQ (ThreadID tid)
 Print the all fetch targets in the FTQ for debugging.

Private Types

enum  Status { Invalid , Valid , Full , Locked }
 Possible FTQ statuses. More...

Private Attributes

std::array< Status, MaxThreadsftqStatus
 Per-thread FTQ status.
CPUcpu
 Pointer to the CPU.
const unsigned numEntries
 Number of fetch targets in the FTQ.
ProbePointArg< FetchTargetPtr > * ppFTQInsert
 Probe points to attach the FDP prefetcher.
ProbePointArg< FetchTargetPtr > * ppFTQRemove
std::array< std::list< FetchTargetPtr >, MaxThreadsftq
 FTQ List of Fetch targets.
gem5::o3::FTQ::FTQStats stats

Detailed Description

FTQ class.

Definition at line 226 of file ftq.hh.

Member Enumeration Documentation

◆ Status

enum gem5::o3::FTQ::Status
private

Possible FTQ statuses.

Enumerator
Invalid 
Valid 
Full 
Locked 

Definition at line 239 of file ftq.hh.

Constructor & Destructor Documentation

◆ FTQ()

gem5::o3::FTQ::FTQ ( CPU * _cpu,
const BaseO3CPUParams & params )

FTQ constructor.

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

Parameters
_cpuThe cpu object pointer.
paramsThe cpu params incl. several FTQ-specific parameters.

Definition at line 86 of file ftq.cc.

References cpu, gem5::o3::MaxThreads, numEntries, resetState(), and stats.

Referenced by insert(), popHead(), and printFTQ().

Member Function Documentation

◆ forAllBackward()

void gem5::o3::FTQ::forAllBackward ( ThreadID tid,
std::function< void(FetchTargetPtr &)> f )

Iterates backward over all fetch targets in the FTQ from tail/back to head/front and applies a given function.

Definition at line 178 of file ftq.cc.

References gem5::ArmISA::f, and ftq.

◆ forAllForward()

void gem5::o3::FTQ::forAllForward ( ThreadID tid,
std::function< void(FetchTargetPtr &)> f )

Iterates forward over all fetch targets in the FTQ from head/front to tail/back and applies a given function.

Definition at line 170 of file ftq.cc.

References gem5::ArmISA::f, and ftq.

◆ insert()

void gem5::o3::FTQ::insert ( ThreadID tid,
FetchTargetPtr fetchTarget )

Pushes a fetch target into the back/tail of the FTQ.

Parameters
fetchTargetPointer to the fetch target to be inserted.

Definition at line 186 of file ftq.cc.

References DPRINTF, FTQ(), ftq, numEntries, ppFTQInsert, size(), and stats.

◆ invalidate()

void gem5::o3::FTQ::invalidate ( ThreadID tid)

Invalidates all fetch targets in the FTQ.

Requires squash to recover.

Only a not empty ftq can be invalidated

Definition at line 143 of file ftq.cc.

References ftq, ftqStatus, and Invalid.

◆ isEmpty()

bool gem5::o3::FTQ::isEmpty ( ThreadID tid) const

Returns whether or not a specific thread's queue is empty.

Definition at line 137 of file ftq.cc.

References ftq.

◆ isFull()

bool gem5::o3::FTQ::isFull ( ThreadID tid)

Returns whether or not a specific thread's queue is full.

Definition at line 131 of file ftq.cc.

References ftq, and numEntries.

◆ isHeadReady()

bool gem5::o3::FTQ::isHeadReady ( ThreadID tid)

Is the head entry ready for the fetch stage to be consumed.

Definition at line 219 of file ftq.cc.

References ftq, ftqStatus, and Invalid.

◆ isLocked()

bool gem5::o3::FTQ::isLocked ( ThreadID tid)

Check if the FTQ is locked.

Definition at line 164 of file ftq.cc.

References ftqStatus, and Locked.

◆ isReady()

bool gem5::o3::FTQ::isReady ( ThreadID tid)

Returns if the FTQ is in a ready state and its safe to consmume fetch targets.

Definition at line 152 of file ftq.cc.

References ftqStatus, and Invalid.

◆ lock()

void gem5::o3::FTQ::lock ( ThreadID tid)

Locks the fetch target queue for a given thread.

Locking is different from invalidating in that the head/front fetch targets are still valid and accessible. However, all other FTs are invalid and the FTQ must be squashed to recover.

Definition at line 158 of file ftq.cc.

References ftqStatus, and Locked.

◆ name()

std::string gem5::o3::FTQ::name ( ) const

Definition at line 104 of file ftq.cc.

References cpu.

◆ numFreeEntries()

unsigned gem5::o3::FTQ::numFreeEntries ( ThreadID tid)

Returns the number of free entries in a specific FTQ paritition.

Definition at line 119 of file ftq.cc.

References ftq, and numEntries.

◆ popHead()

bool gem5::o3::FTQ::popHead ( ThreadID tid)

Pops the head fetch target once its fully processed.

In case there is still a branch history attached to the head fetch target the FTQ goes into invalid state.

Returns
Whether or not the update was successful.

Definition at line 238 of file ftq.cc.

References DPRINTF, FTQ(), ftq, ftqStatus, Invalid, Locked, ppFTQRemove, and stats.

◆ printFTQ()

void gem5::o3::FTQ::printFTQ ( ThreadID tid)

Print the all fetch targets in the FTQ for debugging.

Definition at line 268 of file ftq.cc.

References DPRINTF, FTQ(), ftq, and gem5::ArmISA::i.

◆ readHead()

FetchTargetPtr gem5::o3::FTQ::readHead ( ThreadID tid)

Returns a pointer to the head fetch target of a specific thread within the FTQ.

Returns
Pointer to the FetchTarget that is at the head of the FTQ.

Definition at line 225 of file ftq.cc.

References ftq, ftqStatus, and Invalid.

◆ regProbePoints()

void gem5::o3::FTQ::regProbePoints ( )

Registers probes.

Definition at line 110 of file ftq.cc.

References cpu, ppFTQInsert, and ppFTQRemove.

◆ resetState()

void gem5::o3::FTQ::resetState ( ThreadID tid)

Reset the FTQ state.

Definition at line 97 of file ftq.cc.

References ftq, ftqStatus, and Valid.

Referenced by FTQ().

◆ size()

unsigned gem5::o3::FTQ::size ( ThreadID tid)

Returns the size of the ftq for a specific partition.

Definition at line 125 of file ftq.cc.

References ftq.

Referenced by insert().

◆ squash()

void gem5::o3::FTQ::squash ( ThreadID tid)

Squashes all fetch targets in the FTQ for a specific thread.

Definition at line 199 of file ftq.cc.

References ftq, ftqStatus, ppFTQRemove, stats, and Valid.

◆ squashSanityCheck()

void gem5::o3::FTQ::squashSanityCheck ( ThreadID tid)

Sanity check to verify that the fetch targets in the ftq do not have a valid bpu_history.

It should be set to nullptr on squash.

Definition at line 211 of file ftq.cc.

References ftq.

Member Data Documentation

◆ cpu

CPU* gem5::o3::FTQ::cpu
private

Pointer to the CPU.

Definition at line 251 of file ftq.hh.

Referenced by FTQ(), gem5::o3::FTQ::FTQStats::FTQStats(), name(), and regProbePoints().

◆ ftq

◆ ftqStatus

std::array<Status, MaxThreads> gem5::o3::FTQ::ftqStatus
private

Per-thread FTQ status.

Definition at line 248 of file ftq.hh.

Referenced by invalidate(), isHeadReady(), isLocked(), isReady(), lock(), popHead(), readHead(), resetState(), and squash().

◆ numEntries

const unsigned gem5::o3::FTQ::numEntries
private

Number of fetch targets in the FTQ.

(per thread)

Definition at line 254 of file ftq.hh.

Referenced by FTQ(), insert(), isFull(), and numFreeEntries().

◆ ppFTQInsert

ProbePointArg<FetchTargetPtr>* gem5::o3::FTQ::ppFTQInsert
private

Probe points to attach the FDP prefetcher.

Definition at line 257 of file ftq.hh.

Referenced by insert(), and regProbePoints().

◆ ppFTQRemove

ProbePointArg<FetchTargetPtr>* gem5::o3::FTQ::ppFTQRemove
private

Definition at line 258 of file ftq.hh.

Referenced by popHead(), regProbePoints(), and squash().

◆ stats

gem5::o3::FTQ::FTQStats gem5::o3::FTQ::stats
private

Referenced by FTQ(), insert(), popHead(), and squash().


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