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.