This directive collects the data fields of a struct into a single wide scalar. Any arrays declared within the struct and Vitis HLS performs a similar operation as set_directive_array_reshape, and completely partitions and reshapes the array into a wide scalar and packs it with other elements of the struct.
TIP: Arrays of structs are restructured as arrays of aggregated elements.

The bit alignment of the resulting new wide-word can be inferred from the declaration order of the struct elements. The first element takes the least significant sector of the word and so forth until all fields are mapped.

Note: The AGGREGATE optimization does not pack the structs, and cannot be used on structs that contain other structs.


set_directive_aggregate [OPTIONS] <location> <variable>
  • <location> is the location (in the format function[/label]) which contains the variable which will be packed.
  • <variable> is the struct variable to be packed.


This command has no options.


Aggregates struct pointer AB with three 8-bit fields (typedef struct {unsigned char R, G, B;} pixel) in function foo, into a new 24-bit pointer.
set_directive_aggregate foo AB
Aggregates struct array AB[17] with three 8-bit field fields (typedef struct {unsigned char R, G, B;} pixel) in function foo, into a new 17 element array of 24 bits.
set_directive_aggregate foo AB

See Also