39#ifndef __CPU_O3_FTQ_HH__
40#define __CPU_O3_FTQ_HH__
56struct BaseO3CPUParams;
63struct DerivO3CPUParams;
93 std::unique_ptr<PCStateBase>
endPC;
186 assert(
predPC !=
nullptr);
202 assert(
endPC !=
nullptr);
233 FTQ(
CPU *_cpu,
const BaseO3CPUParams ¶ms);
235 std::string
name()
const;
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
ProbePointArg generates a point for the class of Arg.
O3CPU class, has each of the stages (fetch through commit) within it, as well as all of the time buff...
void insert(ThreadID tid, FetchTargetPtr fetchTarget)
Pushes a fetch target into the back/tail of the FTQ.
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 f...
const unsigned numEntries
Number of fetch targets in the FTQ.
Status
Possible FTQ statuses.
void resetState(ThreadID tid)
Reset the FTQ state.
ProbePointArg< FetchTargetPtr > * ppFTQInsert
Probe points to attach the FDP prefetcher.
void squash(ThreadID tid)
Squashes all fetch targets in the FTQ for a specific thread.
FTQ(CPU *_cpu, const BaseO3CPUParams ¶ms)
FTQ constructor.
unsigned size(ThreadID tid)
Returns the size of the ftq for a specific partition.
ProbePointArg< FetchTargetPtr > * ppFTQRemove
void regProbePoints()
Registers probes.
FetchTargetPtr readHead(ThreadID tid)
Returns a pointer to the head fetch target of a specific thread within the FTQ.
bool isReady(ThreadID tid)
Returns if the FTQ is in a ready state and its safe to consmume fetch targets.
unsigned numFreeEntries(ThreadID tid)
Returns the number of free entries in a specific FTQ paritition.
bool isLocked(ThreadID tid)
Check if the FTQ is locked.
void invalidate(ThreadID tid)
Invalidates all fetch targets in the FTQ.
void squashSanityCheck(ThreadID tid)
Sanity check to verify that the fetch targets in the ftq do not have a valid bpu_history.
std::array< Status, MaxThreads > ftqStatus
Per-thread FTQ status.
bool isEmpty(ThreadID tid) const
Returns whether or not a specific thread's queue is empty.
bool isHeadReady(ThreadID tid)
Is the head entry ready for the fetch stage to be consumed.
bool popHead(ThreadID tid)
Pops the head fetch target once its fully processed.
CPU * cpu
Pointer to the CPU.
bool isFull(ThreadID tid)
Returns whether or not a specific thread's queue is full.
std::array< std::list< FetchTargetPtr >, MaxThreads > ftq
FTQ List of Fetch targets.
gem5::o3::FTQ::FTQStats stats
void printFTQ(ThreadID tid)
Print the all fetch targets in the FTQ for debugging.
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 ...
bool isExitInst(Addr addr)
std::unique_ptr< PCStateBase > predPC
Predicted target address of the fetch target.
bool predTaken()
Check if the exit branch was predicted taken.
bool taken
If the exit branch is predicted taken.
const PCStateBase & readEndPC()
Read the exit/end address PC.
const ThreadID tid
The thread this FT belongs to.
FTSeqNum ftNum()
Returns the fetch target number.
std::unique_ptr< PCStateBase > startPC
Start address of the fetch target.
const PCStateBase & readPredTarg()
Read the predicted target of the exit branch.
bool hasExceeded(Addr addr)
void finalize(const PCStateBase &exit_pc, bool _is_branch, bool pred_taken, const PCStateBase &pred_pc)
Complete a fetch target with the exit instruction.
FetchTarget(const ThreadID _tid, const PCStateBase &_start_pc, FTSeqNum _seqNum)
Fetch Target Methods -----------------------------—.
std::unique_ptr< PCStateBase > endPC
End address of the fetch target.
ThreadID getTid()
Returns the thread ID.
std::string toString()
Print the fetch target for debugging.
void setPredTarg(const PCStateBase &pred_pc)
Set the predicted target of the exit branch.
bool isExitBranch(Addr addr)
branch_prediction::BPredUnit::PredictorHistory * bpuHistory
Anchor point to attach a branch predictor history.
const PCStateBase & readStartPC()
Read the start address PC.
bool is_branch
Whether the exit instruction is a branch.
A simple distribution stat.
This is a simple scalar statistic, like a counter.
std::shared_ptr< FetchTarget > FetchTargetPtr
static constexpr int MaxThreads
Copyright (c) 2024 Arm Limited All rights reserved.
int16_t ThreadID
Thread index/ID type.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Declaration of Statistics objects.
Branch Predictor Unit (BPU) history object PredictorHistory This class holds all information needed t...
statistics::Distribution occupancy
FTQStats(CPU *cpu, unsigned numFTQEntries)
statistics::Scalar inserts
statistics::Scalar removals
statistics::Scalar squashes