Here is the list of general purpose APIs that can be used with
custom user-defined datatypes. With these API you can send and receive data in the
form of byte_arrays
only. You must convert your
custom datatype to byte_arrays
prior to transport,
and convert the received value back to your custom datatype for use by your
application. Conversion API are provided as described below.
- Instantiating Classes to Send or Receive Data
-
xtlm_ipc::axis_master input_port(std::string name) xtlm_ipc::axis_slave output_port(std::string name) Parameters: name → string matching the AXI4-Stream interface
- send_data()
-
Tip: The general purpose API expects data in the form of
byte_array
only. To convert it from a user data type, use the conversion API such asuInt16ToByteArray
described below.send_data(data, tlast) creates a non-blocking call to send data Parameters: RETURNS nothing data → std::vector<char> tlast → boolean value, can be true or false
- receive_data()
-
Tip: The general purpose API expects data in the form of
byte_array
only. To convert it into a user readable format with data types after receiving it, use the conversion API such asbyteArrayTouInt16
described below.receive_data(data) creates a blocking call to receive data Parameters: RETURNS the received data as a byte_array data → std::vector<char>
- receive_data_with_size()
-
receive_data_with_size(data, data_size) creates a blocking call to receive a specified amount of data Parameters: RETURNS the received data as a byte_array data → std::vector<char> data_size -> integer value indicating the amount of data in bytes to receive Note: data_size is specified in bytes
- receive_data_on_tlast()
-
receive_data_on_tlast(data) creates a blocking call returning data after receiving tlast packet Parameters: RETURNS the received data as a byte_array data → std::vector<char> Note: The datatype must be specified during object instantiation
API | Description |
---|---|
byte_array = input_port.uInt8ToByteArray(user_list) byte_array = input_port.uInt16ToByteArray(user_list) byte_array = input_port.uInt32ToByteArray(user_list) byte_array = input_port.uInt64ToByteArray(user_list) byte_array = input_port.int8ToByteArray(user_list) byte_array = input_port.int16ToByteArray(user_list) byte_array = input_port.int32ToByteArray(user_list) byte_array = input_port.int64ToByteArray(user_list) byte_array = input_port.floatToByteArray(user_list) byte_array = input_port.doubleToByteArray(user_list) byte_array = input_port.bfloat16ToByteArray(user_list) |
Convert the specified data type to byte_array
value to send the
data
|
user_list = output_port.byteArrayTouInt8(byte_array) user_list = output_port.byteArrayTouInt16(byte_array) user_list = output_port.byteArrayTouInt32(byte_array) user_list = output_port.byteArrayTouInt64(byte_array) user_list = output_port.byteArrayToInt8(byte_array) user_list = output_port.byteArrayToInt16(byte_array) user_list = output_port.byteArrayToInt32(byte_array) user_list = output_port.byteArrayToInt64(byte_array) user_list = output_port.byteArrayToFloat(byte_array) user_list = output_port.byteArrayToDouble(byte_array) user_list = output_port.byteArrayToBfloat16(byte_array) |
Convert the byte_array value to the specified data type after
receiving
|