XCORE SDK
XCORE Software Development Kit
|
This library utilizes the XMOS XS3 architecture's vector processing unit (VPU). All loads and stores to and from the XS3 VPU have the requirement that the loaded/stored addresses must be aligned to a 4-byte boundary (word-aligned).
In the current version of the API, this leads to the requirement that most API functions require vectors (or the data backing a BFP vector) to begin at word-aligned addresses. Vectors are not required, however, to have a size (in bytes) that is a multiple of 4.
The alignment requirement is ultimately always on the data that backs a vector. For the low-level API, that is the pointers passed to the functions themselves. For the high-level API, that is the memory to which the data
field (or the real
and imag
fields in the case of bfp_complex_s16_t
) points, specified when the BFP vector is initialized.
Arrays of type int32_t
and complex_s32_t
will normally be guaranteed to be word-aligned by the compiler. However, if the user manually specifies the beginning of an int32_t
array, as in the following..
.. it is the responsibility of the user to ensure proper alignment of data.
For int16_t
arrays, the compiler does not by default guarantee that the array starts on a word-aligned address. To force word-alignment on arrays of this type, use __attribute__((align 4))
in the variable definition, as in the following.
Occasionally, 8-byte (double word) alignment is required. In this case, neither int32_t
nor int16_t
is necessarily guaranteed to align as required. Similar to the above, this can be hinted to the compiler as in the following.