Description
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.
Syntax
set_directive_aggregate [OPTIONS] <location> <variable>
-
<location>
is the location (in the formatfunction[/label]
) which contains the variable which will be packed. -
<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
Aggregates struct pointer AB
with
three 8-bit fields (typedef struct {unsigned char R, G,
B;}
pixel) in function func
, into a
new 24-bit pointer, aligning data at the bit-level.
set_directive_aggregate func AB -compact bit