syn.directive.array_partition - 2025.2 English - UG1399

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
Release Date
2025-11-20
Version
2025.2 English

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 the Vector Data Types section of the Vitis High-Level Synthesis User Guide (UG1399).

syn.directive.array_partition partitions an array into smaller arrays or individual elements.

This partitioning can do the following.

  • Results in RTL with multiple small memories or multiple registers instead of one large memory
  • Increases the number of read and write ports for the storage
  • Capacity to improve the throughput of the design
  • Requires more memory instances or registers

Syntax

syn.directive.array_partition=[OPTIONS] <location> <array>
  • <location> is the location (in the format function[/label]) that contains the array variable.
  • <array> is the array variable to be partitioned.

Options

dim=<integer>
Specifies the dimension of the array for partitioning.
  • The dimension is relevant for multi-dimensional arrays only.
  • All dimensions are partitioned with the specified options if using a value of 0.
  • Any other value partitions only that dimension. For example, for a value of 1, only the first dimension is partitioned.
type=(block|cyclic|complete)
  • block partitioning creates smaller arrays from consecutive blocks of the original array. This effectively splits the array into N equal blocks where N is the integer defined by the -factor option.
  • cyclic partitioning creates smaller arrays by interleaving elements from the original array. For example, if -factor 3 is used, the following is the result.
    • The directive assigns element 0 to the first new array.
    • Element 1 to the second new array.
    • Element 2 to the third new array.
    • Element 3 to the first new array again.
  • The complete partitioning decomposes the array into individual elements. For a one-dimensional array, this corresponds to resolving a memory into individual registers. For multi-dimensional arrays, specify the partitioning of each dimension, or use -dim 0 to partition all dimensions.
The default is complete.
factor=<integer>
Used for block or cyclic partitioning only, this option specifies the number of smaller arrays that are to be created.
off=true
Disables the ARRAY_PARTITION feature for the specified variable. Does not work with dim, factor, or type.

Example 1

Partitions array AB[13] in function func into four arrays. Because four is not an integer factor of 13:

  • Three arrays have three elements.
  • One array has four elements (AB[9:12]).
syn.directive.array_partition=func AB type=block factor=4

Partitions array AB[6][4] in function func into two arrays, each of dimension [6][2].

syn.directive.array_partition=func AB type=block factor=2 dim=2

Partitions all dimensions of AB[4][10][6] in function func into individual elements.

syn.directive.array_partition=func AB type=complete dim=0

Example 2

You can address partitioned arrays in your code by the new structure of the partitioned array. See the following code example when using the following directive.
syn.directive.array_partition=top b type=complete dim=1

The code can be structured as follows:

struct SS
{
  int x[N];
  int y[N];
};
  
int top(SS *a, int b[4][6], SS &c) {...}

syn.directive.interface mode=ap_memory top b[0]
syn.directive.interface mode=ap_memory top b[1]
syn.directive.interface mode=ap_memory top b[2]
syn.directive.interface mode=ap_memory top b[3]