Python API for PL Kernels - 2023.2 English

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

Document ID
UG1393
Release Date
2023-12-13
Version
2023.2 English

Here is the list of PL kernel specific APIs and their usage in integrating the traffic generators. With the Python 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.

Instantiating Classes to Send or Receive Data

The APIs are found in the following library path:

${XILINX_VIVADO}/data/emulation/python/xtlm_ipc_v2/
You need to set PYTHONPATH to point to this library.
export PYTHONPATH=${XILINX_VIVADO}/data/emulation/python/xtlm_ipc_v2/
hls_input_stream(name, datatype)
hls_output_stream(name, datatype)

Parameters:

  • name: string name to match the HLS 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

Parameters:

  • data: list of specified datatype for the object
  • tlast: boolean value, can be true or false
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 must be 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.