pragma HLS array_partition


Partitions an array into smaller arrays or individual elements.

This partitioning:

  • Results in RTL with multiple small memories or multiple registers instead of one large memory.
  • Effectively increases the amount of read and write ports for the storage.
  • Potentially improves the throughput of the design.
  • Requires more memory instances or registers.


Place the pragma in the C source within the boundaries of the function where the array variable is defined.

#pragma HLS array_partition variable=<name> \
<type>  factor=<int>  dim=<int>


  • variable=<name>: A required argument that specifies the array variable to be partitioned.
  • <type>: Optionally specifies the partition type. The default type is complete. The following types are supported:
    • cyclic: Cyclic partitioning creates smaller arrays by interleaving elements from the original array. The array is partitioned cyclically by putting one element into each new array before coming back to the first array to repeat the cycle until the array is fully partitioned. For example, if factor=3 is used:
      • Element 0 is assigned to the first new array
      • Element 1 is assigned to the second new array.
      • Element 2 is assigned to the third new array.
      • Element 3 is assigned to the first new array again.
    • block: 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= argument.
    • complete: Complete partitioning decomposes the array into individual elements. For a one-dimensional array, this corresponds to resolving a memory into individual registers. This is the default <type>.
  • factor=<int>: Specifies the number of smaller arrays that are to be created.
    IMPORTANT!: For complete type partitioning, the factor is not specified. For block and cyclic partitioning the factor= is required.
  • dim=<int>: Specifies which dimension of a multi-dimensional array to partition. Specified as an integer from 0 to N, for an array with N dimensions:
    • If a value of 0 is used, all dimensions of a multi-dimensional array are partitioned with the specified type and factor options.
    • Any non-zero value partitions only the specified dimension. For example, if a value 1 is used, only the first dimension is partitioned.

Example 1

This example partitions the 13 element array, AB[13], into four arrays using block partitioning:

#pragma HLS array_partition variable=AB block factor=4

Because four is not an integer factor of 13:

  • Three of the new arrays have three elements each,
  • One array has four elements (AB[9:12]).

Example 2

This example partitions dimension two of the two-dimensional array, AB[6][4] into two new arrays of dimension [6][2]:

#pragma HLS array_partition variable=AB block factor=2 dim=2

Example 3

This example partitions the second dimension of the two-dimensional in_local array into individual elements.

int in_local[MAX_SIZE][MAX_DIM];
        #pragma HLS ARRAY_PARTITION variable=in_local complete dim=2        

See Also