CIRCT 22.0.0git
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
esi::WriteChannelPort Class Referenceabstract

A ChannelPort which sends data to the accelerator. More...

#include <Ports.h>

Inheritance diagram for esi::WriteChannelPort:
Inheritance graph
[legend]
Collaboration diagram for esi::WriteChannelPort:
Collaboration graph
[legend]

Public Member Functions

virtual void connect (const ConnectOptions &options={}) override
 Set up a connection to the accelerator.
 
virtual void disconnect () override
 
virtual bool isConnected () const override
 
void write (const MessageData &data)
 A very basic blocking write API.
 
bool tryWrite (const MessageData &data)
 A basic non-blocking write API.
 
bool flush ()
 Flush any buffered data.
 
 ChannelPort (const Type *type)
 
- Public Member Functions inherited from esi::ChannelPort
 ChannelPort (const Type *type)
 
virtual ~ChannelPort ()
 
bool poll ()
 Poll for incoming data.
 
const TypegetType () const
 

Protected Member Functions

virtual void writeImpl (const MessageData &)=0
 Implementation for write(). Subclasses must implement this.
 
virtual bool tryWriteImpl (const MessageData &data)=0
 Implementation for tryWrite(). Subclasses must implement this.
 
void translateOutgoing (const MessageData &data)
 Translate outgoing data if the port type is a window type.
 
- Protected Member Functions inherited from esi::ChannelPort
virtual bool pollImpl ()
 Method called by poll() to actually poll the channel if the channel is connected.
 
virtual void connectImpl (const ConnectOptions &options)
 Called by all connect methods to let backends initiate the underlying connections.
 

Protected Attributes

bool translateMessages = false
 Whether to translate outgoing data if the port type is a window type.
 
std::vector< MessageDatatranslationBuffer
 If tryWrite cannot write all the messages of a windowed type at once, it stores them here and writes them out one by one on subsequent calls.
 
size_t translationBufferIdx = 0
 Index of the next message to write in translationBuffer.
 
- Protected Attributes inherited from esi::ChannelPort
const Typetype
 
std::unique_ptr< TranslationInfotranslationInfo
 

Private Attributes

volatile bool connected = false
 

Detailed Description

A ChannelPort which sends data to the accelerator.

Definition at line 206 of file Ports.h.

Member Function Documentation

◆ ChannelPort()

ChannelPort::ChannelPort ( const Type type)

Definition at line 38 of file Ports.cpp.

◆ connect()

virtual void esi::WriteChannelPort::connect ( const ConnectOptions options = {})
inlineoverridevirtual

Set up a connection to the accelerator.

Implements esi::ChannelPort.

Reimplemented in esi::UnknownWriteChannelPort.

Definition at line 210 of file Ports.h.

Referenced by bandwidthWriteTest(), dmaWriteTest(), streamingAddTest(), streamingAddTranslatedTest(), and sv2cCosimserverEpRegister().

◆ disconnect()

virtual void esi::WriteChannelPort::disconnect ( )
inlineoverridevirtual

Implements esi::ChannelPort.

Definition at line 217 of file Ports.h.

References connected.

Referenced by streamingAddTest(), and streamingAddTranslatedTest().

◆ flush()

bool esi::WriteChannelPort::flush ( )
inline

Flush any buffered data.

Returns true if all data was flushed.

If translateMessages is false, calling flush() will immediately return true and perform no action, as there is no buffered data to flush.

Definition at line 259 of file Ports.h.

References translationBuffer, translationBufferIdx, and tryWriteImpl().

Referenced by tryWrite().

◆ isConnected()

virtual bool esi::WriteChannelPort::isConnected ( ) const
inlineoverridevirtual

Implements esi::ChannelPort.

Definition at line 218 of file Ports.h.

References connected.

◆ translateOutgoing()

void WriteChannelPort::translateOutgoing ( const MessageData data)
protected

Translate outgoing data if the port type is a window type.

Append the new message 'chunks' to translationBuffer.

Definition at line 461 of file Ports.cpp.

References assert(), and esi::ChannelPort::translationInfo.

Referenced by tryWrite(), and write().

◆ tryWrite()

bool esi::WriteChannelPort::tryWrite ( const MessageData data)
inline

A basic non-blocking write API.

Returns true if any of the data was queued and/or sent. If the data type is a window a 'true' return does not indicate that the message has been completely written. The 'flush' method can be used to check that the entire buffer has been written. It is invalid for backends to always return false (i.e. backends must eventually ensure that writes may succeed).

Definition at line 241 of file Ports.h.

References assert(), flush(), translateMessages, translateOutgoing(), translationBuffer, and tryWriteImpl().

Referenced by NB_MODULE().

◆ tryWriteImpl()

virtual bool esi::WriteChannelPort::tryWriteImpl ( const MessageData data)
protectedpure virtual

Implementation for tryWrite(). Subclasses must implement this.

Implemented in esi::UnknownWriteChannelPort.

Referenced by flush(), and tryWrite().

◆ write()

void esi::WriteChannelPort::write ( const MessageData data)
inline

A very basic blocking write API.

Will likely change for performance reasons.

Definition at line 222 of file Ports.h.

References assert(), translateMessages, translateOutgoing(), translationBuffer, and writeImpl().

Referenced by bandwidthWriteTest(), NB_MODULE(), streamingAddTest(), streamingAddTranslatedTest(), and sv2cCosimserverEpTryPut().

◆ writeImpl()

virtual void esi::WriteChannelPort::writeImpl ( const MessageData )
protectedpure virtual

Implementation for write(). Subclasses must implement this.

Implemented in esi::UnknownWriteChannelPort.

Referenced by write().

Member Data Documentation

◆ connected

volatile bool esi::WriteChannelPort::connected = false
private

◆ translateMessages

bool esi::WriteChannelPort::translateMessages = false
protected

Whether to translate outgoing data if the port type is a window type.

Set by the connect() method.

Definition at line 279 of file Ports.h.

Referenced by tryWrite(), and write().

◆ translationBuffer

std::vector<MessageData> esi::WriteChannelPort::translationBuffer
protected

If tryWrite cannot write all the messages of a windowed type at once, it stores them here and writes them out one by one on subsequent calls.

Definition at line 282 of file Ports.h.

Referenced by flush(), tryWrite(), and write().

◆ translationBufferIdx

size_t esi::WriteChannelPort::translationBufferIdx = 0
protected

Index of the next message to write in translationBuffer.

Definition at line 284 of file Ports.h.

Referenced by flush().


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