CIRCT  20.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | 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. More...
 
 ~CosimAccelerator ()
 
void setManifestMethod (ManifestMethod method)
 
virtual std::map< std::string, ChannelPort & > requestChannelsFor (AppIDPath, const BundleType *, const ServiceTable &) override
 Request the host side channel ports for a particular instance (identified by the AppID path). More...
 
- Public Member Functions inherited from esi::AcceleratorConnection
 AcceleratorConnection (Context &ctxt)
 
virtual ~AcceleratorConnection ()
 
ContextgetCtxt () const
 
LoggergetLogger () const
 
virtual void disconnect ()
 Disconnect from the accelerator cleanly. More...
 
AcceleratorServiceThreadgetServiceThread ()
 Return a pointer to the accelerator 'service' thread (or threads). More...
 
template<typename ServiceClass >
ServiceClass * getService (AppIDPath id={}, std::string implName={}, ServiceImplDetails details={}, HWClientDetails clients={})
 Get a typed reference to a particular service type. More...
 
virtual ServicegetService (Service::Type service, AppIDPath id={}, std::string implName={}, ServiceImplDetails details={}, HWClientDetails clients={})
 Calls createService and caches the result. More...
 
AcceleratortakeOwnership (std::unique_ptr< Accelerator > accel)
 Assume ownership of an accelerator object. More...
 

Static Public Member Functions

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

Protected Member Functions

virtual ServicecreateService (Service::Type service, AppIDPath path, std::string implName, const ServiceImplDetails &details, const HWClientDetails &clients) override
 Called by getServiceImpl exclusively. More...
 

Private Attributes

StubContainerrpcClient
 
std::set< std::unique_ptr< ChannelPort > > channels
 
std::map< AppIDPath, std::map< std::string, std::string > > clientChannelAssignments
 
ManifestMethod manifestMethod = Cosim
 

Detailed Description

Connect to an ESI simulation.

Definition at line 37 of file Cosim.h.

Member Enumeration Documentation

◆ ManifestMethod

Enumerator
Cosim 
MMIO 

Definition at line 46 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 120 of file Cosim.cpp.

References rpcClient.

◆ ~CosimAccelerator()

CosimAccelerator::~CosimAccelerator ( )

Definition at line 128 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 68 of file Cosim.cpp.

References esiaccel.accelerator::ctxt, and esiaccel.accelerator::MMIO.

◆ 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 537 of file Cosim.cpp.

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

◆ requestChannelsFor()

std::map< std::string, ChannelPort & > CosimAccelerator::requestChannelsFor ( AppIDPath  idPath,
const BundleType bundleType,
const ServiceTable  
)
overridevirtual

Request the host side channel ports for a particular instance (identified by the AppID path).

For convenience, provide the bundle type and direction of the bundle port.

Implements esi::AcceleratorConnection.

Definition at line 294 of file Cosim.cpp.

References channels, clientChannelAssignments, esi::backends::cosim::CosimAccelerator::StubContainer::getChannelDesc(), esi::BundleType::getChannels(), esi::BundlePort::isWrite(), rpcClient, esi::backends::cosim::CosimAccelerator::StubContainer::stub, and esi::AppIDPath::toStr().

◆ setManifestMethod()

void CosimAccelerator::setManifestMethod ( ManifestMethod  method)

Definition at line 574 of file Cosim.cpp.

References manifestMethod.

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 requestChannelsFor(), and ~CosimAccelerator().

◆ clientChannelAssignments

std::map<AppIDPath, std::map<std::string, std::string> > esi::backends::cosim::CosimAccelerator::clientChannelAssignments
private

Definition at line 79 of file Cosim.h.

Referenced by createService(), and requestChannelsFor().

◆ manifestMethod

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

Definition at line 81 of file Cosim.h.

Referenced by createService(), and setManifestMethod().

◆ rpcClient

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

Definition at line 72 of file Cosim.h.

Referenced by CosimAccelerator(), createService(), requestChannelsFor(), and ~CosimAccelerator().


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