46#ifndef __SIM_OBJECT_HH__
47#define __SIM_OBJECT_HH__
54#include "params/SimObject.hh"
65class SimObjectResolver;
365#define PARAMS(type) \
366 using Params = type ## Params; \
370 return reinterpret_cast<const Params&>(_params); \
Interface for objects that might require draining before checkpointing.
Interface for things with names.
virtual std::string name() const
Ports are used to interface objects to each other.
ProbeManager is a conduit class that lives on each SimObject, and is used to match up probe listeners...
Basic support for object serialization.
Base class to wrap object resolving functionality.
virtual ~SimObjectResolver()
Abstract superclass for simulation objects.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
static SimObjectResolver * _objNameResolver
Helper to resolve an object given its name.
void serialize(CheckpointOut &cp) const override
Serialize an object.
static void serializeAll(const std::string &cpt_dir)
Create a checkpoint by serializing all SimObjects in the system.
std::vector< SimObject * > SimObjectList
static void setSimObjectResolver(SimObjectResolver *resolver)
There is a single object name resolver, and it is only set when simulation is restoring from checkpoi...
ProbeManager * probeManager
Manager coordinates hooking up probe points with listeners.
static SimObjectResolver * getSimObjectResolver()
There is a single object name resolver, and it is only set when simulation is restoring from checkpoi...
static SimObjectList simObjectList
List of all instantiated simulation objects.
DrainState drain() override
Provide a default implementation of the drain interface for objects that don't need draining.
DrainState
Object drain/handover states.
@ Drained
Buffers drained, ready for serialization/handover.
void objParamIn(CheckpointIn &cp, const std::string &name, SimObject *¶m)
To avoid circular dependencies the unserialization of SimObjects must be implemented here.
virtual void loadState(CheckpointIn &cp)
loadState() is called on each SimObject when restoring from a checkpoint.
virtual SimObject * resolveSimObject(const std::string &name)=0
Find a SimObject given a full path name.
virtual void initState()
initState() is called on each SimObject when not restoring from a checkpoint.
virtual void regProbeListeners()
Register probe listeners for this object.
const Params & params() const
virtual void memWriteback()
Write back dirty buffers to memory using functional writes.
SimObject(const Params &p)
virtual void startup()
startup() is the final initialization call before simulation.
ProbeManager * getProbeManager()
Get the probe manager for this object.
const SimObjectParams & _params
Cached copy of the object parameters.
virtual void regProbePoints()
Register probe points for this object.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
virtual void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
static SimObject * find(const char *name)
Find the SimObject with the given name and return a pointer to it.
virtual void memInvalidate()
Invalidate the contents of memory buffers.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
const PortID InvalidPortID
std::ostream CheckpointOut
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
void debug_serialize(const std::string &cpt_dir)
const std::string & name()