syn.directive.aggregate - 2024.1 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
Release Date
2024-05-30
Version
2024.1 English

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 syn.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 optimization does not support structs that contain other structs.

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.

Syntax

syn.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.

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 which is a struct pointer containing 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.

syn.directive.aggregate=func AB compact=bit