Build-system support for HLS kernel compilation, FPGA vbin linking, and AMD tool discovery.
| Module | Purpose |
|---|---|
SlashTools.cmake |
SLASH linker integration (add_vbin) |
BuildHLS.cmake |
HLS kernel compilation (build_hls, build_hls_dir, build_hls_clean) |
FindVivado.cmake |
Locate AMD Vivado installation |
FindVitis.cmake |
Locate AMD Vitis HLS installation |
CheckSlashInstall.cmake |
Validate SLASH hardware files are installed |
Installed mode (after cmake --install):
find_package(SlashTools REQUIRED)Modules are installed to <prefix>/lib/cmake/SlashTools/.
find_package(SlashTools) automatically brings in BuildHLS,
FindVivado, and FindVitis.
Source-tree mode (development against local repo):
list(APPEND CMAKE_MODULE_PATH "${SLASH_REPO_ROOT}/cmake")
include(SlashTools)Links HLS kernel IP into a vbin file using the SLASH linker.
add_vbin(
TARGET <target-name>
PLATFORM <hw|sim|emu>
CFG <path/to/config.cfg>
KERNELS <kernel1.xml> [kernel2.xml ...]
)| Parameter | Required | Description |
|---|---|---|
TARGET |
yes | Name of the CMake target to create |
PLATFORM |
yes | Target platform: hw, sim, or emu |
CFG |
yes | Path to the linker configuration file |
KERNELS |
yes | List of kernel component.xml files to link |
Output: ${CMAKE_CURRENT_BINARY_DIR}/<TARGET>.vbin
Linker detection (two modes, tried in order):
- Installed — finds
slashkiton PATH - Source tree — uses
SLASH_REPO_ROOT(or auto-detects from../linker/src/main.pyrelative to this directory). Requires Python 3.
Variables set after loading:
| Variable | Description |
|---|---|
SLASH_FOUND |
TRUE when SlashTools is ready |
SLASHKIT_EXECUTABLE |
Path to slashkit (installed mode) |
SLASH_REPO_ROOT |
Path to SLASH repo root (source mode) |
VIVADO_BINARY |
Path to vivado (from FindVivado) |
VITIS_ROOT_DIR |
Path to Vitis root (from FindVitis) |
Compiles HLS kernels using v++ and vitis-run. Both executables
must be on PATH.
build_hls(
TARGET <target-name>
CPP <source.cpp>
CFG <config.cfg>
DEVICE <part-name>
[OUT_DIR <output-directory>]
)| Parameter | Required | Description |
|---|---|---|
TARGET |
yes | CMake target name |
CPP |
yes | HLS C++ source file |
CFG |
yes | Vitis HLS configuration file |
DEVICE |
yes | FPGA part (e.g. xcv80-lsva4737-2MHP-e-S) |
OUT_DIR |
no | Output directory (default: CMAKE_CURRENT_BINARY_DIR) |
Sets target properties HLS_BUILD_DIR and HLS_COMPONENT_XML, and
parent-scope variables ${TARGET}_BUILD_DIR and
${TARGET}_COMPONENT_XML.
build_hls_dir(
TARGET <target-name>
ROOT <source-directory>
DEVICE <part-name>
KERNELS <kernel1> [kernel2 ...]
[OUT_DIR <output-directory>]
[OUT_IP_REPO <variable>]
[OUT_KERNELS <variable>]
)For each kernel name K, expects ROOT/K.cpp and ROOT/K.cfg.
Creates individual build targets and a parent target that depends on
all of them.
| Parameter | Required | Description |
|---|---|---|
TARGET |
yes | Parent CMake target name |
ROOT |
yes | Directory containing <kernel>.cpp and .cfg |
DEVICE |
yes | FPGA part name |
KERNELS |
yes | List of kernel names |
OUT_DIR |
no | Output directory |
OUT_IP_REPO |
no | Variable to receive the IP repository path |
OUT_KERNELS |
no | Variable to receive the list of component.xml files |
build_hls_clean(
TARGET <target-name>
DEVICE <part-name>
[ROOT <directory>]
[EXTRA_GLOBS <pattern> ...]
)Creates a target that removes build_*.DEVICE directories, log files,
.Xil, and CMake cache artifacts.
Locates the AMD Vivado installation.
find_package(Vivado REQUIRED)Search order:
VIVADO_ROOT_DIRCMake variableXILINX_VIVADOenvironment variable- System
PATH
| Variable | Description |
|---|---|
VIVADO_FOUND |
TRUE if Vivado was found |
VIVADO_PATH |
Directory containing vivado |
VIVADO_ROOT_DIR |
Vivado installation root |
VIVADO_BINARY |
Full path to vivado executable |
Locates the AMD Vitis HLS installation.
find_package(Vitis REQUIRED)Search order:
VITIS_ROOT_DIRCMake variableXILINX_VITISenvironment variableVITIS_HOMEenvironment variableVITISenvironment variable- System
PATH
| Variable | Description |
|---|---|
VITIS_FOUND |
TRUE if Vitis was found |
VITIS_BINARY |
Full path to vitis executable |
VITIS_ROOT_DIR |
Vitis installation root |
VITIS_INCLUDE_DIR |
${VITIS_ROOT_DIR}/include (validated) |
Validates that SLASH hardware files are installed.
include(CheckSlashInstall)Checks for four required files in INSTALL_DIR (default
/opt/amd/slash):
static_shell_service_layer.dcpstatic_shell_slash.dcpamd_v80_gen5x8_25.1.pditop_wrapper_routed_bb.dcp
Override the install path:
set(INSTALL_DIR "/custom/path")
include(CheckSlashInstall)cmake_minimum_required(VERSION 3.20)
project(my_v80_project)
option(SLASH_USE_REPO "Build against local SLASH repo" OFF)
if(SLASH_USE_REPO)
set(SLASH_REPO_ROOT "/path/to/SLASH")
list(APPEND CMAKE_MODULE_PATH "${SLASH_REPO_ROOT}/cmake")
include(SlashTools)
else()
find_package(vrt REQUIRED CONFIG)
find_package(SlashTools REQUIRED)
endif()
set(DEVICE "xcv80-lsva4737-2MHP-e-S")
# Build HLS kernels
build_hls_dir(
TARGET hls
ROOT "${CMAKE_CURRENT_SOURCE_DIR}/hls"
DEVICE "${DEVICE}"
KERNELS increment accumulate
OUT_KERNELS _KERNEL_XMLS
)
# Link into a vbin
add_vbin(
TARGET my_design_hw
PLATFORM hw
CFG "${CMAKE_CURRENT_SOURCE_DIR}/config.cfg"
KERNELS ${_KERNEL_XMLS}
)cmake/
SlashTools.cmake Linker integration (add_vbin)
BuildHLS.cmake HLS kernel build functions
FindVivado.cmake Vivado tool finder
FindVitis.cmake Vitis HLS tool finder
CheckSlashInstall.cmake Installation validator
SlashToolsConfig.cmake.in Package config template
CMakeLists.txt Module installation
MIT. See the license header in each .cmake file for the full text.