52 #ifndef __SIM_CXX_MANAGER_HH__
53 #define __SIM_CXX_MANAGER_HH__
86 Exception(
const std::string &name_,
const std::string &message_) :
106 const std::string &to_prefix) :
133 const std::string &slavePort,
PortID slavePortIndex);
143 std::string
rename(
const std::string &from_name);
147 std::string
unRename(
const std::string &to_name);
180 const std::string &object_name, std::string &object_type);
210 bool visit_children =
false);
237 template<
typename SimObjectType>
246 SimObjectType *
object =
dynamic_cast<SimObjectType *
>(
251 " type", object_name));
266 static void parsePort(
const std::string &inp,
267 std::string &path, std::string &port,
unsigned int &
index);
286 unsigned int drain();
307 void setParam(
const std::string &object_name,
308 const std::string ¶m_name,
const std::string ¶m_value);
310 const std::string ¶m_name,
314 #endif // __SIM_CXX_MANAGER_HH__
void setParamVector(const std::string &object_name, const std::string ¶m_name, const std::vector< std::string > ¶m_values)
void startup()
Call startup on all objects.
void initState()
Call initState on all objects.
const std::string & name()
static void parsePort(const std::string &inp, std::string &path, std::string &port, unsigned int &index)
Parse a port string of the form 'path(.path)*.port[index]' into path, port and index.
void loadState(CheckpointIn &checkpoint)
Load all objects' state from the given Checkpoint.
SimObject * findObject(const std::string &object_name, bool visit_children=false)
Walk the configuration starting with object object_name and fill in all the elements of this object o...
std::list< Renaming > renamings
All the renamings applicable when instantiating objects.
std::map< std::string, SimObject * > objectsByName
SimObject indexed by name.
void setParam(const std::string &object_name, const std::string ¶m_name, const std::string ¶m_value)
Convenience functions for calling set...
void bindAllPorts()
Bind the ports of all the objects in objectInOrder order.
std::string rename(const std::string &from_name)
Apply the first matching renaming in renamings to the given name.
const CxxConfigDirectoryEntry & findObjectType(const std::string &object_name, std::string &object_type)
Find the type field for a named object and return both the name of the type to object_type and the ob...
SimObject * resolveSimObject(const std::string &name)
Base for peer classes of SimObjectParams derived classes with parameter modifying member functions...
const char * what() const
CxxConfigParams * findObjectParams(const std::string &object_name)
Find the parameters for the named object.
void forEachObject(void(SimObject::*mem_func)())
Perform mem_func on each SimObject.
Similar to ParamDesc to describe ports.
std::set< std::string > inVisit
While configuring, inVisit contains names of SimObjects visited in this recursive configuration walk...
void addRenaming(const Renaming &renaming)
Add a name prefix renaming to those currently applied.
SimObjectResolver simObjectResolver
Singleton instance of SimObjectResolver.
CxxConfigParams::Flags flags
Flags to pass to affect param setting.
std::string csprintf(const char *format, const Args &...args)
Exception for instantiate/post-instantiate errors.
std::map< std::string, CxxConfigParams * > objectParamsByName
...Params objects created by this manager
C++-only configuration and instantiation support.
std::list< SimObject * > objectsInOrder
SimObjects in order.
SimObjectResolver & getSimObjectResolver()
Get the resolver used to map SimObject names to SimObjects for checkpoint restore.
Config file wrapper providing a common interface to CxxConfigManager.
CxxConfigManager & configManager
CxxConfigManager(CxxConfigFileBase &configFile_)
void drainResume()
Resume from drain.
unsigned int drain()
Drain all objects.
void deleteObjects()
Delete all objects and clear objectsByName and objectsByOrder.
This class allows a config file to be read into gem5 (generating the appropriate SimObjects) from C++...
SimObjectResolver(CxxConfigManager &configManager_)
Class for resolving SimObject names to SimObjects usable by the checkpoint restore mechanism...
Renaming(const std::string &from_prefix, const std::string &to_prefix)
Exception(const std::string &name_, const std::string &message_)
CxxConfigFileBase & configFile
Configuration file being read.
SimObjectType & getObject(const std::string &object_name)
Find an object from objectsByName with a type-checking cast.
std::string unRename(const std::string &to_name)
Apply the first matching renaming in reverse (toPrefix -> fromPrefix for the given name...
void bindMasterPort(SimObject *object, const CxxConfigDirectoryEntry::PortDesc &port, const std::vector< std::string > &peers)
Bind a single (possibly vectored) master port to peers from the unparsed list peers with elements in ...
void findTraversalOrder(const std::string &object_name)
Populate objectsInOrder with a preorder, depth first traversal from the given object name down throug...
Config details entry for a SimObject.
void serialize(std::ostream &os)
Serialize (checkpoint) all objects to the given stream.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
void findAllObjects()
Find all objects by iterating over the object names in the config file with findObject.
void instantiate(bool build_all=true)
Build all objects (if build_all is true, otherwise objects must have been individually findObject-ed ...
void bindPort(SimObject *masterObject, const std::string &masterPort, PortID masterPortIndex, SimObject *slaveObject, const std::string &slavePort, PortID slavePortIndex)
Bind a single connection between two objects' ports.
Abstract superclass for simulation objects.
void bindObjectPorts(SimObject *object)
Bind the ports of a single SimObject.
Name substitution when instantiating any object whose name starts with fromPrefix.