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"
97 typedef typename Impl::O3CPU
O3CPU;
196 void init()
override;
351 template<
typename VE,
int LaneIdx>
362 template<
typename VE>
371 template<
typename LD>
411 template<
typename VE>
417 return readVecLane<VE>(phys_reg);
422 template<
typename LD>
530 std::set<InstSeqNum> snList;
549 typename CPUPolicy::IEW
iew;
564 typename CPUPolicy::RenameMap
renameMap[Impl::MaxThreads];
570 typename CPUPolicy::ROB
rob;
660 return thread[tid]->getTC();
701 return iew.ldstQueue.pushRequest(inst, isLoad,
data, size,
addr,
702 flags, res, std::move(amo_op), byte_enable);
708 return this->iew.ldstQueue.read(req, load_idx);
714 return this->iew.ldstQueue.write(req,
data, store_idx);
721 return this->fetch.getInstPort();
728 return this->iew.ldstQueue.getDataPort();
782 #endif // __CPU_O3_CPU_HH__
virtual void wakeup(ThreadID tid) override
const TheISA::VecElem & readArchVecElem(const RegIndex ®_idx, const ElemIndex &ldx, ThreadID tid) const
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 ...
const TheISA::VecElem & readVecElem(PhysRegIdPtr reg_idx) const
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.
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.
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.
void setVecElem(PhysRegIdPtr reg_idx, const TheISA::VecElem &val)
CPUPolicy::RenameStruct RenameStruct
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.
void startup() override
startup() is the final initialization call before simulation.
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.
bool squashed() const
Check whether the event is squashed.
void serializeThread(CheckpointOut &cp, ThreadID tid) const override
Serialize a single thread.
void demapPage(Addr vaddr, uint64_t asn)
void reschedule(Event &event, Tick when, bool always=false)
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 setArchVecPredReg(int reg_idx, const TheISA::VecPredRegContainer &val, ThreadID tid)
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.
EventFunctionWrapper tickEvent
The tick event used for scheduling CPU ticks.
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.
VecLaneT< VE, true > readVecLane(PhysRegIdPtr phys_reg) const
Read physical vector register lane.
VecPredReg::Container VecPredRegContainer
TheISA::VecRegContainer & getWritableVecReg(PhysRegIdPtr reg_idx)
Read physical vector register for modification.
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.
Stats::Scalar idleCycles
Stat for total number of cycles the CPU spends descheduled.
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 setArchVecReg(int reg_idx, const TheISA::VecRegContainer &val, ThreadID tid)
FullO3CPU::FullO3CPUStats cpuStats
Status _status
Overall CPU status.
void removeFrontInst(const DynInstPtr &inst)
Remove an instruction from the front end of the list.
A vector of scalar stats.
Stats::Vector committedOps
Stat for the number of committed ops (including micro ops) per thread.
InstSeqNum globalSeqNum
The global sequence number counter.
Port & getDataPort() override
Get the dcache port (used to find block size for translations).
Stats::Scalar miscRegfileReads
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.
FullO3CPUStats(FullO3CPU *cpu)
typename LSQ< O3CPUImpl >::LSQRequest LSQRequest
TheISA::VecPredRegContainer & getWritableArchVecPredReg(int reg_idx, ThreadID tid)
void commitDrained(ThreadID tid)
Commit has reached a safe point to drain a thread.
CPUPolicy::Commit commit
The commit stage.
Stats::Vector committedInsts
Stat for the number of committed instructions per thread.
DrainState
Object drain/handover states.
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.
int64_t Counter
Statistics counter type.
PhysRegFile regFile
The register file.
void suspendContext(ThreadID tid) override
Remove Thread from Active Threads List.
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)
Stats::Scalar fpRegfileReads
void schedule(Event &event, Tick when)
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 setArchVecElem(const RegIndex ®_idx, const ElemIndex &ldx, const TheISA::VecElem &val, ThreadID tid)
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.
Stats::Scalar fpRegfileWrites
TimeBuffer< DecodeStruct > decodeQueue
The decode stage's instruction queue.
RegVal readMiscRegNoEffect(int misc_reg, ThreadID tid) const
Register accessors.
Stats::Scalar timesIdled
Stat for total number of times the CPU is descheduled.
std::shared_ptr< FaultBase > Fault
O3ThreadState< Impl > Thread
EventFunctionWrapper threadExitEvent
The exit event used for terminating all ready-to-exit threads.
std::list< int > cpuWaitList
Threads Scheduled to Enter CPU.
Ports are used to interface objects to each other.
ProbePointArg< std::pair< DynInstPtr, PacketPtr > > * ppDataAccessComplete
ActivityRecorder activityRec
The activity recorder; used to tell if the CPU has any activity remaining or if it can go to idle and...
VecLaneT< VE, true > readVecLane(PhysRegIdPtr phys_reg) const
Read physical vector register lane.
CPUPolicy::RenameMap renameMap[Impl::MaxThreads]
The rename map.
Stats::Scalar vecRegfileWrites
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...
Stats::Scalar miscRegfileWrites
FreeList class that simply holds the list of free integer and floating point registers.
FullO3CPU(const DerivO3CPUParams ¶ms)
Constructs a CPU with the given parameters.
CPUPolicy::FreeList freeList
The free 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.
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::Formula totalCpi
Stat for the total CPI.
Class that has various thread state, such as the status, the current instruction being processed,...
Stats::Scalar vecPredRegfileReads
ThreadID getFreeTid()
Gets a free thread id.
RegVal readIntReg(PhysRegIdPtr phys_reg)
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.
void setVecReg(PhysRegIdPtr reg_idx, const TheISA::VecRegContainer &val)
Stats::Scalar vecRegfileReads
std::vector< Thread * > thread
Pointers to all of the threads in the CPU.
const TheISA::VecRegContainer & readVecReg(PhysRegIdPtr reg_idx) const
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
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.
Stats::Scalar intRegfileWrites
bool isCpuDrained() const
Check if a system is in a drained state.
Stats::Formula ipc
Stat for the IPC per thread.
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.
DrainState drainState() const
Return the current drain state of an object.
bool isDraining() const
Is the CPU draining?
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.
bool tryDrain()
Check if the pipeline has drained and signal drain done.
void halt()
Halts the CPU.
std::queue< ListIt > removeList
List of all the instructions that will be removed at the end of this cycle.
@ 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)
const TheISA::VecRegContainer & readArchVecReg(int reg_idx, ThreadID tid) const
Memory operation metadata.
RegVal readArchIntReg(int reg_idx, ThreadID tid)
void scheduleTickEvent(Cycles delay)
Schedule tick event, regardless of its current state.
void demapPage(Addr vaddr, uint64_t asn)
GenericISA::DelaySlotPCState< MachInst > PCState
void activity()
Records that there is activity this cycle.
Stats::Scalar intRegfileReads
TimeBuffer< RenameStruct > renameQueue
The rename stage's instruction queue.
TheISA::VecPredRegContainer & getWritableVecPredReg(PhysRegIdPtr reg_idx)
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)
Stats::Scalar ccRegfileReads
uint16_t ElemIndex
Logical vector register elem index type.
Stats::Formula cpi
Stat for the CPI per thread.
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.
VecLaneT< VE, true > readArchVecLane(int reg_idx, int lId, ThreadID tid) const
Read architectural vector register lane.
std::vector< TheISA::ISA * > isa
void init() override
Initialize the CPU.
std::ostream CheckpointOut
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.
const TheISA::VecPredRegContainer & readArchVecPredReg(int reg_idx, ThreadID tid) const
CPUPolicy::Decode decode
The decode stage.
CPUPolicy::FetchStruct FetchStruct
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.
BaseO3CPU(const BaseCPUParams ¶ms)
TheISA::VecRegContainer & getWritableArchVecReg(int reg_idx, ThreadID tid)
Read architectural vector register for modification.
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.
const Params & params() const
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.
VecLaneT< VE, true > readVecLane(PhysRegIdPtr phys_reg) const
Reads a vector register lane.
const TheISA::VecPredRegContainer & readVecPredReg(PhysRegIdPtr reg_idx) const
void setVecPredReg(PhysRegIdPtr reg_idx, const TheISA::VecPredRegContainer &val)
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.
RegVal readArchCCReg(int reg_idx, ThreadID tid)
void unserializeThread(CheckpointIn &cp, ThreadID tid) override
Unserialize one thread.
Stats::Formula totalIpc
Stat for the total IPC.
RegVal readMiscReg(int misc_reg, ThreadID tid)
Reads a misc.
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.
void setVecLane(PhysRegIdPtr phys_reg, const LD &val)
Get a vector register lane for modification.
@ Draining
Draining buffers pending serialization/handover.
RegVal readArchFloatReg(int reg_idx, ThreadID tid)
Stats::Scalar vecPredRegfileWrites
#define panic(...)
This implements a cprintf based panic() function.
Stats::Scalar quiesceCycles
Stat for total number of cycles the CPU spends descheduled due to a quiesce operation or waiting for ...
Stats::Scalar ccRegfileWrites
Cycles lastRunningCycle
The cycle that the CPU was last running, used for statistics.
Derived ThreadContext class for use with the O3CPU.
Generated on Tue Mar 23 2021 19:41:18 for gem5 by doxygen 1.8.17