The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::ResourceFactoryBase Class Referenceabstract

Factory which can create Resources as well as the Parameter sets that can be modified before actually instantiating the resources themselves. Packages providing resources to the simulator implement this interface. More...

#include <ResourceFactory.hpp>

Inheritance diagram for sparta::ResourceFactoryBase:

Public Member Functions

virtual ~ResourceFactoryBase ()
 Destructor.
 
virtual std::string getResourceType () const =0
 Returns the resource type-name for this resource, demangled.
 
virtual std::string getResourceTypeRaw () const =0
 Returns the resource type-name for this resource as in the typeid.
 
virtual ParameterSetcreateParameters (TreeNode *node)=0
 Creates a new set of parameters associated with the resource that can be created by this factory.
 
virtual void deleteParameters (ParameterSet *params)=0
 Deletes a ParameterSet created by the createParameters method of this ResourceFactory.
 
virtual void createSubtree (sparta::ResourceTreeNode *n)=0
 Optionally creates a subtree of TreeNodes for this TreeNode by attaching children to this node. These children may be regular TreeNode or ResourceTreeNodes.
 
virtual void deleteSubtree (sparta::ResourceTreeNode *n)=0
 Optionally deletes the TreeNodes created by createSubtee (if any).
 
virtual void onBuilding (sparta::ResourceTreeNode *n)=0
 Hook for additional building on ResourceTreeNode constructing.
 
virtual void onConfiguring (sparta::ResourceTreeNode *n)=0
 Hook for additional configuring on resource node configure.
 
virtual ResourcecreateResource (TreeNode *node, const ParameterSet *params)=0
 Instanitates a new Resource of the type described by this factory.
 
virtual void deleteResource (Resource *res)=0
 Deletes a resource created by the createResource method of this ResourceFactory.
 
virtual void bindEarly (TreeNode *node)=0
 Allows contents to be bound together if desired.
 
virtual void bindLate (TreeNode *node)=0
 Allows contents to be bound together if desired.
 

Detailed Description

Factory which can create Resources as well as the Parameter sets that can be modified before actually instantiating the resources themselves. Packages providing resources to the simulator implement this interface.

This class must be a factory for exactly 1 type of resource.

The paired create/delete methods within this class allow it to be part of a shared-library package interface. This informs the interface design by, for example, prohibiting boost and stl types.

These methods exists to ensure that if this factory were created through a shared library, then any memory it allocates will be freed by the same memory manager. This is required to ensure ABI compatibility with shared libraries.

Generally, the procedure is:

  • params = rfect->createParameters()
  • Poplate parameters \l1 Pick a clock for the node
  • resource = rfact->createResource(params)

Definition at line 47 of file ResourceFactory.hpp.

Constructor & Destructor Documentation

◆ ~ResourceFactoryBase()

virtual sparta::ResourceFactoryBase::~ResourceFactoryBase ( )
inlinevirtual

Destructor.

Definition at line 54 of file ResourceFactory.hpp.

Member Function Documentation

◆ bindEarly()

virtual void sparta::ResourceFactoryBase::bindEarly ( TreeNode node)
pure virtual

Allows contents to be bound together if desired.

Precondition
Tree will be finalized

Subclasses can use this to bind ports together if needed, which can also be done in Resource::bind* methods or at the Simulation level

This happens before the top-level simulator class has a chance to bind anything

Implemented in sparta::ResourceFactory< ResourceT, ParamsT >, sparta::ResourceFactory< core_example::BIU, core_example::BIU::BIUParameterSet >, sparta::ResourceFactory< core_example::Core, core_example::Core::CoreParameterSet >, sparta::ResourceFactory< core_example::Decode, core_example::Decode::DecodeParameterSet >, sparta::ResourceFactory< core_example::Dispatch, core_example::Dispatch::DispatchParameterSet >, sparta::ResourceFactory< core_example::Execute, core_example::Execute::ExecuteParameterSet >, sparta::ResourceFactory< core_example::Fetch, core_example::Fetch::FetchParameterSet >, sparta::ResourceFactory< core_example::FlushManager, core_example::FlushManager::FlushManagerParameters >, sparta::ResourceFactory< core_example::LSU, core_example::LSU::LSUParameterSet >, sparta::ResourceFactory< core_example::MSS, core_example::MSS::MSSParameterSet >, sparta::ResourceFactory< core_example::Preloader, core_example::Preloader::PreloaderParameterSet >, sparta::ResourceFactory< core_example::Rename, core_example::Rename::RenameParameterSet >, sparta::ResourceFactory< core_example::ROB, core_example::ROB::ROBParameterSet >, sparta::ResourceFactory< core_example::SimpleTLB, core_example::SimpleTLB::TLBParameterSet >, and sparta::ResourceFactory< CPU, CPU::CPUParameterSet >.

◆ bindLate()

virtual void sparta::ResourceFactoryBase::bindLate ( TreeNode node)
pure virtual

Allows contents to be bound together if desired.

Precondition
Tree will be finalized
Top-level simulator class will have had a chance to bind

Subclasses can use this to bind ports together if needed, which can also be done in Resource::bind* methods or at the Simulation level

Implemented in sparta::ResourceFactory< ResourceT, ParamsT >, sparta::ResourceFactory< core_example::BIU, core_example::BIU::BIUParameterSet >, sparta::ResourceFactory< core_example::Core, core_example::Core::CoreParameterSet >, sparta::ResourceFactory< core_example::Decode, core_example::Decode::DecodeParameterSet >, sparta::ResourceFactory< core_example::Dispatch, core_example::Dispatch::DispatchParameterSet >, sparta::ResourceFactory< core_example::Execute, core_example::Execute::ExecuteParameterSet >, sparta::ResourceFactory< core_example::Fetch, core_example::Fetch::FetchParameterSet >, sparta::ResourceFactory< core_example::FlushManager, core_example::FlushManager::FlushManagerParameters >, sparta::ResourceFactory< core_example::LSU, core_example::LSU::LSUParameterSet >, sparta::ResourceFactory< core_example::MSS, core_example::MSS::MSSParameterSet >, sparta::ResourceFactory< core_example::Preloader, core_example::Preloader::PreloaderParameterSet >, sparta::ResourceFactory< core_example::Rename, core_example::Rename::RenameParameterSet >, sparta::ResourceFactory< core_example::ROB, core_example::ROB::ROBParameterSet >, sparta::ResourceFactory< core_example::SimpleTLB, core_example::SimpleTLB::TLBParameterSet >, and sparta::ResourceFactory< CPU, CPU::CPUParameterSet >.

◆ createParameters()

virtual ParameterSet * sparta::ResourceFactoryBase::createParameters ( TreeNode node)
pure virtual

Creates a new set of parameters associated with the resource that can be created by this factory.

Parameters
nodeTreeNode which which the newly-created parameters will be permanently associated.
Returns
new ParameterSet that must be deallocated by caller via deleteParameters.

Each ParameterSet created by this parameter set must contain identical parameters down to types and default values.

Implemented in sparta::ResourceFactory< ResourceT, ParamsT >, sparta::ResourceFactory< core_example::BIU, core_example::BIU::BIUParameterSet >, sparta::ResourceFactory< core_example::Core, core_example::Core::CoreParameterSet >, sparta::ResourceFactory< core_example::Decode, core_example::Decode::DecodeParameterSet >, sparta::ResourceFactory< core_example::Dispatch, core_example::Dispatch::DispatchParameterSet >, sparta::ResourceFactory< core_example::Execute, core_example::Execute::ExecuteParameterSet >, sparta::ResourceFactory< core_example::Fetch, core_example::Fetch::FetchParameterSet >, sparta::ResourceFactory< core_example::FlushManager, core_example::FlushManager::FlushManagerParameters >, sparta::ResourceFactory< core_example::LSU, core_example::LSU::LSUParameterSet >, sparta::ResourceFactory< core_example::MSS, core_example::MSS::MSSParameterSet >, sparta::ResourceFactory< core_example::Preloader, core_example::Preloader::PreloaderParameterSet >, sparta::ResourceFactory< core_example::Rename, core_example::Rename::RenameParameterSet >, sparta::ResourceFactory< core_example::ROB, core_example::ROB::ROBParameterSet >, sparta::ResourceFactory< core_example::SimpleTLB, core_example::SimpleTLB::TLBParameterSet >, and sparta::ResourceFactory< CPU, CPU::CPUParameterSet >.

◆ createResource()

virtual Resource * sparta::ResourceFactoryBase::createResource ( TreeNode node,
const ParameterSet params 
)
pure virtual

Instanitates a new Resource of the type described by this factory.

Parameters
nodeTreeNode with which this resource will be associated. At this point the tree will be finalizing. No new children can be attached to this node at this time.
paramsParameterSet created by createParameters
Returns
Newly created resource that must be deallocated by caller via deleteResource.

Implemented in sparta::ResourceFactory< ResourceT, ParamsT >, sparta::ResourceFactory< core_example::BIU, core_example::BIU::BIUParameterSet >, sparta::ResourceFactory< core_example::Core, core_example::Core::CoreParameterSet >, sparta::ResourceFactory< core_example::Decode, core_example::Decode::DecodeParameterSet >, sparta::ResourceFactory< core_example::Dispatch, core_example::Dispatch::DispatchParameterSet >, sparta::ResourceFactory< core_example::Execute, core_example::Execute::ExecuteParameterSet >, sparta::ResourceFactory< core_example::Fetch, core_example::Fetch::FetchParameterSet >, sparta::ResourceFactory< core_example::FlushManager, core_example::FlushManager::FlushManagerParameters >, sparta::ResourceFactory< core_example::LSU, core_example::LSU::LSUParameterSet >, sparta::ResourceFactory< core_example::MSS, core_example::MSS::MSSParameterSet >, sparta::ResourceFactory< core_example::Preloader, core_example::Preloader::PreloaderParameterSet >, sparta::ResourceFactory< core_example::Rename, core_example::Rename::RenameParameterSet >, sparta::ResourceFactory< core_example::ROB, core_example::ROB::ROBParameterSet >, sparta::ResourceFactory< core_example::SimpleTLB, core_example::SimpleTLB::TLBParameterSet >, and sparta::ResourceFactory< CPU, CPU::CPUParameterSet >.

◆ createSubtree()

virtual void sparta::ResourceFactoryBase::createSubtree ( sparta::ResourceTreeNode n)
pure virtual

Optionally creates a subtree of TreeNodes for this TreeNode by attaching children to this node. These children may be regular TreeNode or ResourceTreeNodes.

Because this occurs during the tree construction phase, adding child ResourceTreeNodes is valid

Implemented in sparta::ResourceFactory< ResourceT, ParamsT >, sparta::ResourceFactory< core_example::BIU, core_example::BIU::BIUParameterSet >, sparta::ResourceFactory< core_example::Core, core_example::Core::CoreParameterSet >, sparta::ResourceFactory< core_example::Decode, core_example::Decode::DecodeParameterSet >, sparta::ResourceFactory< core_example::Dispatch, core_example::Dispatch::DispatchParameterSet >, sparta::ResourceFactory< core_example::Execute, core_example::Execute::ExecuteParameterSet >, sparta::ResourceFactory< core_example::Fetch, core_example::Fetch::FetchParameterSet >, sparta::ResourceFactory< core_example::FlushManager, core_example::FlushManager::FlushManagerParameters >, sparta::ResourceFactory< core_example::LSU, core_example::LSU::LSUParameterSet >, sparta::ResourceFactory< core_example::MSS, core_example::MSS::MSSParameterSet >, sparta::ResourceFactory< core_example::Preloader, core_example::Preloader::PreloaderParameterSet >, sparta::ResourceFactory< core_example::Rename, core_example::Rename::RenameParameterSet >, sparta::ResourceFactory< core_example::ROB, core_example::ROB::ROBParameterSet >, sparta::ResourceFactory< core_example::SimpleTLB, core_example::SimpleTLB::TLBParameterSet >, and sparta::ResourceFactory< CPU, CPU::CPUParameterSet >.

◆ deleteParameters()

virtual void sparta::ResourceFactoryBase::deleteParameters ( ParameterSet params)
pure virtual

◆ deleteResource()

virtual void sparta::ResourceFactoryBase::deleteResource ( Resource res)
pure virtual

◆ deleteSubtree()

virtual void sparta::ResourceFactoryBase::deleteSubtree ( sparta::ResourceTreeNode n)
pure virtual

Optionally deletes the TreeNodes created by createSubtee (if any).

An implementation of ResourceFactoryBase should generally keep a vector of nodes that it allocated and delete them when this method is invoked.

Implemented in sparta::ResourceFactory< ResourceT, ParamsT >, sparta::ResourceFactory< core_example::BIU, core_example::BIU::BIUParameterSet >, sparta::ResourceFactory< core_example::Core, core_example::Core::CoreParameterSet >, sparta::ResourceFactory< core_example::Decode, core_example::Decode::DecodeParameterSet >, sparta::ResourceFactory< core_example::Dispatch, core_example::Dispatch::DispatchParameterSet >, sparta::ResourceFactory< core_example::Execute, core_example::Execute::ExecuteParameterSet >, sparta::ResourceFactory< core_example::Fetch, core_example::Fetch::FetchParameterSet >, sparta::ResourceFactory< core_example::FlushManager, core_example::FlushManager::FlushManagerParameters >, sparta::ResourceFactory< core_example::LSU, core_example::LSU::LSUParameterSet >, sparta::ResourceFactory< core_example::MSS, core_example::MSS::MSSParameterSet >, sparta::ResourceFactory< core_example::Preloader, core_example::Preloader::PreloaderParameterSet >, sparta::ResourceFactory< core_example::Rename, core_example::Rename::RenameParameterSet >, sparta::ResourceFactory< core_example::ROB, core_example::ROB::ROBParameterSet >, sparta::ResourceFactory< core_example::SimpleTLB, core_example::SimpleTLB::TLBParameterSet >, and sparta::ResourceFactory< CPU, CPU::CPUParameterSet >.

◆ getResourceType()

virtual std::string sparta::ResourceFactoryBase::getResourceType ( ) const
pure virtual

◆ getResourceTypeRaw()

virtual std::string sparta::ResourceFactoryBase::getResourceTypeRaw ( ) const
pure virtual

◆ onBuilding()

virtual void sparta::ResourceFactoryBase::onBuilding ( sparta::ResourceTreeNode n)
pure virtual

◆ onConfiguring()

virtual void sparta::ResourceFactoryBase::onConfiguring ( sparta::ResourceTreeNode n)
pure virtual

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