Handling Structs - 2022.1 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
Release Date
2022.1 English

Vivado HLS used to disaggregate structs in the interface by default. Vitis™ HLS instead keeps structs aggregated. You can use the DISAGGREGATE pragma/directive to match the Vivado HLS behavior.

Structs in the code, both internal and global variables, are disaggregated by default and decomposed into their member elements, as described in Structs. The number and type of elements created are determined by the contents of the struct itself. Arrays of structs are implemented as multiple arrays, with a separate array for each member of the struct.

Structs in C/C++ are padded with extra bytes by the compiler for data alignment. In order to make kernel code in Vitis HLS compliant with gcc, structs in kernel code are thus padded with extra bytes. Padding and alignment can be changed as described in Struct Padding and Alignment.