xcl_array_reshape
Description
xcl_array_reshape
does
support multi-dimensional arrays, you can only reshape one dimension of the array with a
single attribute.Combines array partitioning with vertical array mapping.
The ARRAY_RESHAPE
attribute combines the
effect of ARRAY_PARTITION
, breaking an array into smaller
arrays, and concatenating elements of arrays by increasing bit-widths. This reduces the
number of block RAM consumed while providing parallel access to the data. This attribute
creates a new array with fewer elements but with greater bit-width, allowing more data to be
accessed in a single clock cycle.
Given the following code:
void foo (...) {
int array1[N] __attribute__((xcl_array_reshape(block, 2, 1)));
int array2[N] __attribute__((xcl_array_reshape(cycle, 2, 1)));
int array3[N] __attribute__((xcl_array_reshape(complete, 1)));
...
}
Figure: ARRAY_RESHAPE
Syntax
Place the attribute with the definition of the array variable:
__attribute__((xcl_array_reshape(<type>,<factor>,
<dimension>)))
Where:
- <type>: Specifies one of the
following partition types:
cyclic
: Cyclic partitioning is the implementation of an array as a set of smaller physical memories that can be accessed simultaneously by the logic in the compute unit. The array is partitioned cyclically by putting one element into each memory before coming back to the first memory to repeat the cycle until the array is fully partitioned.block
: Block partitioning is the physical implementation of an array as a set of smaller memories that can be accessed simultaneously by the logic inside of the compute unit. In this case, each memory block is filled with elements from the array before moving on to the next memory.complete
: Complete partitioning decomposes the array into individual elements. For a one-dimensional array, this corresponds to resolving a memory into individual registers.- The default type is
complete
.
- <factor>: For cyclic type
partitioning, the factor specifies how many physical
memories to partition the original array into in the kernel code. For Block type
partitioning, the factor specifies the number of
elements from the original array to store in each physical memory. IMPORTANT!: For
complete
type partitioning, the factor should not be specified. - <dimension>: Specifies which array dimension to partition. Specified as an integer from 1 to N. SDAccel supports arrays of N dimensions and can partition the array on any single dimension.
Example 1
Reshapes (partition and maps) an 8-bit array with 17 elements, AB[17], into a new 32-bit array with five elements using block mapping.
int AB[17] __attribute__((xcl_array_reshape(block,4,1)));
Example 2
Reshapes the two-dimensional array AB[6][4] into a new array of dimension [6][2], in which dimension 2 has twice the bit-width:
int AB[6][4] __attribute__((xcl_array_reshape(block,2,2)));
Example 3
Reshapes the three-dimensional 8-bit array, AB[4][2][2] in function foo
, into a new single element array (a register), 128 bits wide
(4*2*2*8):
int AB[4][2][2] __attribute__((xcl_array_reshape(complete,0)));
See Also
- xcl_array_partition
- pragma HLS array_reshape
- SDAccel Environment Optimization Guide (UG1207)
- Vivado Design Suite User Guide: High-Level Synthesis (UG902)