CIRCT 21.0.0git
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
esi::backends::cosim::CosimAccelerator Class Reference

Connect to an ESI simulation. More...

#include <Cosim.h>

Inheritance diagram for esi::backends::cosim::CosimAccelerator:
Inheritance graph
[legend]
Collaboration diagram for esi::backends::cosim::CosimAccelerator:
Collaboration graph
[legend]

Classes

struct  StubContainer
 Hack around C++ not having a way to forward declare a nested class. More...
 

Public Types

enum  ManifestMethod { Cosim , MMIO }
 
- Public Types inherited from esi::AcceleratorConnection
using ServiceTable = std::map< std::string, services::Service * >
 
using Service = services::Service
 

Public Member Functions

 CosimAccelerator (Context &, std::string hostname, uint16_t port)
 Construct and connect to a cosim server.
 
 ~CosimAccelerator ()
 
void setManifestMethod (ManifestMethod method)
 
void createEngine (const std::string &engineTypeName, AppIDPath idPath, const ServiceImplDetails &details, const HWClientDetails &clients) override
 Create a new engine for channel communication with the accelerator.
 
- Public Member Functions inherited from esi::AcceleratorConnection
 AcceleratorConnection (Context &ctxt)
 
virtual ~AcceleratorConnection ()
 
ContextgetCtxt () const
 
LoggergetLogger () const
 
virtual void disconnect ()
 Disconnect from the accelerator cleanly.
 
AcceleratorServiceThreadgetServiceThread ()
 Return a pointer to the accelerator 'service' thread (or threads).
 
template<typename ServiceClass >
ServiceClass * getService (AppIDPath id={}, std::string implName={}, ServiceImplDetails details={}, HWClientDetails clients={})
 Get a typed reference to a particular service type.
 
virtual ServicegetService (Service::Type service, AppIDPath id={}, std::string implName={}, ServiceImplDetails details={}, HWClientDetails clients={})
 Calls createService and caches the result.
 
AcceleratortakeOwnership (std::unique_ptr< Accelerator > accel)
 Assume ownership of an accelerator object.
 
virtual const BundleEngineMapgetEngineMapFor (AppIDPath id)
 

Static Public Member Functions

static std::unique_ptr< AcceleratorConnectionconnect (Context &, std::string connectionString)
 Parse the connection std::string and instantiate the accelerator.
 

Protected Member Functions

virtual ServicecreateService (Service::Type service, AppIDPath path, std::string implName, const ServiceImplDetails &details, const HWClientDetails &clients) override
 Called by getServiceImpl exclusively.
 
- Protected Member Functions inherited from esi::AcceleratorConnection
void registerEngine (AppIDPath idPath, std::unique_ptr< Engine > engine, const HWClientDetails &clients)
 If createEngine is overridden, this method should be called to register the engine and all of the channels it services.
 

Private Attributes

StubContainerrpcClient
 
std::set< std::unique_ptr< ChannelPort > > channels
 
ManifestMethod manifestMethod = Cosim
 

Friends

class CosimEngine
 

Additional Inherited Members

- Protected Attributes inherited from esi::AcceleratorConnection
std::map< AppIDPath, std::unique_ptr< Engine > > ownedEngines
 Collection of owned engines.
 
std::map< AppIDPath, BundleEngineMapclientEngines
 Mapping of clients to their servicing engines.
 

Detailed Description

Connect to an ESI simulation.

Definition at line 38 of file Cosim.h.

Member Enumeration Documentation

◆ ManifestMethod

Enumerator
Cosim 
MMIO 

Definition at line 49 of file Cosim.h.

Constructor & Destructor Documentation

◆ CosimAccelerator()

CosimAccelerator::CosimAccelerator ( Context ctxt,
std::string  hostname,
uint16_t  port 
)

Construct and connect to a cosim server.

Definition at line 121 of file Cosim.cpp.

References rpcClient.

◆ ~CosimAccelerator()

CosimAccelerator::~CosimAccelerator ( )

Definition at line 129 of file Cosim.cpp.

References channels, esi::AcceleratorConnection::disconnect(), and rpcClient.

Member Function Documentation

◆ connect()

std::unique_ptr< AcceleratorConnection > CosimAccelerator::connect ( Context ctxt,
std::string  connectionString 
)
static

Parse the connection std::string and instantiate the accelerator.

Support the traditional 'host:port' syntax and a path to 'cosim.cfg' which is output by the cosimulation when it starts (which is useful when it chooses its own port).

Definition at line 69 of file Cosim.cpp.

References esi::AcceleratorConnection::ctxt, manifestMethod, and MMIO.

◆ createEngine()

void CosimAccelerator::createEngine ( const std::string &  engineTypeName,
AppIDPath  idPath,
const ServiceImplDetails details,
const HWClientDetails clients 
)
overridevirtual

Create a new engine for channel communication with the accelerator.

The default is to call the global createEngine to get an engine which has registered itself. Individual accelerator connection backends can override this to customize behavior.

Reimplemented from esi::AcceleratorConnection.

Definition at line 641 of file Cosim.cpp.

References esi::registry::createEngine(), and esi::AcceleratorConnection::registerEngine().

◆ createService()

Service * CosimAccelerator::createService ( Service::Type  service,
AppIDPath  idPath,
std::string  implName,
const ServiceImplDetails details,
const HWClientDetails clients 
)
overrideprotectedvirtual

Called by getServiceImpl exclusively.

It wraps the pointer returned by this in a unique_ptr and caches it. Separate this from the wrapping/caching since wrapping/caching is an implementation detail.

Implements esi::AcceleratorConnection.

Definition at line 654 of file Cosim.cpp.

References Cosim, esi::AcceleratorConnection::getCtxt(), manifestMethod, MMIO, rpcClient, and esi::backends::cosim::CosimAccelerator::StubContainer::stub.

◆ setManifestMethod()

void CosimAccelerator::setManifestMethod ( ManifestMethod  method)

Definition at line 673 of file Cosim.cpp.

References manifestMethod.

Friends And Related Symbol Documentation

◆ CosimEngine

friend class CosimEngine
friend

Definition at line 39 of file Cosim.h.

Member Data Documentation

◆ channels

std::set<std::unique_ptr<ChannelPort> > esi::backends::cosim::CosimAccelerator::channels
private

Definition at line 76 of file Cosim.h.

Referenced by ~CosimAccelerator().

◆ manifestMethod

ManifestMethod esi::backends::cosim::CosimAccelerator::manifestMethod = Cosim
private

Definition at line 78 of file Cosim.h.

Referenced by connect(), createService(), and setManifestMethod().

◆ rpcClient

StubContainer* esi::backends::cosim::CosimAccelerator::rpcClient
private

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