Here is the list of general purpose APIs that can be used with custom
user-defined datatypes. With these APIs, you can send and receive data only in the
form of byte_arrays. 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.
The conversion API is described below.
vivado = getenv("XILINX_VIVADO");
libPath = fullfile(vivado, "/data/emulation/matlab/xtlm_ipc");
addpath(libPath)
- Instantiating Classes to Send or Receive Data
-
input_port = axis_master( name) output_port = axis_slave(name)Parameters:
-
name: string matching the interface name of the block connected to the traffic generator
-
- send_data()
-
Tip: The general purpose API expects data in the form of
byte_arrayonly. To convert it from a user data type, use the conversion API such asuInt16ToByteArraydescribed below.send_data(data, tlast) creates a non-blocking call to send dataRETURNS nothing
Parameters:
-
data: list created using create_byte_array() or conversion API described below -
tlast: boolean value, can be true or false
-
- receive_data()
-
Tip: The general purpose API expects data in the form of
byte_arrayonly. To convert it into a user readable format with data types after receiving it, use the conversion API such asbyteArrayTouInt16described below.receive_data(data) creates a blocking call to receive dataRETURNS a list of data received in the form of a byte array
Parameters:
-
data: a byte array that can be converted with conversion API described below
-
- receive_data_with_size()
-
receive_data_with_size(data, data_size) creates a blocking call to receive a specified amount of dataRETURNS a list of data received in the form of a byte array
Parameters:
-
data: a byte array that can be converted with conversion API described below -
data_size: integer value indicating the amount of data in bytes to receive
-
- receive_data_on_tlast()
-
receive_data_on_tlast(data) creates a blocking call returning <data> after receiving tlast packetRETURNS a list of data received in the form of a byte array
Parameters:
-
data: a byte array that can be converted with conversion API described below
-
| 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
|