MATLAB API for PL Kernels - 2024.1 English

Vitis Unified Software Platform Documentation: Application Acceleration Development (UG1393)

Document ID
UG1393
Release Date
2024-07-03
Version
2024.1 English

Here is the list of PL kernel specific APIs and their usage in integrating the traffic generators. With the MATLAB API you can create the traffic generator code to generate data to pass into or collect data from PL kernels. Use the following API to instantiate objects to send and receive data. You can provide any datatype vector/list to send_data or receive_data.

You need to set the MATLAB library path to use the APIs.

vivado = getenv("XILINX_VIVADO");
libPath = fullfile(vivado, "/data/emulation/matlab/xtlm_ipc");
addpath(libPath)
Instantiating Classes to Send or Receive Data
hls_input_stream(name, datatype)
hls_output_stream(name, datatype)

Parameters:

  • name: string name to match the PL kernel
  • datatype: A string value based on HLS kernel datatype. The supported values are [ "int8", "uint8","int16", "uint16","int32", "uint32","int64", "uint64","float", "bfloat16"]
Table 1. Supported PL Kernel Data Types
  PL Kernel Data Type EOU API Enum String Example
1 int8 int8 input_port = hls_input_plio('input_port_name',"int8")
2 int16 int16 input_port = hls_input_plio('input_port_name',"int16")
3 int32 int32 input_port = hls_input_plio('input_port_name',"int32")
4 int64 int64 input_port = hls_input_plio('input_port_name',"int64")
5 uint8 uint8 input_port = hls_input_plio('input_port_name',"uint8")
6 uint16 uint16 input_port = hls_input_plio('input_port_name',"uint16")
7 uint32 uint32 input_port = hls_input_plio('input_port_name',"uint32")
8 uint64 uint64 input_port = hls_input_plio('input_port_name',"uint64")
9 float float input_port = hls_input_plio('input_port_name',"float")
10 double double input_port = hls_input_plio('input_port_name',"double")
send_data()
send_data(data, tlast)
creates a non-blocking call to send data

RETURNS nothing

Parameters:

  • data: list of specified datatype for the object
  • tlast: boolean value, can be true (1) or false (0)
Note: The datatype must be specified during object instantiation
receive_data()
receive_data()
creates a blocking call to receive data

RETURNS a list of specified datatype

Note: The datatype must be specified during object instantiation
receive_data_with_size()
receive_data_with_size(data_size)
creates a blocking call to receive a specified amount of data

RETURNS a list of specified datatype

Parameters:

  • 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()
creates a blocking call returning data after receiving tlast packet

RETURNS list of specified data type

Note: The data type must be specified during object instantiation