Description
Collects and groups the data fields of a struct into a single scalar with a wider word width.
The AGGREGATE pragma is used for grouping all the elements of a struct into a single wide vector to allow all members of the struct to be read and written to simultaneously. 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 LSB of the vector, and the final element of the struct is aligned with the MSB of the vector.
If the struct contains arrays, the AGGREGATE pragma performs a similar operation as ARRAY_RESHAPE, and combines the reshaped array with the other elements in the struct. Any arrays declared inside the struct are completely partitioned and reshaped into a wide scalar and packed with other scalar elements.
Syntax
Place the pragma near the definition of the struct variable to aggregate:
#pragma HLS aggregate variable=<variable> compact=<arg>
Where:
-
variable=<variable>
- Specifies the variable to be grouped.
-
compact=[bit | byte | none | auto]
- Specifies the alignment of the aggregated struct. Alignment can be on the bit-level, the byte-level, none, or automatically determined by the tool which is the default behavior.
Example 1
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 aligned on the bit-level.
typedef struct{
unsigned char R, G, B;
} pixel;
pixel AB;
#pragma HLS aggregate variable=AB compact=bit
Example 2
Aggregates struct array AB[17]
with three
8-bit field fields (R, G, B) into a new 17 element array of 24-bits.
typedef struct{
unsigned char R, G, B;
} pixel;
pixel AB[17];
#pragma HLS aggregate variable=AB