Accelerator Interface

The accelerator interface generated in SDSoC™ depends on the data type of the argument.
Scalar
For a scalar argument, the register interface is generated to pass in and/or out of the accelerator.
Arrays

The hardware interface on an accelerator for transferring an array can be either a RAM interface or a streaming interface, depending on how the accelerator accesses the data in the array.

The RAM interface allows the data to be accessed randomly within the accelerator; however, it requires the entire array to be transferred to the accelerator before any memory accesses can happen within the accelerator. Moreover, the use of this interface requires BRAM resources on the accelerator side to store the array.

The streaming interface, on the other hand, does not require memory to store the whole array, it allows the accelerator to pipeline the processing of array elements, i.e., the accelerator can start processing a new array element while the previous ones are still being processed. However, the streaming interface requires the accelerator to access the array in a strict sequential order, and the amount of data transferred must be the same as the accelerator expects.

SDSoC, by default, will generate the RAM interface for an array; however, SDSoC provides pragmas to direct it to generate the streaming interface.

struct or class

The implementation of structs depends on how the struct is passed to the hardware—passed by value, passed by reference, or as an arrays of structs—and the type of datamover selected. The Struct Implementations table inData Movershows the various implementations.

The following SDS pragma can be used to guide the interface generation for the accelerator.

#pragma SDS data access_pattern(arg:pattern)

Where "pattern" can be either "RANDOM" or "SEQUENTIAL", and "arg" can be an array argument name of the accelerator function.

If an array argument's access pattern is specified as "RANDOM", a RAM interface is generated. If it is specified as “SEQUENTIAL”, a streaming interface is generated. Several notes regarding this pragma:
  • The default access pattern for an array argument is “RANDOM”.
  • The specified access pattern must be consistent with the accelerator function's behavior. For “SEQUENTIAL” access patterns, the function must access every array element in a strict sequential order.
  • This pragma only applies to arguments without the “zero_copy” pragma. This will be detailed later.