3.5.1.21.6 Top-level Driver Functions

When all interfaces of a HLS module are either AXI4 target or AXI4 initiator, that means an attached CPU can initialize/retrieve all input/output data of the SmartHLS module and control its execution. SmartHLS will also generate the following driver functions to make it convenient for replacing the original top-level function in a software program.
Tip: In this table, the ellipsis (...) indicate the arguments originally described in the top-level function signature by the user.
Table 3-12. Top-level Driver Functions
Operating SystemFunction SignatureDescription
LinuxRETYPE <TopFunc>_hls_driver(..., uint32_t base_addr = <TopFunc>_BASE_ADDR);This function initializes all input argument data, starts the SmartHLS module, waits for its completion, and retrieves the output argument data and return value of the function. It can be used as a direct replacement to the original top-level function, and has the same arguments and return type as the top-level function.
Baremetal
Linuxvoid <TopFunc>_write_input_and_start(..., void *virt_addr);

This function initializes all input argument data and starts the SmartHLS module. It is a non-blocking call that can be used to start the SmartHLS module and continue to execute other parts of the software while the SmartHLS module is running.

The arguments of this function include the input arguments of the top-level function.

When DMA is used for Baremetal, the physical base address of the Soft-DMA core IP (DMA_ADDR_<HLS_PROJ_NAME>) is also passed as an argument.

Baremetal

Without DMA:

void <TopFunc>_write_input_and_start(..., uint32_t base_addr = <TopFunc>_BASE_ADDR);

With DMA:

void <TopFunc>_write_input_and_start(..., uint32_t base_addr = <TopFunc>_BASE_ADDR, uint32_t dma_addr = DMA_ADDR_<HLS_PROJ_NAME>);

LinuxRETYPE <TopFunc>_join_and_read_output(..., void *virt_addr);This blocking function waits for the SmartHLS module to finish the execution, and retrieves output argument data and return value (if not void). The arguments are the same arguments of the top-level function. When DMA is used for Baremetal, the physical base address of the Soft-DMA core IP (DMA_ADDR_<HLS_PROJ_NAME>) is also passed as an argument.
Baremetal

Without DMA:

RETYPE <TopFunc>_join_and_read_output(..., uint32_t base_addr = <TopFunc>_BASE_ADDR);

With DMA:

RETYPE <TopFunc>_join_and_read_output(..., uint32_t base_addr = <TopFunc>_BASE_ADDR, uint32_t dma_addr = DMA_ADDR_<HLS_PROJ_NAME>);

The above top-level driver functions use the individual argument or module control drivers (as described in above sections) under the hood.

To make all interfaces accessible by an attached processor, one can use the default interface pragma to set the default interface to AXI4 target for all arguments and module control (see Default All Interfaces to Use AXI4 Target ), and then add pragmas for axi_initiator interface or to configure non-default options.