syn.directive.array_partition - 2023.1 English

Vitis Unified IDE and Common Command-Line Reference Manual (UG1553)

Document ID
UG1553
Release Date
2023-07-17
Version
2023.1 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 Vector Data Types.

syn.directive.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 number of read and write ports for the storage
  • Potentially improves 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]) which contains the array variable.
  • <array> is the array variable to be partitioned.

Options

dim=<integer>
Specifies which dimension of the array is to be partitioned.
  • The dimension is relevant for multi-dimensional arrays only.
  • If a value of 0 is used, all dimensions are partitioned with the specified options.
  • Any other value partitions only that dimension. For example, if a value 1 is used, 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:
    • 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.
  • 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.

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

Partitioned arrays can be addressed in your code by the new structure of the partitioned array, as shown in 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]