Description
This directive collects the data fields of a struct into a single wide
scalar. Vitis HLS performs a similar operation as
syn.directive.array_reshape for arrays inside
the struct. Vitis HLS completely partitions and
reshapes the array into a wide scalar and packs it with other elements of the
struct.Tip:
Vitis HLS restructures arrays of
structs as arrays of aggregated elements. The optimization does not support
structs that contain other structs.
You can infer the bit alignment of the resulting new wide-word 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.
Syntax
syn.directive.aggregate=[OPTIONS] <location> <variable>
-
<location>is the location (in the formatfunction[/label]) that contains the packed variable. -
<variable>is the struct variable to be packed.
Options
-
compact=[bit | byte | none | auto] - Specifies the alignment of the aggregated struct. Alignment can be on the bit-level (packed), the byte-level (padded), none, or automatically determined by the tool which is the default behavior.
Examples
The following example aggregates the variable AB. The variable is a struct pointer containing three 8-bit fields
(typedef struct {unsigned char R, G, B;}pixel)
in function func. The fields are abggregated into a
new 24-bit pointer, aligning data at the bit-level.
syn.directive.aggregate=func AB compact=bit