AXI4 Target Interface

In contrast to the memory interface and AXI4 initiator interface, when the AXI4 target (or the legacy AXI4 slave below) interface is used, the "memories" for storing the data is inside the SmartHLS-generated RTL module rather than outside. The logic outside of SmartHLS module is responsible for initializing and/or retrieving the memory content before and/or after the execution of SmartHLS module. For example, when a int32_t array[128] argument is configured to use AXI4 target interface, the HLS module will include a 32-bit wide, 128-element deep on-chip buffer for the array argument. If the argument is an input to the top-level function, initialization of the on-chip buffer should be performed before the HLS module starts execution. If the argument is an output, the external logic can retrieve the output value from the on-chip buffer after HLS module's execution. An argument can be both input and output to the top-level function, in which case the data initialization and retrieval are done before and after the execution. The memory-mapped address offset and size of the on-chip buffer can be found in the 3.5.1.23.1.5 AXI4 Target Interface Address Map section of the 3.5.1.23.1 SmartHLS Report. Driver functions will be also generated to facilitate data transfer to/from the on-chip buffer from software (see 3.5.1.19.3 Pointer Argument Driver Functions)

The pragma below specifies an AXI4 target interface for a pointer argument (including array, struct, class types),

// The axi_target interface type can only be used for function arguments, not for global variables.
// Add at the beginning of the function definition
#pragma HLS interface argument(<ARGUMENT_NAME>) type(axi_target) \
                      num_elements(<NUM_ARRAY_ELEMENTS>) dma(true|false) requires_copy_in(true|false)

The num_elements option is only available for array type arguments. The array size can be specified or overridden (over the declared size in C++) by specifying the num_elements option.

The dma and requires_copy_in options are to configure the behaviour of the top-level driver function, and do not affect the HLS-generated hardware. See 3.5.1.19.5.1 Top-level Driver Options in Pointer Arguments' AXI4 Target Interface Pragma for details about how these two options affect the top-level driver functions.

When accessing the on-chip buffer via the AXI4 target interface, incremental burst transfer can be used for better transfer throughput. However, an AXI4 transaction can not cover addresses that belong to more than one on-chip buffers (i.e., access more than one arguments in one AXI4 transfer).

Note that the AXI4 target interface can not be applied to a global variable.