The ARRAY_RESHAPE directive reforms the array with a vertical mode of remapping, and is used to reduce the number of block RAM consumed while providing parallel access to the data.
Given the following example code:
void foo (...) {
int array1[N];
int array2[N];
int array3[N];
#pragma HLS ARRAY_RESHAPE variable=array1 type=block factor=2 dim=1
#pragma HLS ARRAY_RESHAPE variable=array2 type=cycle factor=2 dim=1
#pragma HLS ARRAY_RESHAPE variable=array3 type=complete dim=1
...
}
The ARRAY_RESHAPE directive transforms the arrays into the form shown in the following figure.
The ARRAY_RESHAPE directive allows more data to be
accessed in a single clock cycle. In cases where more data can
be accessed in a single clock cycle, Vitis HLS might automatically unroll any
loops consuming this data, if doing so will improve the
throughput. The loop can be fully or partially unrolled to
create enough hardware to consume the additional data in a
single clock cycle. This feature is controlled using the config_unroll
command and
the option tripcount_threshold
.
In the following example, any loops with a tripcount of less
than 16 will be automatically unrolled if doing so improves the
throughput.
config_unroll -tripcount_threshold 16