Create and Build HLS Component - 2024.1 English

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

Document ID
UG1393
Release Date
2024-05-30
Version
2024.1 English

The Vitis Unified IDE supports creation and building of HLS components using Python APIs. The following Python APIs can be used to create and build HLS components:

Table 1. Python APIs: HLS Component
Python API Description Python API Example
create_hls_component Create a HLS component hls_comp = client.create_hls_component(name=<hls_comp_name>,cfg_file = ["hls_config.cfg"],template = "empty_hls_component")
add_cfg_file Add configuration file to the component hls_comp_cfg=client.add_cfg_file(cfg_file=<config_file_path.cfg>)
set_value Set the value of the key (directive) in a specific section of a configuration file. Any earlier values for the key will be overwritten.

hls_comp_cfg.set_values(section='hls', key='flow_target', values='vitis')

To set value in config file:

[hls] 
flow_target=vitis
run Run a specified operation on the HLS component. hls_comp=run(operation='SYNTHESIS') Operation = SYNTHESIS

The following is the Python script to create and build a HLS component:

# Add package: Vitis Python CLI
import vitis

# Create a Vitis client object -
client = vitis.create_client()

# Set Vitis Workspace
client.set_workspace(path=<workspace_location>)

# Create HLS component
hls_comp = client.create_hls_component(name='HLS_comp',cfg_file = ["hls_config.cfg"],template = "empty_hls_component")

# Add Configuration File
hls_comp_cfg = client.add_config_file(cfg_file='/hls_config.cfg')

#Add values to the configuration file
hls_comp_cfg.set_value(key='part', value=part)
hls_comp_cfg.set_value(section='hls', key='flow_target', value='vitis')
hls_comp_cfg.set_value(section='hls', key='package.output.syn', value='1')
hls_comp_cfg.set_value(section='hls', key='package.output.format', value='xo')
......

# Build HLS component in Vitis Mode
hls_comp.run(operation="SYNTHESIS")
hls_comp.run(operation="PACKAGE")

After building the HLS component, the output files can be found at:
workspace/HLS_comp/<kernel_name>/