|
CIRCT 24.0.0git
|
A ChannelPort which sends data to the accelerator. More...
#include <Ports.h>


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. | |
| virtual void | write (std::unique_ptr< SegmentedMessageData > msg) |
| Write a multi-segment message. | |
| bool | tryWrite (const MessageData &data) |
| A basic non-blocking write API. | |
| virtual bool | tryWrite (std::unique_ptr< SegmentedMessageData > &msg) |
| Non-blocking write of a multi-segment message. | |
| 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. | |
| size_t | getFrameSizeBytes () const |
| Get the size of each frame in bytes. | |
| const Type * | getType () const |
| const WindowType * | getWindowType () const |
| If this port carries a windowed type, return the original WindowType (whose intoType is what getType() returns). | |
Protected Member Functions | |
| const MessageData & | maybePadEmptyMessage (const MessageData &data) |
| Pad an empty payload with a single zero byte if the port type has a zero-width logical width (e.g. | |
| 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. | |
| std::vector< MessageData > | getMessageFrames (const MessageData &data) |
| Break a message into its frames. | |
| 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< MessageData > | translationBuffer |
| 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 Type * | type |
| std::unique_ptr< TranslationInfo > | translationInfo |
Static Protected Attributes | |
| static const MessageData | transportPad0Bytes = MessageData({0}) |
| Backing storage for maybePadEmptyMessage return so that the returned reference outlives the call. | |
Private Attributes | |
| volatile bool | connected = false |
A ChannelPort which sends data to the accelerator.
| ChannelPort::ChannelPort | ( | const Type * | type | ) |
Definition at line 117 of file Ports.cpp.
References esi::ChannelPort::type.
|
inlineoverridevirtual |
Set up a connection to the accelerator.
Implements esi::ChannelPort.
Reimplemented in esi::UnknownWriteChannelPort.
Definition at line 312 of file Ports.h.
Referenced by bandwidthWriteTest(), dmaWriteTest(), runLoopbackI8(), streamingAddTest(), streamingAddTranslatedTest(), and sv2cCosimserverEpRegister().
|
inlineoverridevirtual |
Implements esi::ChannelPort.
Definition at line 322 of file Ports.h.
References connected.
Referenced by bandwidthWriteTest(), dmaWriteTest(), streamingAddTest(), and streamingAddTranslatedTest().
|
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 401 of file Ports.h.
References maybePadEmptyMessage(), translationBuffer, translationBufferIdx, and tryWriteImpl().
Referenced by tryWrite().
|
protected |
Break a message into its frames.
Definition at line 680 of file Ports.cpp.
References assert(), esi::ChannelPort::getFrameSizeBytes(), and esi::ChannelPort::type.
|
inlineoverridevirtual |
|
inlineprotected |
Pad an empty payload with a single zero byte if the port type has a zero-width logical width (e.g.
VoidType). Transports (DMA engines, cosim, etc.) require every message to carry at least one byte.
Definition at line 417 of file Ports.h.
References transportPad0Bytes, and esi::ChannelPort::type.
Referenced by flush(), tryWrite(), and write().
|
protected |
Translate outgoing data if the port type is a window type.
Append the new message 'chunks' to translationBuffer.
Definition at line 586 of file Ports.cpp.
References assert(), translationBuffer, and esi::ChannelPort::translationInfo.
Referenced by tryWrite(), and write().
|
inline |
A basic non-blocking write API.
Returns true if any of the data was sent; false means none of it was, and the write should be retried. 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 358 of file Ports.h.
References assert(), flush(), maybePadEmptyMessage(), translateMessages, translateOutgoing(), translationBuffer, translationBufferIdx, and tryWriteImpl().
Referenced by dmaWriteTest(), NB_MODULE(), sv2cCosimserverEpTryPut(), and tryWrite().
|
inlinevirtual |
Non-blocking write of a multi-segment message.
On success, takes ownership of msg (leaving it null) and returns true. On failure, returns false and leaves msg untouched so the caller can retry with the same message. Same completion semantics as tryWrite(const MessageData &). Default flattens and calls the regular tryWrite(). Backends override for scatter-gather / chunked-DMA support.
Definition at line 387 of file Ports.h.
References tryWrite().
|
protectedpure virtual |
Implementation for tryWrite(). Subclasses must implement this.
Implemented in esi::UnknownWriteChannelPort.
Referenced by flush(), and tryWrite().
|
inline |
A very basic blocking write API.
Will likely change for performance reasons.
Definition at line 327 of file Ports.h.
References assert(), maybePadEmptyMessage(), translateMessages, translateOutgoing(), translationBuffer, and writeImpl().
Referenced by bandwidthWriteTest(), NB_MODULE(), runLoopbackI8(), streamingAddTest(), streamingAddTranslatedTest(), and write().
|
inlinevirtual |
|
protectedpure virtual |
Implementation for write(). Subclasses must implement this.
Implemented in esi::UnknownWriteChannelPort.
Referenced by write().
|
private |
Definition at line 451 of file Ports.h.
Referenced by esiaccel.types.CallbackPort::connect(), esiaccel.types.FromHostPort::connect(), esiaccel.types.FunctionPort::connect(), esiaccel.types.MetricPort::connect(), esiaccel.types.ToHostPort::connect(), disconnect(), and isConnected().
|
protected |
Whether to translate outgoing data if the port type is a window type.
Set by the connect() method.
Definition at line 440 of file Ports.h.
Referenced by tryWrite(), and write().
|
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 443 of file Ports.h.
Referenced by flush(), translateOutgoing(), tryWrite(), and write().
|
protected |
Index of the next message to write in translationBuffer.
Definition at line 445 of file Ports.h.
Referenced by flush(), and tryWrite().
|
inlinestaticprotected |
Backing storage for maybePadEmptyMessage return so that the returned reference outlives the call.
Definition at line 425 of file Ports.h.
Referenced by maybePadEmptyMessage().