gem5 [DEVELOP-FOR-25.1]
Loading...
Searching...
No Matches
gem5::RiscvSystem Class Reference

#include <system.hh>

Inheritance diagram for gem5::RiscvSystem:
gem5::System gem5::SimObject gem5::PCEventScope gem5::EventManager gem5::Serializable gem5::Drainable gem5::statistics::Group gem5::Named

Public Member Functions

 PARAMS (RiscvSystem)
 RiscvSystem (const Params &p)
void setClint (Clint *clint)
 Sets the pointer to the CLINT.
ClintgetClint () const
 Get a pointer to the system's CLINT model.
uint64_t tryReadMtime () const
Public Member Functions inherited from gem5::System
RequestPortgetSystemPort ()
 Get a reference to the system port that can be used by non-structural simulation objects like processes or threads, or external entities like loaders and debuggers, etc, to access the memory system.
PortgetPort (const std::string &if_name, PortID idx=InvalidPortID) override
 Additional function to return the Port of a memory object.
Addr cacheLineSize () const
 Get the cache line size of the system.
bool schedule (PCEvent *event) override
bool remove (PCEvent *event) override
KvmVMgetKvmVM () const
 Get a pointer to the Kernel Virtual Machine (KVM) SimObject, if present.
void setKvmVM (KvmVM *const vm)
 Set the pointer to the Kernel Virtual Machine (KVM) SimObject.
memory::PhysicalMemorygetPhysMem ()
 Get a pointer to access the physical memory of the system.
const memory::PhysicalMemorygetPhysMem () const
Addr memSize () const
 Amount of physical memory that exists.
bool isMemAddr (Addr addr) const
 Check if a physical address is within a range of a memory that is part of the global address map.
void addDeviceMemory (RequestorID requestorId, memory::AbstractMemory *deviceMemory)
 Add a physical memory range for a device.
bool isDeviceMemAddr (const PacketPtr &pkt) const
 Similar to isMemAddr but for devices.
memory::AbstractMemorygetDeviceMemory (const PacketPtr &pkt) const
 Return a pointer to the device memory.
AddrRangeList getShadowRomRanges () const
ByteOrder getGuestByteOrder () const
 Get the guest byte order.
ThermalModelgetThermalModel () const
 The thermal model used for this system (if any).
RequestorID getRequestorId (const SimObject *requestor, std::string subrequestor={})
 Request an id used to create a request object in the system.
RequestorID getGlobalRequestorId (const std::string &requestor_name)
 Registers a GLOBAL RequestorID, which is a RequestorID not related to any particular SimObject; since no SimObject is passed, the requestor gets registered by providing the full requestor name.
std::string getRequestorName (RequestorID requestor_id)
 Get the name of an object for a given request id.
RequestorID lookupRequestorId (const SimObject *obj) const
 Looks up the RequestorID for a given SimObject returns an invalid RequestorID (invldRequestorId) if not found.
RequestorID lookupRequestorId (const std::string &name) const
 Looks up the RequestorID for a given object name string returns an invalid RequestorID (invldRequestorId) if not found.
RequestorID maxRequestors ()
 Get the number of requestors registered in the system.
void regStats () override
 Callback to set stat parameters.
uint64_t incWorkItemsBegin ()
 Called by pseudo_inst to track the number of work items started by this system.
uint64_t incWorkItemsEnd ()
 Called by pseudo_inst to track the number of work items completed by this system.
int markWorkItem (int index)
 Called by pseudo_inst to mark the cpus actively executing work items.
void workItemBegin (uint32_t tid, uint32_t workid)
void workItemEnd (uint32_t tid, uint32_t workid)
bool trapToGdb (GDBSignal signal, ContextID ctx_id) const
 PARAMS (System)
 System (const Params &p)
 ~System ()
const AddrRangem5opRange () const
 Range used by memory-mapped m5 pseudo-ops if enabled.
void registerThreadContext (ThreadContext *tc)
void replaceThreadContext (ThreadContext *tc, ContextID context_id)
void serialize (CheckpointOut &cp) const override
 Serialize an object.
void unserialize (CheckpointIn &cp) override
 Unserialize an object.
bool isAtomicMode () const
 Is the system in atomic mode?
bool isTimingMode () const
 Is the system in timing mode?
bool bypassCaches () const
 Should caches be bypassed?
enums::MemoryMode getMemoryMode () const
 Get the memory mode of the system.
void setMemoryMode (enums::MemoryMode mode)
 Change the memory mode of the system.
Public Member Functions inherited from gem5::SimObject
const Paramsparams () const
 SimObject (const Params &p)
virtual ~SimObject ()
virtual void init ()
 init() is called after all C++ SimObjects have been created and all ports are connected.
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 regProbePoints ()
 Register probe points for this object.
virtual void regProbeListeners ()
 Register probe listeners for this object.
ProbeManagergetProbeManager ()
 Get the probe manager for this object.
virtual void startup ()
 startup() is the final initialization call before simulation.
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.
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 (std::string_view name_)
virtual ~Named ()=default
virtual std::string name () const
Public Member Functions inherited from gem5::PCEventScope
virtual ~PCEventScope ()=default

Protected Attributes

Clint_clint
 Pointer to the CLINT wrapper.
Protected Attributes inherited from gem5::System
KvmVMkvmVM = nullptr
memory::PhysicalMemory physmem
AddrRangeList ShadowRomRanges
enums::MemoryMode memoryMode
const Addr _cacheLineSize
uint64_t workItemsBegin = 0
uint64_t workItemsEnd = 0
uint32_t numWorkIds
std::vector< RequestorInforequestors
 This array is a per-system list of all devices capable of issuing a memory system request and an associated string for each requestor id.
ThermalModelthermalModel
const AddrRange _m5opRange
 Range for memory-mapped m5 pseudo ops.
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.

Additional Inherited Members

Public Types inherited from gem5::SimObject
typedef SimObjectParams Params
Static Public Member Functions inherited from gem5::System
static void printSystems ()
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 inherited from gem5::System
Threads threads
const bool multiThread
uint64_t init_param
PortProxy physProxy
 Port to physical memory used for writing object files into ram at boot.
Workloadworkload = nullptr
 OS kernel.
std::map< std::pair< uint32_t, uint32_t >, TicklastWorkItemStarted
std::map< uint32_t, statistics::Histogram * > workItemStats
FutexMap futexMap
std::set< int > PIDs
 Process set to track which PIDs have already been allocated.
std::list< BasicSignalsignalList
std::vector< RedirectPath * > redirectPaths
Static Public Attributes inherited from gem5::System
static std::vector< System * > systemList
static int numSystemsRunning = 0
static const int maxPID = 32768
Protected Member Functions inherited from gem5::System
std::string stripSystemName (const std::string &requestor_name) const
 Strips off the system name from a requestor name.
RequestorID _getRequestorId (const SimObject *requestor, const std::string &requestor_name)
 helper function for getRequestorId
std::string leafRequestorName (const SimObject *requestor, const std::string &subrequestor)
 Helper function for constructing the full (sub)requestor name by providing the root requestor and the relative subrequestor name.
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.

Detailed Description

Definition at line 53 of file system.hh.

Constructor & Destructor Documentation

◆ RiscvSystem()

gem5::RiscvSystem::RiscvSystem ( const Params & p)
inline

Definition at line 64 of file system.hh.

References _clint, gem5::MipsISA::p, and gem5::System::System().

Referenced by PARAMS().

Member Function Documentation

◆ getClint()

Clint * gem5::RiscvSystem::getClint ( ) const
inline

Get a pointer to the system's CLINT model.

Definition at line 75 of file system.hh.

References _clint.

Referenced by gem5::RiscvISA::ISA::hpmCounterCheck().

◆ PARAMS()

gem5::RiscvSystem::PARAMS ( RiscvSystem )

References RiscvSystem().

◆ setClint()

void gem5::RiscvSystem::setClint ( Clint * clint)
inline

Sets the pointer to the CLINT.

Definition at line 68 of file system.hh.

References _clint.

Referenced by gem5::Clint::init().

◆ tryReadMtime()

uint64_t gem5::RiscvSystem::tryReadMtime ( ) const

Definition at line 46 of file system.cc.

References _clint, and panic_if.

Referenced by gem5::RiscvISA::ISA::readMiscReg().

Member Data Documentation

◆ _clint

Clint* gem5::RiscvSystem::_clint
protected

Pointer to the CLINT wrapper.

Definition at line 59 of file system.hh.

Referenced by getClint(), RiscvSystem(), setClint(), and tryReadMtime().


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

Generated on Mon Oct 27 2025 04:13:13 for gem5 by doxygen 1.14.0