44 #ifndef __CPU_O3_FETCH_HH__
45 #define __CPU_O3_FETCH_HH__
47 #include "arch/decoder.hh"
48 #include "arch/utility.hh"
50 #include "config/the_isa.hh"
60 struct DerivO3CPUParams;
75 typedef typename Impl::CPUPol
CPUPol;
78 typedef typename Impl::O3CPU
O3CPU;
107 fetch->finishTranslation(fault, req);
147 return "FullO3CPU FetchFinishTranslation";
208 std::string
name()
const;
351 void fetch(
bool &status_change);
579 #endif //__CPU_O3_FETCH_HH__
Stats::Formula fetchRate
Number of instruction fetched per cycle.
Addr fetchBufferMask
Mask to align a fetch address to a fetch buffer boundary.
unsigned fetchWidth
The width of fetch in instructions.
ThreadID iqCount()
Returns the appropriate thread to fetch using the IQ count policy.
void profileStall(ThreadID tid)
Profile the reasons of fetch stall.
TheISA::ExtMachInst ExtMachInst
TheISA::Decoder * decoder[Impl::MaxThreads]
The decoder.
Cycles is a wrapper class for representing cycle counts, i.e.
Stats::Formula idleRate
Rate of how often fetch was idle.
void tick()
Ticks the fetch stage, processing all inputs signals and fetching as many instructions as possible...
FetchPriority fetchPolicy
Fetch policy.
void resetStage()
Reset this pipeline stage.
void squashFromDecode(const TheISA::PCState &newPC, const DynInstPtr squashInst, const InstSeqNum seq_num, ThreadID tid)
Squashes a specific thread and resets the PC.
FetchPriority
Fetching Policy, Add new policies here.
TimeBuffer< TimeStruct >::wire fromRename
Wire to get rename's information from backwards time buffer.
void pipelineIcacheAccesses(ThreadID tid)
Pipeline the next I-cache access to the current one.
void drainSanityCheck() const
Perform sanity checks after a drain.
Addr fetchBufferPC[Impl::MaxThreads]
The PC of the first instruction loaded into the fetch buffer.
bool checkInterrupt(Addr pc)
Check if an interrupt is pending and that we need to handle.
FetchStatus _status
Fetch status.
Impl::DynInstPtr DynInstPtr
Stats::Scalar fetchPendingTrapStallCycles
Total number of stall cycles caused by pending traps.
TimeBuffer< FetchStruct >::wire toDecode
Wire used to write any information heading to decode.
bool lookupAndUpdateNextPC(DynInstPtr &inst, TheISA::PCState &pc)
Looks up in the branch predictor to see if the next PC should be either next PC+=MachInst or a branch...
int numInst
Tracks how many instructions has been fetched this cycle.
void processCacheCompletion(PacketPtr pkt)
Processes cache completion event.
Stats::Scalar fetchMiscStallCycles
Total number of cycles spent in any other state.
Stats::Scalar fetchIdleCycles
Stat for total number of cycles spent blocked due to other stages in the pipeline.
FinishTranslationEvent(DefaultFetch< Impl > *_fetch)
Stats::Formula branchRate
Number of branch fetches per cycle.
unsigned fetchQueueSize
The size of the fetch queue in micro-ops.
Stats::Scalar fetchTlbSquashes
Total number of outstanding tlb accesses that were dropped due to a squash.
TimeBuffer< TimeStruct >::wire fromDecode
Wire to get decode's information from backwards time buffer.
Stats::Scalar icacheStallCycles
Stat for total number of cycles stalled due to an icache miss.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
Declaration of Statistics objects.
bool issuePipelinedIfetch[Impl::MaxThreads]
Set to true if a pipelined I-cache request should be issued.
ThreadID numThreads
Number of threads.
This is a simple scalar statistic, like a counter.
CPUPol::TimeStruct TimeStruct
DefaultFetch< Impl > * fetch
Stats::Scalar fetchedInsts
Stat for total number of fetched instructions.
Stats::Scalar fetchNoActiveThreadStallCycles
Total number of stall cycles caused by no active threads to run.
FetchStatus
Overall fetch status.
Stats::Distribution fetchNisnDist
Distribution of number of instructions fetched each cycle.
void deactivateThread(ThreadID tid)
For priority-based fetch policies, need to keep update priorityList.
Stats::Scalar fetchPendingDrainCycles
Total number of cycles spent in waiting for drains.
TheISA::MachInst MachInst
Typedefs from ISA.
PacketPtr retryPkt
The packet that is waiting to be retried.
ThreadID numFetchingThreads
Number of threads that are actively fetching.
Cycles iewToFetchDelay
IEW to fetch delay.
void takeOverFrom()
Takes over from another CPU's thread.
void process()
Process the delayed finish translation.
void drainStall(ThreadID tid)
Stall the fetch stage after reaching a safe drain point.
ThreadID getFetchingThread(FetchPriority &fetch_priority)
Returns the appropriate thread to fetch, given the fetch policy.
Stats::Scalar fetchCycles
Stat for total number of cycles spent fetching.
ThreadID threadFetched
Thread ID being fetched.
const char * description() const
Return a C string describing the event.
void regStats()
Registers statistics.
Addr fetchOffset[Impl::MaxThreads]
bool isDrained() const
Has the stage drained?
ThreadID roundRobin()
Returns the appropriate thread to fetch using a round robin policy.
void switchToActive()
Changes the status of this stage to active, and indicates this to the CPU.
DefaultFetch class handles both single threaded and SMT fetch.
A simple distribution stat.
int instSize
Size of instructions.
bool checkStall(ThreadID tid) const
Checks if a thread is stalled.
void fetch(bool &status_change)
Does the actual fetching of instructions and passing them on to the next stage.
Stats::Scalar fetchTlbCycles
Stat for total number of cycles spent waiting for translation.
void finishTranslation(const Fault &fault, RequestPtr mem_req)
RequestPtr memReq[Impl::MaxThreads]
Memory request used to access cache.
bool fetchCacheLine(Addr vaddr, ThreadID tid, Addr pc)
Fetches the cache line that contains the fetch PC.
void recvReqRetry()
Handles retrying the fetch access.
void finish(const Fault &fault, RequestPtr req, ThreadContext *tc, BaseTLB::Mode mode)
DefaultFetch(O3CPU *_cpu, DerivO3CPUParams *params)
DefaultFetch constructor.
ThreadID retryTid
The thread that is waiting on the cache to tell fetch to retry.
Stats::Scalar predictedBranches
Stat for total number of predicted branches.
void setActiveThreads(std::list< ThreadID > *at_ptr)
Sets pointer to list of active threads.
std::list< ThreadID > * activeThreads
List of Active Threads.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void regProbePoints()
Registers probes.
TimeBuffer< TimeStruct >::wire fromCommit
Wire to get commit's information from backwards time buffer.
Stats::Scalar fetchIcacheWaitRetryStallCycles
Total number of stall cycles caused by I-cache wait retrys.
int64_t Counter
Statistics counter type.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
uint8_t * fetchBuffer[Impl::MaxThreads]
The fetch data that is being fetched and buffered.
std::deque< DynInstPtr > fetchQueue[Impl::MaxThreads]
Queue of fetched instructions.
Impl::CPUPol CPUPol
Typedefs from Impl.
Stats::Scalar fetchIcacheSquashes
Total number of outstanding icache accesses that were dropped due to a squash.
bool interruptPending
Checks if there is an interrupt pending.
ThreadID branchCount()
Returns the appropriate thread to fetch using the branch count policy.
unsigned decodeWidth
The width of decode in instructions.
TheISA::PCState pc[Impl::MaxThreads]
Counter lastIcacheStall[Impl::MaxThreads]
Icache stall statistics.
Basically a wrapper class to hold both the branch predictor and the BTB.
FinishTranslationEvent finishTranslationEvent
Event used to delay fault generation of translation faults.
Stats::Scalar fetchPendingQuiesceStallCycles
Total number of stall cycles caused by pending quiesce instructions.
int16_t ThreadID
Thread index/ID type.
void setTimeBuffer(TimeBuffer< TimeStruct > *time_buffer)
Sets the main backwards communication time buffer pointer.
void setFetchQueue(TimeBuffer< FetchStruct > *fq_ptr)
Sets pointer to time buffer used to communicate to the next stage.
Addr fetchBufferAlignPC(Addr addr)
Align a PC to the start of a fetch buffer block.
ThreadStatus fetchStatus[Impl::MaxThreads]
Per-thread status.
Declaration of the Packet class.
Stalls stalls[Impl::MaxThreads]
Tracks which stages are telling fetch to stall.
O3CPU * cpu
Pointer to the O3CPU.
bool cacheBlocked
Is the cache blocked? If so no threads can access it.
FetchTranslation(DefaultFetch< Impl > *_fetch)
GenericISA::SimplePCState< MachInst > PCState
FetchStatus updateFetchStatus()
Updates overall fetch stage status; to be called at the end of each cycle.
Cycles decodeToFetchDelay
Decode to fetch delay.
Cycles commitToFetchDelay
Commit to fetch delay.
void switchToInactive()
Changes the status of this stage to inactive, and indicates this to the CPU.
void startupStage()
Initialize stage.
ProbePointArg< RequestPtr > * ppFetchRequestSent
To probe when a fetch request is successfully sent.
ProbePointArg< DynInstPtr > * ppFetch
Probe points.
CPUPol::FetchStruct FetchStruct
Typedefs from the CPU policy.
void setFault(Fault _fault)
Stats::Scalar fetchSquashCycles
Stat for total number of cycles spent squashing.
void squash(const TheISA::PCState &newPC, const InstSeqNum seq_num, DynInstPtr squashInst, ThreadID tid)
Squashes a specific thread and resets the PC.
unsigned fetchBufferSize
The size of the fetch buffer in bytes.
ThreadID lsqCount()
Returns the appropriate thread to fetch using the LSQ count policy.
Cycles renameToFetchDelay
Rename to fetch delay.
Source of possible stalls.
void wakeFromQuiesce()
Tells fetch to wake up from a quiesce instruction.
Stats::Scalar fetchBlockedCycles
Total number of cycles spent blocked.
ThreadStatus
Individual thread status.
Stats::Scalar fetchedCacheLines
Stat for total number of fetched cache lines.
void drainResume()
Resume after a drain.
std::list< ThreadID > priorityList
List that has the threads organized by priority.
bool checkSignalsAndUpdate(ThreadID tid)
Checks all input signals and updates the status as necessary.
std::string name() const
Returns the name of fetch.
StaticInstPtr macroop[Impl::MaxThreads]
bool delayedCommit[Impl::MaxThreads]
Can the fetch stage redirect from an interrupt on this instruction?
void setReq(RequestPtr _req)
Stats::Scalar fetchedBranches
Total number of fetched branches.
DynInstPtr buildInst(ThreadID tid, StaticInstPtr staticInst, StaticInstPtr curMacroop, TheISA::PCState thisPC, TheISA::PCState nextPC, bool trace)
std::shared_ptr< FaultBase > Fault
BPredUnit * branchPred
BPredUnit.
TimeBuffer< TimeStruct > * timeBuffer
Time buffer interface.
bool wroteToTimeBuffer
Variable that tracks if fetch has written to the time buffer this cycle.
void doSquash(const TheISA::PCState &newPC, const DynInstPtr squashInst, ThreadID tid)
Squashes a specific thread and resets the PC.
DefaultFetch< Impl > * fetch
unsigned int cacheBlkSize
Cache block size.
bool fetchBufferValid[Impl::MaxThreads]
Whether or not the fetch buffer data is valid.
void markDelayed()
Signal that the translation has been delayed due to a hw page table walk.
TimeBuffer< TimeStruct >::wire fromIEW
Wire to get iew's information from backwards time buffer.