gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::BaseCPU Class Referenceabstract

#include <base.hh>

Inheritance diagram for gem5::BaseCPU:
gem5::ClockedObject gem5::SimObject gem5::Clocked gem5::EventManager gem5::Serializable gem5::Drainable gem5::statistics::Group gem5::Named gem5::BaseKvmCPU gem5::BaseSimpleCPU gem5::CheckerCPU gem5::Iris::BaseCPU gem5::MinorCPU gem5::o3::CPU gem5::ArmKvmCPU gem5::BaseArmKvmCPU gem5::X86KvmCPU gem5::AtomicSimpleCPU gem5::TimingSimpleCPU gem5::Checker< DynInstPtr > gem5::Checker< gem5::RefCountingPtr > gem5::Checker< class > gem5::DummyChecker gem5::Iris::CPU< CortexA76TC > gem5::Iris::CPU< CortexR52TC > gem5::Iris::CPU< TC >

Classes

struct  BaseCPUStats
 
struct  CommitCPUStats
 
struct  ExecuteCPUStats
 
struct  FetchCPUStats
 
struct  GlobalStats
 Global CPU statistics that are merged into the Root object. More...
 

Public Member Functions

virtual PortgetDataPort ()=0
 Purely virtual method that returns a reference to the data port.
 
virtual PortgetInstPort ()=0
 Purely virtual method that returns a reference to the instruction port.
 
int cpuId () const
 Reads this CPU's ID.
 
uint32_t socketId () const
 Reads this CPU's Socket ID.
 
RequestorID dataRequestorId () const
 Reads this CPU's unique data requestor ID.
 
RequestorID instRequestorId () const
 Reads this CPU's unique instruction requestor ID.
 
PortgetPort (const std::string &if_name, PortID idx=InvalidPortID) override
 Get a port on this CPU.
 
uint32_t taskId () const
 Get cpu task id.
 
void taskId (uint32_t id)
 Set cpu task id.
 
uint32_t getPid () const
 
void setPid (uint32_t pid)
 
void workItemBegin ()
 
void workItemEnd ()
 
Tick instCount ()
 
BaseInterruptsgetInterruptController (ThreadID tid)
 
virtual void wakeup (ThreadID tid)=0
 
void postInterrupt (ThreadID tid, int int_num, int index)
 
void clearInterrupt (ThreadID tid, int int_num, int index)
 
void clearInterrupts (ThreadID tid)
 
bool checkInterrupts (ThreadID tid) const
 
trace::InstTracergetTracer ()
 Provide access to the tracer pointer.
 
virtual void activateContext (ThreadID thread_num)
 Notify the CPU that the indicated context is now active.
 
virtual void suspendContext (ThreadID thread_num)
 Notify the CPU that the indicated context is now suspended.
 
virtual void haltContext (ThreadID thread_num)
 Notify the CPU that the indicated context is now halted.
 
int findContext (ThreadContext *tc)
 Given a Thread Context pointer return the thread num.
 
virtual ThreadContextgetContext (int tn)
 Given a thread num get tho thread context for it.
 
unsigned numContexts ()
 Get the number of thread contexts available.
 
ThreadID contextToThread (ContextID cid)
 Convert ContextID to threadID.
 
 PARAMS (BaseCPU)
 
 BaseCPU (const Params &params, bool is_checker=false)
 
virtual ~BaseCPU ()
 
void init () override
 init() is called after all C++ SimObjects have been created and all ports are connected.
 
void startup () override
 startup() is the final initialization call before simulation.
 
void regStats () override
 Callback to set stat parameters.
 
void regProbePoints () override
 Register probe points for this object.
 
void registerThreadContexts ()
 
void deschedulePowerGatingEvent ()
 
void schedulePowerGatingEvent ()
 
virtual void switchOut ()
 Prepare for another CPU to take over execution.
 
virtual void takeOverFrom (BaseCPU *cpu)
 Load the state of a CPU from the previous CPU object, invoked on all new CPUs that are about to be switched in.
 
virtual void setReset (bool state)
 Set the reset of the CPU to be either asserted or deasserted.
 
void flushTLBs ()
 Flush all TLBs in the CPU.
 
bool switchedOut () const
 Determine if the CPU is switched out.
 
virtual void verifyMemoryMode () const
 Verify that the system is in a memory mode supported by the CPU.
 
Addr cacheLineSize () const
 Get the cache line size of the system.
 
void serialize (CheckpointOut &cp) const override
 Serialize this object to the given output stream.
 
void unserialize (CheckpointIn &cp) override
 Reconstruct the state of this object from a checkpoint.
 
virtual void serializeThread (CheckpointOut &cp, ThreadID tid) const
 Serialize a single thread.
 
virtual void unserializeThread (CheckpointIn &cp, ThreadID tid)
 Unserialize one thread.
 
virtual Counter totalInsts () const =0
 
virtual Counter totalOps () const =0
 
void scheduleInstStop (ThreadID tid, Counter insts, std::string cause)
 Schedule an event that exits the simulation loops after a predefined number of instructions.
 
void scheduleSimpointsInstStop (std::vector< Counter > inst_starts)
 Schedule simpoint events using the scheduleInstStop function.
 
void scheduleInstStopAnyThread (Counter max_insts)
 Schedule an exit event when any threads in the core reach the max_insts instructions using the scheduleInstStop function.
 
uint64_t getCurrentInstCount (ThreadID tid)
 Get the number of instructions executed by the specified thread on this CPU.
 
void traceFunctions (Addr pc)
 
void armMonitor (ThreadID tid, Addr address)
 
bool mwait (ThreadID tid, PacketPtr pkt)
 
void mwaitAtomic (ThreadID tid, ThreadContext *tc, BaseMMU *mmu)
 
AddressMonitorgetCpuAddrMonitor (ThreadID tid)
 
virtual void htmSendAbortSignal (ThreadID tid, uint64_t htm_uid, HtmFailureFaultCause cause)
 This function is used to instruct the memory subsystem that a transaction should be aborted and the speculative state should be thrown away.
 
- Public Member Functions inherited from gem5::ClockedObject
 ClockedObject (const ClockedObjectParams &p)
 
void serialize (CheckpointOut &cp) const override
 Serialize an object.
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object.
 
- Public Member Functions inherited from gem5::SimObject
const Paramsparams () const
 
 SimObject (const Params &p)
 
virtual ~SimObject ()
 
virtual void loadState (CheckpointIn &cp)
 loadState() is called on each SimObject when restoring from a checkpoint.
 
virtual void initState ()
 initState() is called on each SimObject when not restoring from a checkpoint.
 
virtual void regProbeListeners ()
 Register probe listeners for this object.
 
ProbeManagergetProbeManager ()
 Get the probe manager for this object.
 
DrainState drain () override
 Provide a default implementation of the drain interface for objects that don't need draining.
 
virtual void memWriteback ()
 Write back dirty buffers to memory using functional writes.
 
virtual void memInvalidate ()
 Invalidate the contents of memory buffers.
 
void serialize (CheckpointOut &cp) const override
 Serialize an object.
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object.
 
- Public Member Functions inherited from gem5::EventManager
EventQueueeventQueue () const
 
void schedule (Event &event, Tick when)
 
void deschedule (Event &event)
 
void reschedule (Event &event, Tick when, bool always=false)
 
void schedule (Event *event, Tick when)
 
void deschedule (Event *event)
 
void reschedule (Event *event, Tick when, bool always=false)
 
void wakeupEventQueue (Tick when=(Tick) -1)
 This function is not needed by the usual gem5 event loop but may be necessary in derived EventQueues which host gem5 on other schedulers.
 
void setCurTick (Tick newVal)
 
 EventManager (EventManager &em)
 Event manger manages events in the event queue.
 
 EventManager (EventManager *em)
 
 EventManager (EventQueue *eq)
 
- Public Member Functions inherited from gem5::Serializable
 Serializable ()
 
virtual ~Serializable ()
 
void serializeSection (CheckpointOut &cp, const char *name) const
 Serialize an object into a new section.
 
void serializeSection (CheckpointOut &cp, const std::string &name) const
 
void unserializeSection (CheckpointIn &cp, const char *name)
 Unserialize an a child object.
 
void unserializeSection (CheckpointIn &cp, const std::string &name)
 
- Public Member Functions inherited from gem5::Drainable
DrainState drainState () const
 Return the current drain state of an object.
 
virtual void notifyFork ()
 Notify a child process of a fork.
 
- Public Member Functions inherited from gem5::statistics::Group
 Group (Group *parent, const char *name=nullptr)
 Construct a new statistics group.
 
virtual ~Group ()
 
virtual void resetStats ()
 Callback to reset stats.
 
virtual void preDumpStats ()
 Callback before stats are dumped.
 
void addStat (statistics::Info *info)
 Register a stat with this group.
 
const std::map< std::string, Group * > & getStatGroups () const
 Get all child groups associated with this object.
 
const std::vector< Info * > & getStats () const
 Get all stats associated with this object.
 
void addStatGroup (const char *name, Group *block)
 Add a stat block as a child of this block.
 
const InforesolveStat (std::string name) const
 Resolve a stat by its name within this group.
 
void mergeStatGroup (Group *block)
 Merge the contents (stats & children) of a block to this block.
 
 Group ()=delete
 
 Group (const Group &)=delete
 
Groupoperator= (const Group &)=delete
 
- Public Member Functions inherited from gem5::Named
 Named (const std::string &name_)
 
virtual ~Named ()=default
 
virtual std::string name () const
 
- Public Member Functions inherited from gem5::Clocked
void updateClockPeriod ()
 Update the tick to the current tick.
 
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 caller to determine a future cycle.
 
Cycles curCycle () const
 Determine the current cycle, corresponding to a tick aligned to a clock edge.
 
Tick nextCycle () const
 Based on the clock of the object, determine the start tick of the first cycle that is at least one cycle in the future.
 
uint64_t frequency () const
 
Tick clockPeriod () const
 
double voltage () const
 
Cycles ticksToCycles (Tick t) const
 
Tick cyclesToTicks (Cycles c) const
 

Static Public Member Functions

static int numSimulatedCPUs ()
 
static Counter numSimulatedInsts ()
 
static Counter numSimulatedOps ()
 
- Static Public Member Functions inherited from gem5::SimObject
static void serializeAll (const std::string &cpt_dir)
 Create a checkpoint by serializing all SimObjects in the system.
 
static SimObjectfind (const char *name)
 Find the SimObject with the given name and return a pointer to it.
 
static void setSimObjectResolver (SimObjectResolver *resolver)
 There is a single object name resolver, and it is only set when simulation is restoring from checkpoints.
 
static SimObjectResolvergetSimObjectResolver ()
 There is a single object name resolver, and it is only set when simulation is restoring from checkpoints.
 
- Static Public Member Functions inherited from gem5::Serializable
static const std::string & currentSection ()
 Gets the fully-qualified name of the active section.
 
static void generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream)
 Generate a checkpoint file so that the serialization can be routed to it.
 

Public Attributes

ThreadID numThreads
 Number of threads we're actually simulating (<= SMT_MAX_THREADS).
 
Systemsystem
 
gem5::BaseCPU::BaseCPUStats baseStats
 
Cycles syscallRetryLatency
 
std::vector< std::unique_ptr< FetchCPUStats > > fetchStats
 
std::vector< std::unique_ptr< ExecuteCPUStats > > executeStats
 
std::vector< std::unique_ptr< CommitCPUStats > > commitStats
 
- Public Attributes inherited from gem5::ClockedObject
PowerStatepowerState
 

Static Public Attributes

static const uint32_t invldPid = std::numeric_limits<uint32_t>::max()
 Invalid or unknown Pid.
 

Protected Types

enum  CPUState { CPU_STATE_ON , CPU_STATE_SLEEP , CPU_STATE_WAKEUP }
 

Protected Member Functions

void updateCycleCounters (CPUState state)
 base method keeping track of cycle progression
 
void enterPwrGating ()
 
- Protected Member Functions inherited from gem5::Drainable
 Drainable ()
 
virtual ~Drainable ()
 
virtual void drainResume ()
 Resume execution after a successful drain.
 
void signalDrainDone () const
 Signal that an object is drained.
 
- Protected Member Functions inherited from gem5::Clocked
 Clocked (ClockDomain &clk_domain)
 Create a clocked object and set the clock domain based on the parameters.
 
 Clocked (Clocked &)=delete
 
Clockedoperator= (Clocked &)=delete
 
virtual ~Clocked ()
 Virtual destructor due to inheritance.
 
void resetClock () const
 Reset the object's clock using the current global tick value.
 
virtual void clockPeriodUpdated ()
 A hook subclasses can implement so they can do any extra work that's needed when the clock rate is changed.
 

Protected Attributes

Tick instCnt
 Instruction count used for SPARC misc register.
 
int _cpuId
 
const uint32_t _socketId
 Each cpu will have a socket ID that corresponds to its physical location in the system.
 
RequestorID _instRequestorId
 instruction side request id that must be placed in all requests
 
RequestorID _dataRequestorId
 data side request id that must be placed in all requests
 
uint32_t _taskId
 An intrenal representation of a task identifier within gem5.
 
uint32_t _pid
 The current OS process ID that is executing on this processor.
 
bool _switchedOut
 Is the CPU switched out or active?
 
const Addr _cacheLineSize
 Cache the cache line size that we get from the system.
 
SignalSinkPort< bool > modelResetPort
 
std::vector< BaseInterrupts * > interrupts
 
std::vector< ThreadContext * > threadContexts
 
trace::InstTracertracer
 
Cycles previousCycle
 
CPUState previousState
 
const Cycles pwrGatingLatency
 
const bool powerGatingOnIdle
 
EventFunctionWrapper enterPwrGatingEvent
 
- Protected Attributes inherited from gem5::SimObject
const SimObjectParams & _params
 Cached copy of the object parameters.
 
- Protected Attributes inherited from gem5::EventManager
EventQueueeventq
 A pointer to this object's event queue.
 

Static Protected Attributes

static std::unique_ptr< GlobalStatsglobalStats
 Pointer to the global stat structure.
 

Private Member Functions

void enableFunctionTrace ()
 
void traceFunctionsInternal (Addr pc)
 

Private Attributes

bool functionTracingEnabled
 
std::ostream * functionTraceStream
 
Addr currentFunctionStart
 
Addr currentFunctionEnd
 
Tick functionEntryTick
 
std::vector< AddressMonitoraddressMonitor
 

Static Private Attributes

static std::vector< BaseCPU * > cpuList
 Static global cpu list.
 

PMU Probe points.

probing::PMUUPtr ppRetiredInsts
 Instruction commit probe point.
 
probing::PMUUPtr ppRetiredInstsPC
 
probing::PMUUPtr ppRetiredLoads
 Retired load instructions.
 
probing::PMUUPtr ppRetiredStores
 Retired store instructions.
 
probing::PMUUPtr ppRetiredBranches
 Retired branches (any type)
 
probing::PMUUPtr ppAllCycles
 CPU cycle counter even if any thread Context is suspended.
 
probing::PMUUPtr ppActiveCycles
 CPU cycle counter, only counts if any thread contexts is active.
 
ProbePointArg< bool > * ppSleeping
 ProbePoint that signals transitions of threadContexts sets.
 
virtual void probeInstCommit (const StaticInstPtr &inst, Addr pc)
 Helper method to trigger PMU probes for a committed instruction.
 
probing::PMUUPtr pmuProbePoint (const char *name)
 Helper method to instantiate probe points belonging to this object.
 

Additional Inherited Members

- Public Types inherited from gem5::ClockedObject
using Params = ClockedObjectParams
 Parameters of ClockedObject.
 
- Public Types inherited from gem5::SimObject
typedef SimObjectParams Params
 

Detailed Description

Definition at line 104 of file base.hh.

Member Enumeration Documentation

◆ CPUState

enum gem5::BaseCPU::CPUState
protected
Enumerator
CPU_STATE_ON 
CPU_STATE_SLEEP 
CPU_STATE_WAKEUP 

Definition at line 549 of file base.hh.

Constructor & Destructor Documentation

◆ BaseCPU()

gem5::BaseCPU::BaseCPU ( const Params & params,
bool is_checker = false )

Definition at line 129 of file base.cc.

References enterPwrGating().

◆ ~BaseCPU()

gem5::BaseCPU::~BaseCPU ( )
virtual

Reimplemented in gem5::Iris::BaseCPU.

Definition at line 226 of file base.cc.

Member Function Documentation

◆ activateContext()

◆ armMonitor()

◆ cacheLineSize()

◆ checkInterrupts()

◆ clearInterrupt()

◆ clearInterrupts()

void gem5::BaseCPU::clearInterrupts ( ThreadID tid)
inline

Definition at line 248 of file base.hh.

References interrupts.

Referenced by gem5::o3::Commit::commitInsts(), and gem5::ArmISA::Reset::invoke().

◆ contextToThread()

◆ cpuId()

◆ dataRequestorId()

◆ deschedulePowerGatingEvent()

void gem5::BaseCPU::deschedulePowerGatingEvent ( )

◆ enableFunctionTrace()

void gem5::BaseCPU::enableFunctionTrace ( )
private

Definition at line 221 of file base.cc.

References functionTracingEnabled.

◆ enterPwrGating()

void gem5::BaseCPU::enterPwrGating ( void )
protected

Definition at line 582 of file base.cc.

References gem5::ClockedObject::powerState, and gem5::PowerState::set().

Referenced by BaseCPU().

◆ findContext()

int gem5::BaseCPU::findContext ( ThreadContext * tc)

Given a Thread Context pointer return the thread num.

Definition at line 519 of file base.cc.

References threadContexts.

◆ flushTLBs()

void gem5::BaseCPU::flushTLBs ( )

Flush all TLBs in the CPU.

This method is mainly used to flush stale translations when switching CPUs. It is also exported to the Python world to allow it to request a TLB flush after draining the CPU to make it easier to compare traces when debugging handover/checkpointing.

Definition at line 690 of file base.cc.

References gem5::BaseMMU::flushAll(), gem5::ThreadContext::getCheckerCpuPtr(), gem5::CheckerCPU::getMMUPtr(), gem5::ThreadContext::getMMUPtr(), gem5::ArmISA::i, and threadContexts.

Referenced by switchOut().

◆ getContext()

◆ getCpuAddrMonitor()

◆ getCurrentInstCount()

Tick gem5::BaseCPU::getCurrentInstCount ( ThreadID tid)

Get the number of instructions executed by the specified thread on this CPU.

Used by Python to control simulation.

Parameters
tidThread monitor
Returns
Number of instructions executed

Definition at line 751 of file base.cc.

References threadContexts.

Referenced by scheduleInstStop().

◆ getDataPort()

virtual Port & gem5::BaseCPU::getDataPort ( )
pure virtual

Purely virtual method that returns a reference to the data port.

All subclasses must implement this method.

Returns
a reference to the data port

Implemented in gem5::AtomicSimpleCPU, gem5::BaseKvmCPU, gem5::CheckerCPU, gem5::Iris::BaseCPU, gem5::MinorCPU, gem5::o3::CPU, and gem5::TimingSimpleCPU.

Referenced by getPort(), gem5::ThreadContext::sendFunctional(), and takeOverFrom().

◆ getInstPort()

virtual Port & gem5::BaseCPU::getInstPort ( )
pure virtual

Purely virtual method that returns a reference to the instruction port.

All subclasses must implement this method.

Returns
a reference to the instruction port

Implemented in gem5::AtomicSimpleCPU, gem5::BaseKvmCPU, gem5::CheckerCPU, gem5::Iris::BaseCPU, gem5::MinorCPU, gem5::o3::CPU, and gem5::TimingSimpleCPU.

Referenced by getPort(), and takeOverFrom().

◆ getInterruptController()

◆ getPid()

uint32_t gem5::BaseCPU::getPid ( ) const
inline

Definition at line 215 of file base.hh.

References _pid.

Referenced by takeOverFrom().

◆ getPort()

Port & gem5::BaseCPU::getPort ( const std::string & if_name,
PortID idx = InvalidPortID )
overridevirtual

Get a port on this CPU.

All CPUs have a data and instruction port, and this method uses getDataPort and getInstPort of the subclasses to resolve the two ports.

Parameters
if_namethe port name
idxignored index
Returns
a reference to the port with the given name

Reimplemented from gem5::SimObject.

Reimplemented in gem5::fastmodel::CortexA76, and gem5::fastmodel::CortexR52.

Definition at line 455 of file base.cc.

References getDataPort(), getInstPort(), gem5::SimObject::getPort(), and modelResetPort.

Referenced by gem5::fastmodel::CortexA76::getPort().

◆ getTracer()

trace::InstTracer * gem5::BaseCPU::getTracer ( )
inline

Provide access to the tracer pointer.

Definition at line 272 of file base.hh.

References tracer.

Referenced by gem5::o3::Fetch::buildInst().

◆ haltContext()

void gem5::BaseCPU::haltContext ( ThreadID thread_num)
virtual

Notify the CPU that the indicated context is now halted.

Reimplemented in gem5::BaseKvmCPU, gem5::BaseSimpleCPU, and gem5::o3::CPU.

Definition at line 576 of file base.cc.

References CPU_STATE_SLEEP, and updateCycleCounters().

Referenced by gem5::SimpleThread::halt().

◆ htmSendAbortSignal()

virtual void gem5::BaseCPU::htmSendAbortSignal ( ThreadID tid,
uint64_t htm_uid,
HtmFailureFaultCause cause )
inlinevirtual

This function is used to instruct the memory subsystem that a transaction should be aborted and the speculative state should be thrown away.

This is called in the transaction's very last breath in the core. Afterwards, the core throws away its speculative state and resumes execution at the point the transaction started, i.e. reverses time. When instruction execution resumes, the core expects the memory subsystem to be in a stable, i.e. pre-speculative, state as well.

Reimplemented in gem5::AtomicSimpleCPU, gem5::o3::CPU, and gem5::TimingSimpleCPU.

Definition at line 673 of file base.hh.

References panic.

Referenced by gem5::SimpleThread::htmAbortTransaction().

◆ init()

void gem5::BaseCPU::init ( )
overridevirtual

init() is called after all C++ SimObjects have been created and all ports are connected.

Initializations that are independent of unserialization but rely on a fully instantiated and connected SimObject graph should be done here.

Reimplemented from gem5::SimObject.

Reimplemented in gem5::BaseKvmCPU, gem5::CheckerCPU, gem5::MinorCPU, gem5::o3::CPU, gem5::TimingSimpleCPU, and gem5::X86KvmCPU.

Definition at line 310 of file base.cc.

References gem5::MipsISA::event, numThreads, gem5::SimObject::params(), registerThreadContexts(), scheduleInstStopAnyThread(), scheduleSimpointsInstStop(), threadContexts, and verifyMemoryMode().

Referenced by gem5::AtomicSimpleCPU::init(), gem5::BaseKvmCPU::init(), gem5::MinorCPU::init(), gem5::o3::CPU::init(), and gem5::TimingSimpleCPU::init().

◆ instCount()

◆ instRequestorId()

RequestorID gem5::BaseCPU::instRequestorId ( ) const
inline

Reads this CPU's unique instruction requestor ID.

Definition at line 195 of file base.hh.

References _instRequestorId.

Referenced by gem5::o3::Fetch::fetchCacheLine(), gem5::minor::Fetch1::fetchLine(), and gem5::BaseSimpleCPU::setupFetchRequest().

◆ mwait()

◆ mwaitAtomic()

◆ numContexts()

unsigned gem5::BaseCPU::numContexts ( )
inline

Get the number of thread contexts available.

Definition at line 292 of file base.hh.

References threadContexts.

Referenced by gem5::o3::LSQUnit::checkSnoop().

◆ numSimulatedCPUs()

static int gem5::BaseCPU::numSimulatedCPUs ( )
inlinestatic

Definition at line 607 of file base.hh.

References cpuList.

◆ numSimulatedInsts()

static Counter gem5::BaseCPU::numSimulatedInsts ( )
inlinestatic

◆ numSimulatedOps()

static Counter gem5::BaseCPU::numSimulatedOps ( )
inlinestatic

◆ PARAMS()

gem5::BaseCPU::PARAMS ( BaseCPU )

◆ pmuProbePoint()

probing::PMUUPtr gem5::BaseCPU::pmuProbePoint ( const char * name)
protected

Helper method to instantiate probe points belonging to this object.

Parameters
nameName of the probe point.
Returns
A unique_ptr to the new probe point.

Definition at line 365 of file base.cc.

References gem5::SimObject::getProbeManager(), and gem5::Named::name().

Referenced by regProbePoints().

◆ postInterrupt()

◆ probeInstCommit()

void gem5::BaseCPU::probeInstCommit ( const StaticInstPtr & inst,
Addr pc )
virtual

◆ registerThreadContexts()

◆ regProbePoints()

void gem5::BaseCPU::regProbePoints ( )
overridevirtual

Register probe points for this object.

No probe points by default, so do nothing in base.

Reimplemented from gem5::SimObject.

Reimplemented in gem5::o3::CPU.

Definition at line 374 of file base.cc.

References gem5::SimObject::getProbeManager(), pmuProbePoint(), ppActiveCycles, ppAllCycles, ppRetiredBranches, ppRetiredInsts, ppRetiredInstsPC, ppRetiredLoads, ppRetiredStores, and ppSleeping.

Referenced by gem5::AtomicSimpleCPU::regProbePoints(), and gem5::o3::CPU::regProbePoints().

◆ regStats()

void gem5::BaseCPU::regStats ( )
overridevirtual

Callback to set stat parameters.

This callback is typically used for complex stats (e.g., distributions) that need parameters in addition to a name and a description. Stat names and descriptions should typically be set from the constructor usingo from the constructor using the ADD_STAT macro.

Reimplemented from gem5::statistics::Group.

Reimplemented in gem5::MinorCPU.

Definition at line 431 of file base.cc.

References gem5::ccprintf(), globalStats, gem5::ArmISA::i, gem5::Named::name(), gem5::statistics::Group::regStats(), gem5::Root::root(), and threadContexts.

Referenced by gem5::MinorCPU::regStats().

◆ scheduleInstStop()

void gem5::BaseCPU::scheduleInstStop ( ThreadID tid,
Counter insts,
std::string cause )

Schedule an event that exits the simulation loops after a predefined number of instructions.

This method is usually called from the configuration script to get an exit event some time in the future. It is typically used when the script wants to simulate for a specific number of instructions rather than ticks.

Parameters
tidThread monitor.
instsNumber of instructions into the future.
causeCause to signal in the exit event.

Definition at line 742 of file base.cc.

References gem5::MipsISA::event, getCurrentInstCount(), and threadContexts.

Referenced by scheduleInstStopAnyThread(), and scheduleSimpointsInstStop().

◆ scheduleInstStopAnyThread()

void gem5::BaseCPU::scheduleInstStopAnyThread ( Counter max_insts)

Schedule an exit event when any threads in the core reach the max_insts instructions using the scheduleInstStop function.

This is used to raise a MAX_INSTS exit event in thegem5 standard library

Parameters
max_instsNumber of instructions into the future.

Definition at line 818 of file base.cc.

References numThreads, and scheduleInstStop().

Referenced by init().

◆ schedulePowerGatingEvent()

◆ scheduleSimpointsInstStop()

void gem5::BaseCPU::scheduleSimpointsInstStop ( std::vector< Counter > inst_starts)

Schedule simpoint events using the scheduleInstStop function.

This is used to raise a SIMPOINT_BEGIN exit event in the gem5 standard library.

Parameters
inst_startsA vector of number of instructions to start simpoints

Definition at line 809 of file base.cc.

References gem5::ArmISA::i, and scheduleInstStop().

Referenced by init().

◆ serialize()

void gem5::BaseCPU::serialize ( CheckpointOut & cp) const
overridevirtual

Serialize this object to the given output stream.

Note
CPU models should normally overload the serializeThread() method instead of the serialize() method as this provides a uniform data format for all CPU models and promotes better code reuse.
Parameters
cpThe stream to serialize to.

Implements gem5::Serializable.

Reimplemented in gem5::CheckerCPU, and gem5::MinorCPU.

Definition at line 704 of file base.cc.

References _pid, _switchedOut, gem5::csprintf(), gem5::ArmISA::i, instCnt, interrupts, numThreads, SERIALIZE_SCALAR, and serializeThread().

Referenced by gem5::MinorCPU::serialize().

◆ serializeThread()

virtual void gem5::BaseCPU::serializeThread ( CheckpointOut & cp,
ThreadID tid ) const
inlinevirtual

Serialize a single thread.

Parameters
cpThe stream to serialize to.
tidID of the current thread.

Reimplemented in gem5::BaseKvmCPU, gem5::BaseSimpleCPU, gem5::Iris::BaseCPU, gem5::MinorCPU, and gem5::o3::CPU.

Definition at line 429 of file base.hh.

Referenced by serialize().

◆ setPid()

void gem5::BaseCPU::setPid ( uint32_t pid)
inline

Definition at line 216 of file base.hh.

References _pid.

Referenced by gem5::ArmISA::DumpStats::process().

◆ setReset()

void gem5::BaseCPU::setReset ( bool state)
virtual

Set the reset of the CPU to be either asserted or deasserted.

When asserted, the CPU should be stopped and waiting. When deasserted, the CPU should start running again, unless some other condition would also prevent it. At the point the reset is deasserted, it should be reinitialized as defined by the ISA it's running and any other relevant part of its configuration (reset address, etc).

Parameters
stateThe new state of the reset signal to this CPU.

Definition at line 668 of file base.cc.

References interrupts, state, and threadContexts.

◆ socketId()

uint32_t gem5::BaseCPU::socketId ( ) const
inline

◆ startup()

void gem5::BaseCPU::startup ( )
overridevirtual

startup() is the final initialization call before simulation.

All state is initialized (including unserialized state, if any, such as the curTick() value), so this is the appropriate place to schedule initial event(s) for objects that need them.

Reimplemented from gem5::SimObject.

Reimplemented in gem5::BaseKvmCPU, gem5::MinorCPU, gem5::o3::CPU, and gem5::X86KvmCPU.

Definition at line 349 of file base.cc.

References _switchedOut, gem5::PowerState::get(), gem5::SimObject::params(), gem5::ClockedObject::powerState, and gem5::PowerState::set().

Referenced by gem5::BaseKvmCPU::startup(), gem5::MinorCPU::startup(), and gem5::o3::CPU::startup().

◆ suspendContext()

◆ switchedOut()

◆ switchOut()

void gem5::BaseCPU::switchOut ( )
virtual

Prepare for another CPU to take over execution.

When this method exits, all internal state should have been flushed. After the method returns, the simulator calls takeOverFrom() on the new CPU with this CPU as its parameter.

Reimplemented in gem5::AtomicSimpleCPU, gem5::BaseKvmCPU, gem5::Checker< class >, gem5::Checker< DynInstPtr >, gem5::Checker< gem5::RefCountingPtr >, gem5::MinorCPU, gem5::o3::CPU, and gem5::TimingSimpleCPU.

Definition at line 588 of file base.cc.

References _switchedOut, flushTLBs(), gem5::ClockedObject::powerState, and gem5::PowerState::set().

Referenced by gem5::AtomicSimpleCPU::switchOut(), gem5::BaseKvmCPU::switchOut(), gem5::MinorCPU::switchOut(), gem5::o3::CPU::switchOut(), and gem5::TimingSimpleCPU::switchOut().

◆ takeOverFrom()

void gem5::BaseCPU::takeOverFrom ( BaseCPU * cpu)
virtual

Load the state of a CPU from the previous CPU object, invoked on all new CPUs that are about to be switched in.

A CPU model implementing this method is expected to initialize its state from the old CPU and connect its memory (unless they are already connected) to the memories connected to the old CPU.

Parameters
cpuCPU to initialize read state from.

Reimplemented in gem5::AtomicSimpleCPU, gem5::BaseKvmCPU, gem5::Checker< class >, gem5::Checker< DynInstPtr >, gem5::Checker< gem5::RefCountingPtr >, gem5::MinorCPU, gem5::o3::CPU, and gem5::TimingSimpleCPU.

Definition at line 602 of file base.cc.

References _cpuId, _pid, _switchedOut, _taskId, gem5::ThreadContext::contextId(), cpuId(), gem5::PowerState::get(), gem5::ThreadContext::getCheckerCpuPtr(), getDataPort(), getInstPort(), gem5::ThreadContext::getIsaPtr(), gem5::CheckerCPU::getMMUPtr(), gem5::ThreadContext::getMMUPtr(), getPid(), gem5::ArmISA::i, interrupts, gem5::Port::isConnected(), modelResetPort, numThreads, gem5::ClockedObject::powerState, previousCycle, previousState, gem5::System::replaceThreadContext(), gem5::PowerState::set(), gem5::BaseISA::setThreadContext(), system, gem5::BaseMMU::takeOverFrom(), gem5::Port::takeOverFrom(), gem5::ThreadContext::takeOverFrom(), taskId(), threadContexts, and gem5::ThreadContext::threadId().

Referenced by gem5::AtomicSimpleCPU::takeOverFrom(), gem5::BaseKvmCPU::takeOverFrom(), gem5::MinorCPU::takeOverFrom(), gem5::o3::CPU::takeOverFrom(), and gem5::TimingSimpleCPU::takeOverFrom().

◆ taskId() [1/2]

◆ taskId() [2/2]

void gem5::BaseCPU::taskId ( uint32_t id)
inline

Set cpu task id.

Definition at line 213 of file base.hh.

References _taskId, and gem5::ArmISA::id.

◆ totalInsts()

virtual Counter gem5::BaseCPU::totalInsts ( ) const
pure virtual

◆ totalOps()

virtual Counter gem5::BaseCPU::totalOps ( ) const
pure virtual

◆ traceFunctions()

void gem5::BaseCPU::traceFunctions ( Addr pc)
inline

◆ traceFunctionsInternal()

◆ unserialize()

void gem5::BaseCPU::unserialize ( CheckpointIn & cp)
overridevirtual

Reconstruct the state of this object from a checkpoint.

Note
CPU models should normally overload the unserializeThread() method instead of the unserialize() method as this provides a uniform data format for all CPU models and promotes better code reuse.
Parameters
cpThe checkpoint use.

Implements gem5::Serializable.

Reimplemented in gem5::CheckerCPU, and gem5::MinorCPU.

Definition at line 725 of file base.cc.

References _pid, _switchedOut, gem5::csprintf(), gem5::ArmISA::i, instCnt, interrupts, numThreads, UNSERIALIZE_SCALAR, and unserializeThread().

Referenced by gem5::MinorCPU::unserialize().

◆ unserializeThread()

virtual void gem5::BaseCPU::unserializeThread ( CheckpointIn & cp,
ThreadID tid )
inlinevirtual

Unserialize one thread.

Parameters
cpThe checkpoint use.
tidID of the current thread.

Reimplemented in gem5::BaseKvmCPU, gem5::BaseSimpleCPU, gem5::MinorCPU, and gem5::o3::CPU.

Definition at line 437 of file base.hh.

Referenced by unserialize().

◆ updateCycleCounters()

◆ verifyMemoryMode()

virtual void gem5::BaseCPU::verifyMemoryMode ( ) const
inlinevirtual

Verify that the system is in a memory mode supported by the CPU.

Implementations are expected to query the system for the current memory mode and ensure that it is what the CPU model expects. If the check fails, the implementation should terminate the simulation using fatal().

Reimplemented in gem5::AtomicSimpleCPU, gem5::BaseKvmCPU, gem5::NonCachingSimpleCPU, gem5::o3::CPU, and gem5::TimingSimpleCPU.

Definition at line 384 of file base.hh.

Referenced by init().

◆ wakeup()

virtual void gem5::BaseCPU::wakeup ( ThreadID tid)
pure virtual

◆ workItemBegin()

void gem5::BaseCPU::workItemBegin ( )
inline

Definition at line 218 of file base.hh.

References baseStats, and gem5::BaseCPU::BaseCPUStats::numWorkItemsStarted.

Referenced by gem5::pseudo_inst::workbegin().

◆ workItemEnd()

void gem5::BaseCPU::workItemEnd ( )
inline

Definition at line 219 of file base.hh.

References baseStats, and gem5::BaseCPU::BaseCPUStats::numWorkItemsCompleted.

Referenced by gem5::pseudo_inst::workend().

Member Data Documentation

◆ _cacheLineSize

const Addr gem5::BaseCPU::_cacheLineSize
protected

Cache the cache line size that we get from the system.

Definition at line 146 of file base.hh.

Referenced by cacheLineSize().

◆ _cpuId

int gem5::BaseCPU::_cpuId
protected

Definition at line 116 of file base.hh.

Referenced by cpuId(), and takeOverFrom().

◆ _dataRequestorId

RequestorID gem5::BaseCPU::_dataRequestorId
protected

data side request id that must be placed in all requests

Definition at line 129 of file base.hh.

Referenced by dataRequestorId(), and gem5::o3::CPU::htmSendAbortSignal().

◆ _instRequestorId

RequestorID gem5::BaseCPU::_instRequestorId
protected

instruction side request id that must be placed in all requests

Definition at line 126 of file base.hh.

Referenced by instRequestorId().

◆ _pid

uint32_t gem5::BaseCPU::_pid
protected

The current OS process ID that is executing on this processor.

This is used to generate a taskId

Definition at line 140 of file base.hh.

Referenced by getPid(), serialize(), setPid(), takeOverFrom(), and unserialize().

◆ _socketId

const uint32_t gem5::BaseCPU::_socketId
protected

Each cpu will have a socket ID that corresponds to its physical location in the system.

This is usually used to bucket cpu cores under single DVFS domain. This information may also be required by the OS to identify the cpu core grouping (as in the case of ARM via MPIDR register)

Definition at line 123 of file base.hh.

Referenced by socketId().

◆ _switchedOut

bool gem5::BaseCPU::_switchedOut
protected

Is the CPU switched out or active?

Definition at line 143 of file base.hh.

Referenced by serialize(), startup(), switchedOut(), switchOut(), takeOverFrom(), and unserialize().

◆ _taskId

uint32_t gem5::BaseCPU::_taskId
protected

An intrenal representation of a task identifier within gem5.

This is used so the CPU can add which taskId (which is an internal representation of the OS process ID) to each request so components in the memory system can track which process IDs are ultimately interacting with them

Definition at line 136 of file base.hh.

Referenced by takeOverFrom(), taskId(), and taskId().

◆ addressMonitor

std::vector<AddressMonitor> gem5::BaseCPU::addressMonitor
private

Definition at line 649 of file base.hh.

Referenced by armMonitor(), getCpuAddrMonitor(), mwait(), and mwaitAtomic().

◆ baseStats

◆ commitStats

◆ cpuList

std::vector< BaseCPU * > gem5::BaseCPU::cpuList
staticprivate

Static global cpu list.

Definition at line 597 of file base.hh.

Referenced by numSimulatedCPUs(), numSimulatedInsts(), and numSimulatedOps().

◆ currentFunctionEnd

Addr gem5::BaseCPU::currentFunctionEnd
private

Definition at line 591 of file base.hh.

Referenced by traceFunctionsInternal().

◆ currentFunctionStart

Addr gem5::BaseCPU::currentFunctionStart
private

Definition at line 590 of file base.hh.

Referenced by traceFunctionsInternal().

◆ enterPwrGatingEvent

EventFunctionWrapper gem5::BaseCPU::enterPwrGatingEvent
protected

◆ executeStats

◆ fetchStats

◆ functionEntryTick

Tick gem5::BaseCPU::functionEntryTick
private

Definition at line 592 of file base.hh.

Referenced by traceFunctionsInternal().

◆ functionTraceStream

std::ostream* gem5::BaseCPU::functionTraceStream
private

Definition at line 589 of file base.hh.

Referenced by traceFunctionsInternal().

◆ functionTracingEnabled

bool gem5::BaseCPU::functionTracingEnabled
private

Definition at line 588 of file base.hh.

Referenced by enableFunctionTrace(), and traceFunctions().

◆ globalStats

std::unique_ptr< BaseCPU::GlobalStats > gem5::BaseCPU::globalStats
staticprotected

Pointer to the global stat structure.

This needs to be constructed from regStats since we merge it into the root group.

Definition at line 164 of file base.hh.

Referenced by regStats().

◆ instCnt

Tick gem5::BaseCPU::instCnt
protected

Instruction count used for SPARC misc register.

Todo
unify this with the counters that cpus individually keep

Definition at line 110 of file base.hh.

Referenced by gem5::TimingSimpleCPU::completeIfetch(), instCount(), serialize(), gem5::AtomicSimpleCPU::tick(), and unserialize().

◆ interrupts

◆ invldPid

const uint32_t gem5::BaseCPU::invldPid = std::numeric_limits<uint32_t>::max()
static

Invalid or unknown Pid.

Possible when operating system is not present or has not assigned a pid yet

Definition at line 269 of file base.hh.

Referenced by gem5::ArmISA::FsLinux::startup().

◆ modelResetPort

SignalSinkPort<bool> gem5::BaseCPU::modelResetPort
protected

Definition at line 166 of file base.hh.

Referenced by activateContext(), getPort(), and takeOverFrom().

◆ numThreads

ThreadID gem5::BaseCPU::numThreads

Number of threads we're actually simulating (<= SMT_MAX_THREADS).

This is a constant for the duration of the simulation.

Definition at line 390 of file base.hh.

Referenced by gem5::AtomicSimpleCPU::activateContext(), gem5::TimingSimpleCPU::activateContext(), armMonitor(), gem5::BaseSimpleCPU::BaseSimpleCPU(), gem5::minor::Execute::checkInterrupts(), gem5::o3::Commit::CommitStats::CommitStats(), gem5::minor::Execute::drain(), gem5::AtomicSimpleCPU::drainResume(), gem5::minor::Execute::drainResume(), gem5::minor::Pipeline::drainResume(), gem5::MinorCPU::drainResume(), gem5::TimingSimpleCPU::drainResume(), gem5::minor::Decode::evaluate(), gem5::minor::Execute::evaluate(), gem5::minor::Fetch1::evaluate(), gem5::minor::Fetch2::evaluate(), gem5::o3::IEW::IEWStats::ExecutedInstStats::ExecutedInstStats(), getCpuAddrMonitor(), gem5::o3::CPU::getFreeTid(), gem5::o3::IEW::IEWStats::IEWStats(), init(), gem5::BaseKvmCPU::init(), gem5::o3::CPU::init(), gem5::o3::InstructionQueue::IQStats::IQStats(), gem5::minor::Execute::isDrained(), gem5::minor::Fetch1::isDrained(), gem5::MinorCPU::MinorCPU(), mwait(), mwaitAtomic(), gem5::MinorCPU::randomPriority(), gem5::AtomicSimpleCPU::AtomicCPUDPort::recvAtomicSnoop(), gem5::TimingSimpleCPU::DcachePort::recvFunctionalSnoop(), gem5::minor::LSQ::recvTimingSnoopReq(), gem5::o3::LSQ::DcachePort::recvTimingSnoopReq(), gem5::TimingSimpleCPU::DcachePort::recvTimingSnoopReq(), registerThreadContexts(), gem5::MinorCPU::roundRobinPriority(), scheduleInstStopAnyThread(), serialize(), gem5::MinorCPU::startup(), gem5::AtomicSimpleCPU::suspendContext(), gem5::TimingSimpleCPU::suspendContext(), gem5::BaseSimpleCPU::swapActiveThread(), takeOverFrom(), gem5::AtomicSimpleCPU::threadSnoop(), gem5::minor::LSQ::threadSnoop(), gem5::TimingSimpleCPU::threadSnoop(), gem5::AtomicSimpleCPU::tick(), unserialize(), gem5::MinorCPU::wakeup(), and gem5::minor::Execute::~Execute().

◆ powerGatingOnIdle

const bool gem5::BaseCPU::powerGatingOnIdle
protected

Definition at line 684 of file base.hh.

Referenced by schedulePowerGatingEvent(), and suspendContext().

◆ ppActiveCycles

probing::PMUUPtr gem5::BaseCPU::ppActiveCycles
protected

CPU cycle counter, only counts if any thread contexts is active.

Definition at line 536 of file base.hh.

Referenced by regProbePoints(), and updateCycleCounters().

◆ ppAllCycles

probing::PMUUPtr gem5::BaseCPU::ppAllCycles
protected

CPU cycle counter even if any thread Context is suspended.

Definition at line 533 of file base.hh.

Referenced by regProbePoints(), and updateCycleCounters().

◆ ppRetiredBranches

probing::PMUUPtr gem5::BaseCPU::ppRetiredBranches
protected

Retired branches (any type)

Definition at line 530 of file base.hh.

Referenced by probeInstCommit(), and regProbePoints().

◆ ppRetiredInsts

probing::PMUUPtr gem5::BaseCPU::ppRetiredInsts
protected

Instruction commit probe point.

This probe point is triggered whenever one or more instructions are committed. It is normally triggered once for every instruction. However, CPU models committing bundles of instructions may call notify once for the entire bundle.

Definition at line 521 of file base.hh.

Referenced by probeInstCommit(), and regProbePoints().

◆ ppRetiredInstsPC

probing::PMUUPtr gem5::BaseCPU::ppRetiredInstsPC
protected

Definition at line 522 of file base.hh.

Referenced by probeInstCommit(), and regProbePoints().

◆ ppRetiredLoads

probing::PMUUPtr gem5::BaseCPU::ppRetiredLoads
protected

Retired load instructions.

Definition at line 525 of file base.hh.

Referenced by probeInstCommit(), and regProbePoints().

◆ ppRetiredStores

probing::PMUUPtr gem5::BaseCPU::ppRetiredStores
protected

Retired store instructions.

Definition at line 527 of file base.hh.

Referenced by probeInstCommit(), and regProbePoints().

◆ ppSleeping

ProbePointArg<bool>* gem5::BaseCPU::ppSleeping
protected

ProbePoint that signals transitions of threadContexts sets.

The ProbePoint reports information through it bool parameter.

  • If the parameter is true then the last enabled threadContext of the CPU object was disabled.
  • If the parameter is false then a threadContext was enabled, all the remaining threadContexts are disabled.

Definition at line 546 of file base.hh.

Referenced by regProbePoints(), and updateCycleCounters().

◆ previousCycle

Cycles gem5::BaseCPU::previousCycle
protected

Definition at line 556 of file base.hh.

Referenced by takeOverFrom(), and updateCycleCounters().

◆ previousState

CPUState gem5::BaseCPU::previousState
protected

Definition at line 557 of file base.hh.

Referenced by takeOverFrom(), and updateCycleCounters().

◆ pwrGatingLatency

const Cycles gem5::BaseCPU::pwrGatingLatency
protected

Definition at line 683 of file base.hh.

Referenced by schedulePowerGatingEvent(), and suspendContext().

◆ syscallRetryLatency

Cycles gem5::BaseCPU::syscallRetryLatency

◆ system

◆ threadContexts

◆ tracer

trace::InstTracer* gem5::BaseCPU::tracer
protected

Definition at line 262 of file base.hh.

Referenced by getTracer(), and gem5::BaseSimpleCPU::preExecute().


The documentation for this class was generated from the following files:

Generated on Tue Jun 18 2024 16:24:10 for gem5 by doxygen 1.11.0