The Python package vitis
which
includes all Python APIs must be added in the Python script. The example below uses the
Python APIs in a Python script to manage an AI Engine 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 aie component.
aie_test_comp = client.create_aie_component(name = comp_name, platform = <absolute path of platform>, template = "empty_aie_component")
# Import source files to the component
aie_test_comp.import_files(from_loc = <absolute path of source folder>, files = ['graph.cpp', 'graph.h', 'kernels.h', 'include.h', 'classify.cc', 'hb27_2i.cc'])
# Set top file from the imported source
aie_test_comp.update_top_level_file(top_level_file = 'graph.cpp')
# Build component on target Hardware
aie_test_comp.build(target="hw")
# Print component information
aie_test_comp.report()
The following command launches the Vitis IDE, and executes the python script:
vitis -s aie_comp.py
The vitis -s
command manages the Vitis component (such as, creation,
build, editing configuration files, etc.). Following that, you can launch the Vitis IDE and display the AI Engine components in the workspace using the
vitis -w
command.
vitis -w <workspace_location>
The AI Engine
component is created, the libadf.a is generated,
and the component build is completed successfully.
To simulate and debug the AI Engine component, refer to the next section.