Hardware Function Argument Types

The SDSoC™ environment sdscc/sds++system compilers support hardware function arguments with types that resolve to a single or array of C99 basic arithmetic type (scalar), a structor classwhose members flatten to a single or array of C99 basic arithmetic type (hierarchical structs are supported), an array of structwhose members flatten to a single C99 basic arithmetic type. Scalar arguments must fit in a 1024-bit container. The SDSoC™ environment automatically infers hardware interface types for each hardware function argument based on the argument type and the following pragmas:
#pragma SDS data copy|zero_copy #pragma SDS data access_pattern

To avoid interface incompatibilities, you should only incorporate Vivado® HLS interface type directives and pragmas in your source code whensdscc/sds++fails to generate a suitable hardware interface directive.

  • Vivado® HLS provides arbitrary precision typesap_fixed,ap_int, and anhls::streamclass. In the SDSoC environment,ap_fixedtypes must be specified as having widths greater than 7 but less than 1025 (7 < width < 1025). Thehls::streamdata type is not supported as the function argument to any hardware function.
  • By default, an array argument to a hardware function is transferred by copying the data, that is, it is equivalent to using#pragma SDS data copy. As a consequence, an array argument must be either used as an input or produced as an output, but not both. For an array that is both read and written by the hardware function, you must use#pragma SDS data zero_copyto tell the compiler that the array should be kept in the shared memory and not copied.
  • To ensure alignment across the hardware/software interface, do not use hardware function arguments that are an array ofbool.

Important:Pointer arguments for a hardware function require special consideration. Hardware functions operate on physical addresses, which typically are not available to userspace programs, so pointers cannot be embedded in data structures passed to hardware functions.

Important:

By default, in the absence of any pragmas, a pointer argument is taken to be a scalar parameter, even though in C/C++ it might denote a one-dimensional array type. The following are the permitted pragmas.

  • This pragma provides pointer semantics using shared memory.
    #pragma SDS data zero_copy
  • This pragma maps the argument onto a stream, and requires that array elements are accessed in index order. The data copy pragma is only required when thesdsccsystem compiler is unable to determine the data transfer size and issues an error.
    #pragma SDS data copy(p[0:]) #pragma SDS data access_pattern(p:SEQUENTIAL)

Important:When you require non-sequential access to the array in the hardware function, you should change the pointer argument to an array with an explicit declaration of its dimensions, for example, A[1024].