set_directive_disaggregate - 2021.2 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
ft:locale
English (United States)
Release Date
2021-12-15
Version
2021.2 English

Description

The set_directive_disaggregate command lets you deconstruct a struct variable into its individual elements. The number and type of elements created are determined by the contents of the struct itself.

Important: Structs used as arguments to the top-level function are aggregated by default, but can be disaggregated with this directive or pragma. Refer to AXI4-Stream Interfaces for important information about disaggregating structs associated with streams.

Syntax

set_directive_disaggregate <location> <variable>
  • <location> is the location (in the format function[/label]) where the variable to disaggregate is found.
  • <variable> specifies the struct variable name.

Options

This command has no options.

Example 1

The following example shows the struct variable a in function top will be disaggregated:

set_directive_disaggregate top a

Example 2

Disaggregated structs can be addressed in your code by the using standard C/C++ coding style as shown below. Notice the different methods for accessing the pointer element (a) versus the reference element (c);

struct SS
{
  int x[N];
  int y[N];
};
  
int top(SS *a, int b[4][6], SS &c) {

set_directive_disaggregate top a
set_directive_interface -mode s_axilite top a->x
set_directive_interface -mode s_axilite top a->y

set_directive_disaggregate top c
set_directive_interface -mode ap_memory top c.x
set_directive_interface -mode ap_memory top c.y