Data Layout for Arbitrary Precision Types (ap_int library) - 2020.2 English

Vitis HLS Migration Guide (UG1391)

Document ID
UG1391
Release Date
2020-11-24
Version
2020.2 English

Data types in struct with custom data widths, such as ap_int, are allocated with sizes which are powers of 2. Vitis HLS adds padding bits for aligning the size of the data type to a power of 2.

In the following example, the size of varA in the struct will be padded to 8 bits instead of 5.

struct example  {
ap_int<5> varA;
unsigned short int varB;
unsigned short int varC;
int d;
};
Tip: Vitis HLS will also pad the bool data type to align it to 8 bits.