Data Mover

The data mover transfers data between processor system (PS) and accelerators, and among accelerators. SDSoC™ can generate various types of data movers based on the properties and size of the data being transferred.
Scalar

Scalar data is always transferred by the AXI_LITE data mover.

Array

The sds++ system compiler can generate AXI_DMA_SG,AXI_DMA_SIMPLE, AXI_FIFO, zero_copy (accelerator-mastered AXI4 bus), or AXI_LITE data movers, depending on the memory attributes and data size of the array. For example, if the array is allocated using malloc(), the memory is not physically contiguous, and SDSoC™ generates a scatter-gather DMA (AXI_DMA_SG); however, if the data size is less than 300 bytes, AXI_FIFO is generated instead because the data transfer time is less than AXI_DMA_SG, and it occupies much less PL resource.

Struct or Class
The implementation of a struct depends on how the struct is passed to the hardware —passed by value, passed by reference, or as an array of structs—and the type of data mover selected. The following table shows the various implementations.
Table 1. Struct Implementations
Struct Pass Method Default (no pragma) #pragma SDS data zero_copy (arg) #pragma SDS data zero_copy (arg[0:SIZE]) #pragma SDS data copy (arg) #pragma SDS data copy (arg[0:SIZE])
pass by value (struct RGB arg) Each field is flattened and passed individually as a scalar or an array. This is not supported and will result in an error. This is not supported and will result in an error. The struct is packed into a single wide scalar.

Each field is flattened and passed individually as a scalar or an array.

The value of SIZE is ignored.

pass by pointer (struct RGB *arg) or reference (struct RGB &arg) Each field is flattened and passed individually as a scalar or an array.

The struct is packed into a single wide scalar and transferred as a single value.

The data is transferred to the hardware accelerator via an AXI4 bus.

The struct is packed into a single wide scalar.

The number of data values transferred to the hardware accelerator via an AXI4 bus is defined by the value of SIZE.

The struct is packed into a single wide scalar.

The struct is packed into a single wide scalar.

The number of data values transferred to the hardware accelerator using an AXIDMA_SG or AXIDMA_SIMPLE is defined by the value of SIZE.

array of struct

(struct RGB arg[1024])

Each struct element of the array is packed into a single wide scalar.

Each struct element of the array is packed into a single wide scalar.

The data is transferred to the hardware accelerator using an AXI4 bus.

Each struct element of the array is packed into a single wide scalar.

The data is transferred to the hardware accelerator using an AXI4 bus.

The value of SIZE overrides the array size and determines the number of data values transferred to the accelerator.

Each struct element of the array is packed into a single wide scalar.

The data is transferred to the hardware accelerator using a data mover such as AXI_DMA_SG or AXI_DMA_SIMPLE.

Each struct element of the array is packed into a single wide scalar.

The data is transferred to the hardware accelerator using a data mover such as AXI_DMA_SG or AXI_DMA_SIMPLE.

The value of SIZE overrides the array size and determines the number of data values transferred to the accelerator.

Determining which data mover to use for transferring an array dependst on two attributes of the array: data size and physical memory contiguity. For example, if the memory size is 1 MB and not physically contiguous (allocated by malloc()), you should use AXI_DMA_SG. The following table shows the applicability of these data movers.
Table 2. Data Mover Selection
Data Mover Physical Memory Contiguity Data Size (bytes)
AXI_DMA_SG Either > 300
AXI_DMA_Simple Contiguous < 32M
AXI_FIFO Non-contiguous < 300

Normally, the SDSoC cross-compiler analyzes the array that is transferred to the hardware accelerator for these two attributes, and selects the appropriate data mover accordingly. However, there are cases where such analysis is not possible. At that time, the SDSoC cross-compiler issues a warning message that states it is unable to determine the memory attributes using SDS pragmas. An example of the message:

WARNING: [DMAnalysis 83-4492] Unable to determine the memory attributes passed to rgb_data_in of function img_process at 
C:/simple_sobel/src/main_app.c:84

The pragma to specify the memory attributes is:

#pragma SDS data mem_attribute(function_argument:contiguity)
Where contiguity can be either PHYSICAL_CONTIGUOUS or NON_PHYSICAL_CONTIGUOUS. The pragma to specify the data size is:
#pragma SDS data copy(function_argument[offset:size])

Where size can be a number or an arbitrary expression.