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