Description
Important:
syn.directive.array_partition and syn.directive.array_reshape are not supported for
M_AXI Interfaces on the top-level function.
Instead you can use the hls::vector data types as
described in Vector Data Types in
Vitis High-Level Synthesis User Guide (UG1399).
syn.directive.array_reshape combines
array partitioning with vertical array mapping to create a single new array with
fewer elements but wider words.
The syn.directive.array_reshape
command has the following features:
- Splits the array into multiple arrays (like
syn.directive.array_partition). - Automatically recombine the arrays vertically to create a new array with wider words.
Syntax
syn.directive.array_reshape=[OPTIONS] <location> <array>
-
<location>is the location (in the formatfunction[/label]) that contains the array variable. -
<array>is the array variable to be reshaped.
Options
-
dim=<integer> - Specifies the dimension of the array for partitioning.
- The dimension is relevant for multidimensional arrays only.
- Vitis partitions all dimensions with the options you specify if you use a value of 0.
- Any other value partitions only that dimension. When
you use
-factor 3, Vitis assigns 0 to the first array, 1 to the second, 2 to the third, and 3 to the first.
-
type=(block|cyclic|complete) -
-
blockreshaping creates smaller arrays from consecutive blocks of the original array. This splits the array into N equal blocks where N is the integer defined by the-factoroption. Vitis combines the N blocks into a single array withword-width*N. The default iscomplete. -
cyclicreshaping creates smaller arrays by interleaving elements from the original array. For example, if you use-factor 3, Vitis assigns element 0 to the first new array, element 1 to the second, element 2 to the third and finally element 3 to the first array. The final array is a vertical concatenation (word concatenation, to create longer words) of the new arrays into a single array. -
completereshaping decomposes the array into temporary individual elements and then recombines them into an array with a wider word. For a one-dimension array this is equivalent to creating a very-wide register. For example, if the original array was N elements of M bits, the result is a register withN*Mbits. This option is the default.
-
-
factor=<integer> - Used for
blockorcyclicpartitioning only, this option specifies the number of smaller arrays that are to be created. -
object -
Note: Relevant for container arrays only.Applies reshape on the objects within the container. If the option is specified, all dimensions of the objects are reshaped. However, Vitis maintains all dimensions of the container.
-
off=true - Disables the ARRAY_RESHAPE feature for the specified variable.
Example 1
Reshapes 8-bit array AB[17] in function func into a new 32-bit array with five elements.
Due to the fact that four is not an integer factor of 17:
- Index 17 of the array, AB[17], is in the lower eight bits of the reshaped fifth element.
- The upper eight bits of the fifth element are unused.
syn.directive.array_reshape=type=block factor=4 func AB
Partitions array AB[6][4] in function func, into a new array of dimension [6][2], in which dimension 2 is
twice the width.
syn.directive.array_reshape=type=block factor=2 dim=2 func AB
Reshapes 8-bit array AB[4][2][2] in function func into a new single element array (a register), 4*2*2*8 (=
128)-bits wide.
syn.directive.array_reshape=type=complete dim=0 func AB
Example 2
You can address reshaped arrays in your code by the new structure of
the array. See the code below when using the following directive.
syn.directive.array_reshape=top b type=complete dim=0
You can structure the code as follows:
struct SS
{
int x[N];
int y[N];
};
int top(SS *a, int b[4][6], SS &c) {...}
And the array interface defined
as:
syn.directive.interface=mode=ap_memory top b[0]