Go to the documentation of this file.
43 #ifndef __CPU_O3_CPU_HH__
44 #define __CPU_O3_CPU_HH__
53 #include "arch/pcstate.hh"
55 #include "config/the_isa.hh"
72 #include "params/O3CPU.hh"
191 void init()
override;
473 std::set<InstSeqNum> snList;
592 return thread[tid]->getTC();
634 flags, res, std::move(amo_op), byte_enable);
717 #endif // __CPU_O3_CPU_HH__
enums::VecRegRenameMode vecMode
The rename mode of the vector registers.
This is a simple scalar statistic, like a counter.
void setArchIntReg(int reg_idx, RegVal val, ThreadID tid)
Architectural register accessors.
void addThreadToExitingList(ThreadID tid)
Insert tid to the list of threads trying to exit.
void dumpInsts()
Debug function to print all instructions on the list.
Fault pushRequest(const DynInstPtr &inst, bool isLoad, uint8_t *data, unsigned int size, Addr addr, Request::Flags flags, uint64_t *res, AtomicOpFunctorPtr amo_op=nullptr, const std::vector< bool > &byte_enable=std::vector< bool >())
CPU pushRequest function, forwards request to LSQ.
ProbePointArg< std::pair< DynInstPtr, PacketPtr > > * ppDataAccessComplete
const TheISA::VecElem & readVecElem(PhysRegIdPtr reg_idx) const
bool isCpuDrained() const
Check if a system is in a drained state.
Memory operation metadata.
std::vector< ThreadID > tids
Available thread ids in the cpu.
void setArchVecElem(const RegIndex ®_idx, const ElemIndex &ldx, const TheISA::VecElem &val, ThreadID tid)
statistics::Scalar miscRegfileWrites
std::map< ThreadID, unsigned > threadMap
Mapping for system thread id to cpu id.
std::queue< ListIt > removeList
List of all the instructions that will be removed at the end of this cycle.
void setVecElem(PhysRegIdPtr reg_idx, const TheISA::VecElem &val)
statistics::Scalar fpRegfileWrites
RegVal readCCReg(PhysRegIdPtr phys_reg)
bool removeInstsThisCycle
Records if instructions need to be removed this cycle due to being retired or squashed.
std::list< DynInstPtr >::iterator ListIt
gem5::o3::CPU::CPUStats cpuStats
InstSeqNum globalSeqNum
The global sequence number counter.
void removeInstsUntil(const InstSeqNum &seq_num, ThreadID tid)
Remove all instructions younger than the given sequence number.
VecPredReg::Container VecPredRegContainer
CPU(const O3CPUParams ¶ms)
Constructs a CPU with the given parameters.
PhysRegFile regFile
The register file.
DrainState drainState() const
Return the current drain state of an object.
RequestPort & getInstPort()
Decode decode
The decode stage.
statistics::Scalar ccRegfileWrites
Fault read(LSQRequest *req, int load_idx)
Executes a read operation, using the load specified at the load index.
std::list< ThreadID > activeThreads
Active Threads List.
UnifiedFreeList freeList
The free list.
void processInterrupts(const Fault &interrupt)
Processes any an interrupt fault.
RegVal readArchFloatReg(int reg_idx, ThreadID tid)
statistics::Scalar quiesceCycles
Stat for total number of cycles the CPU spends descheduled due to a quiesce operation or waiting for ...
Fault getInterrupts()
Returns the Fault for any valid interrupt.
void squashInstIt(const ListIt &instIt, ThreadID tid)
Removes the instruction pointed to by the iterator.
RegVal readArchCCReg(int reg_idx, ThreadID tid)
statistics::Scalar miscRegfileReads
statistics::Scalar intRegfileReads
Status _status
Overall CPU status.
TimeBuffer< TimeStruct > timeBuffer
The main time buffer to do backwards communication.
InstSeqNum getAndIncrementInstSeq()
Get the current instruction sequence number, and increment it.
std::list< int > cpuWaitList
Threads Scheduled to Enter CPU.
void removeThread(ThreadID tid)
Remove all of a thread's context from CPU.
FreeList class that simply holds the list of free integer and floating point registers.
Implements a simple scoreboard to track which registers are ready.
void htmSendAbortSignal(ThreadID tid, uint64_t htm_uid, HtmFailureFaultCause cause)
A vector of scalar stats.
void setVecReg(PhysRegIdPtr reg_idx, const TheISA::VecRegContainer &val)
void schedule(Event &event, Tick when)
void setMiscReg(int misc_reg, RegVal val, ThreadID tid)
Sets a misc.
statistics::Formula totalIpc
Stat for the total IPC.
TheISA::VecPredRegContainer & getWritableVecPredReg(PhysRegIdPtr reg_idx)
UnifiedRenameMap renameMap[MaxThreads]
The rename map.
Fetch class handles both single threaded and SMT fetch.
std::list< DynInstPtr > instList
List of all the instructions in flight.
void vecRenameMode(enums::VecRegRenameMode vec_mode)
Sets the current vector renaming mode.
Port & getDataPort() override
Get the dcache port (used to find block size for translations).
void verifyMemoryMode() const override
Verify that the system is in a memory mode supported by the CPU.
void deactivateThread(ThreadID tid)
Remove Thread from Active Threads List.
statistics::Scalar intRegfileWrites
void unserializeThread(CheckpointIn &cp, ThreadID tid) override
Unserialize one thread.
RegVal readFloatReg(PhysRegIdPtr phys_reg)
statistics::Formula cpi
Stat for the CPI per thread.
void drainSanityCheck() const
Perform sanity checks after a drain.
void serializeThread(CheckpointOut &cp, ThreadID tid) const override
Serialize a single thread.
void cleanUpRemovedInsts()
Cleans up all instructions on the remove list.
void demapPage(Addr vaddr, uint64_t asn)
TimeBuffer< IEWStruct > iewQueue
The IEW stage's instruction queue.
ProbePointArg< PacketPtr > * ppInstAccessComplete
gem5::Checker< DynInstPtr > * checker
Pointer to the checker, which can dynamically verify instruction results at run time.
void unscheduleTickEvent()
Unschedule tick event, regardless of its current state.
Cycles is a wrapper class for representing cycle counts, i.e.
Counter totalInsts() const override
Count the Total Instructions Committed in the CPU.
void deactivateStage(const StageIdx idx)
Changes a stage's status to inactive within the activity recorder.
Derived ThreadContext class for use with the O3CPU.
statistics::Vector committedInsts
Stat for the number of committed instructions per thread.
statistics::Scalar idleCycles
Stat for total number of cycles the CPU spends descheduled.
int numActiveThreads()
Returns the Number of Active Threads in the CPU.
void setArchFloatReg(int reg_idx, RegVal val, ThreadID tid)
TimeBuffer< DecodeStruct > decodeQueue
The decode stage's instruction queue.
statistics::Formula totalCpi
Stat for the total CPI.
void setArchCCReg(int reg_idx, RegVal val, ThreadID tid)
TheISA::VecRegContainer & getWritableVecReg(PhysRegIdPtr reg_idx)
Read physical vector register for modification.
DrainState
Object drain/handover states.
void setArchVecReg(int reg_idx, const TheISA::VecRegContainer &val, ThreadID tid)
const TheISA::VecPredRegContainer & readArchVecPredReg(int reg_idx, ThreadID tid) const
bool tryDrain()
Check if the pipeline has drained and signal drain done.
virtual void wakeup(ThreadID tid) override
O3CPU class, has each of the stages (fetch through commit) within it, as well as all of the time buff...
Fault write(LSQRequest *req, uint8_t *data, int store_idx)
Executes a store operation, using the store specified at the store index.
void insertThread(ThreadID tid)
Setup CPU to insert a thread's context.
Port & getInstPort() override
Used by the fetch unit to get a hold of the instruction port.
void setCCReg(PhysRegIdPtr phys_reg, RegVal val)
Commit handles single threaded and SMT commit.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
statistics::Scalar vecPredRegfileReads
void setIntReg(PhysRegIdPtr phys_reg, RegVal val)
std::shared_ptr< FaultBase > Fault
void scheduleTickEvent(Cycles delay)
Schedule tick event, regardless of its current state.
Counter totalOps() const override
Count the Total Ops (including micro ops) committed in the CPU.
const Params & params() const
void suspendContext(ThreadID tid) override
Remove Thread from Active Threads List.
StageIdx
Enum to give each stage a specific index, so when calling activateStage() or deactivateStage(),...
const TheISA::VecElem & readArchVecElem(const RegIndex ®_idx, const ElemIndex &ldx, ThreadID tid) const
void setVectorsAsReady(ThreadID tid)
Mark vector fields in scoreboard as ready right after switching vector mode, since software may read ...
Fetch fetch
The fetch stage.
void halt()
Halts the CPU.
void scheduleThreadExitEvent(ThreadID tid)
If a thread is trying to exit and its corresponding trap event has been completed,...
GenericISA::DelaySlotPCState< 4 > PCState
Simple physical register file class.
enums::VecRegRenameMode vecRenameMode() const
Returns current vector renaming mode.
uint64_t Tick
Tick count type.
IEW handles both single threaded and SMT IEW (issue/execute/writeback).
void squashFromTC(ThreadID tid)
Initiates a squash of all in-flight instructions for a given thread.
statistics::Scalar vecPredRegfileWrites
RegVal readIntReg(PhysRegIdPtr phys_reg)
void activateStage(const StageIdx idx)
Changes a stage's status to active within the activity recorder.
RegVal readMiscRegNoEffect(int misc_reg, ThreadID tid) const
Register accessors.
gem5::ThreadContext * tcBase(ThreadID tid)
Returns a pointer to a thread context.
void activateThread(ThreadID tid)
Add Thread to Active Threads List.
std::vector< ThreadState * > thread
Pointers to all of the threads in the CPU.
void setArchVecPredReg(int reg_idx, const TheISA::VecPredRegContainer &val, ThreadID tid)
void demapPage(Addr vaddr, uint64_t asn)
statistics::Scalar ccRegfileReads
statistics::Scalar timesIdled
Stat for total number of times the CPU is descheduled.
DrainState drain() override
Starts draining the CPU's pipeline of all instructions in order to stop all memory accesses.
void wakeCPU()
Wakes the CPU, rescheduling the CPU if it's not already active.
void reschedule(Event &event, Tick when, bool always=false)
const TheISA::VecRegContainer & readVecReg(PhysRegIdPtr reg_idx) const
EventFunctionWrapper tickEvent
The tick event used for scheduling CPU ticks.
void switchOut() override
Switches out this CPU.
gem5::VecRegContainer< NumVecElemPerVecReg *sizeof(VecElem)> VecRegContainer
void setMiscRegNoEffect(int misc_reg, RegVal val, ThreadID tid)
Sets a miscellaneous register.
TimeBuffer< RenameStruct > renameQueue
The rename stage's instruction queue.
ROB rob
The re-order buffer.
statistics::Scalar vecRegfileWrites
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
statistics::Scalar vecRegfileReads
statistics::Vector committedOps
Stat for the number of committed ops (including micro ops) per thread.
uint16_t ElemIndex
Logical vector register elem index type.
Addr instAddr(ThreadID tid)
Reads the commit PC of a specific thread.
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
TheISA::VecRegContainer & getWritableArchVecReg(int reg_idx, ThreadID tid)
Read architectural vector register for modification.
void activity()
Records that there is activity this cycle.
void setFloatReg(PhysRegIdPtr phys_reg, RegVal val)
void setVecPredReg(PhysRegIdPtr reg_idx, const TheISA::VecPredRegContainer &val)
ProbePointArg generates a point for the class of Arg.
void regProbePoints() override
Register probe points.
System * system
Pointer to the system.
int instcount
Count of total number of dynamic instructions in flight.
Cycles lastRunningCycle
The cycle that the CPU was last running, used for statistics.
void updateThreadPriority()
Update The Order In Which We Process Threads.
static constexpr int MaxThreads
TheISA::VecPredRegContainer & getWritableArchVecPredReg(int reg_idx, ThreadID tid)
Rename handles both single threaded and SMT rename.
statistics::Formula ipc
Stat for the IPC per thread.
void activityThisCycle()
Records that there was time buffer activity this cycle.
Fault write(LSQRequest *req, uint8_t *data, int store_idx)
CPU write function, forwards write to LSQ.
Rename rename
The dispatch stage.
TimeBuffer< FetchStruct > fetchQueue
The fetch stage's instruction queue.
void activateStage(const int idx)
Marks a stage as active.
void takeOverFrom(BaseCPU *oldCPU) override
Takes over from another CPU.
IEW iew
The issue/execute/writeback stages.
void removeInstsNotInROB(ThreadID tid)
Remove all instructions that are not currently in the ROB.
void exitThreads()
Terminate all threads that are ready to exit.
Tick lastActivatedCycle
The cycle that the CPU was last activated by a new thread.
Ports are used to interface objects to each other.
void commitDrained(ThreadID tid)
Commit has reached a safe point to drain a thread.
Decode class handles both single threaded and SMT decode.
void switchRenameMode(ThreadID tid, UnifiedFreeList *freelist)
Check if a change in renaming is needed for vector registers.
MicroPC microPC(ThreadID tid)
Reads the commit micro PC of a specific thread.
UnifiedRenameMap commitRenameMap[MaxThreads]
The commit rename map.
void trap(const Fault &fault, ThreadID tid, const StaticInstPtr &inst)
Traps to handle given fault.
bool squashed() const
Check whether the event is squashed.
void drainResume() override
Resumes execution after a drain.
ThreadID getFreeTid()
Gets a free thread id.
ListIt addInst(const DynInstPtr &inst)
Function to add instruction onto the head of the list of the instructions.
bool isThreadExiting(ThreadID tid) const
Is the thread trying to exit?
EventFunctionWrapper threadExitEvent
The exit event used for terminating all ready-to-exit threads.
double Counter
All counters are of 64-bit values.
ActivityRecorder helper class that informs the CPU if it can switch over to being idle or not.
bool isDraining() const
Is the CPU draining?
RegVal readMiscReg(int misc_reg, ThreadID tid)
Reads a misc.
std::ostream CheckpointOut
statistics::Scalar fpRegfileReads
std::unordered_map< ThreadID, bool > exitingThreads
This is a list of threads that are trying to exit.
RegVal readArchIntReg(int reg_idx, ThreadID tid)
Fault pushRequest(const DynInstPtr &inst, bool isLoad, uint8_t *data, unsigned int size, Addr addr, Request::Flags flags, uint64_t *res, AtomicOpFunctorPtr amo_op, const std::vector< bool > &byte_enable)
void squash()
Squash the current event.
RequestPort & getDataPort()
Scoreboard scoreboard
Integer Register Scoreboard.
LSQ ldstQueue
Load / store queue.
Commit commit
The commit stage.
void haltContext(ThreadID tid) override
Remove Thread from Active Threads List && Remove Thread Context from CPU.
std::unique_ptr< AtomicOpFunctor > AtomicOpFunctorPtr
ActivityRecorder activityRec
The activity recorder; used to tell if the CPU has any activity remaining or if it can go to idle and...
void pcState(const TheISA::PCState &newPCState, ThreadID tid)
Sets the commit PC state of a specific thread.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
void deactivateStage(const int idx)
Deactivates a stage.
const TheISA::VecPredRegContainer & readVecPredReg(PhysRegIdPtr reg_idx) const
void activateContext(ThreadID tid) override
Add Thread to Active Threads List.
Addr nextInstAddr(ThreadID tid)
Reads the next PC of a specific thread.
void tick()
Ticks CPU, calling tick() on each stage, and checking the overall activity to see if the CPU should d...
void startup() override
startup() is the final initialization call before simulation.
std::vector< TheISA::ISA * > isa
Fault read(LSQRequest *req, int load_idx)
CPU read function, forwards read to LSQ.
@ Draining
Draining buffers pending serialization/handover.
void instDone(ThreadID tid, const DynInstPtr &inst)
Function to tell the CPU that an instruction has completed.
bool scheduled() const
Determine if the current event is scheduled.
int16_t ThreadID
Thread index/ID type.
void init() override
Initialize the CPU.
#define panic(...)
This implements a cprintf based panic() function.
Unified register rename map for all classes of registers.
void removeFrontInst(const DynInstPtr &inst)
Remove an instruction from the front end of the list.
const TheISA::VecRegContainer & readArchVecReg(int reg_idx, ThreadID tid) const
Generated on Tue Sep 21 2021 12:24:24 for gem5 by doxygen 1.8.17