set_directive_disaggregate - 2023.2 日本語

Vitis 高位合成ユーザー ガイド (UG1399)

Document ID
UG1399
Release Date
2023-12-18
Version
2023.2 日本語

説明

set_directive_disaggregate コマンドを使用すると、struct 変数が個別の要素に分割されます。作成される要素の数とタイプは、その構造体の内容によって決まります。

重要: 最上位関数への引数として使用される構造体は、デフォルトでは集約されますが、このプラグマまたは指示子を使用して分割できます。ストリームに関連付けられている構造体の分割に関する重要な情報は、AXI4-Stream インターフェイス を参照してください。

構文

set_directive_disaggregate <location> <variable>
  • <location>: 分割する変数のディレクトリで、function[/label] の形式で指定します。
  • variable: 変数名を指定します。

オプション

このコマンドにはオプションはありません。

例 1

次の例は、関数 top の構造体変数 a を分割します。

set_directive_disaggregate top a

例 2

分割された構造体は、次に示すように、標準の C/C++ コーディング スタイルを使用して、コード内でアドレス指定できます。ポインター要素 (a) とリファレンス要素 (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

例 3

次の例は、RGB 構造体を要素として含む Dot 構造体を示しています。Arr 変数に set_directive_disaggregate を適用すると、最上位の Dot 構造体のみが集約解除されます。

struct Pixel { 
char R; 
char G; 
char B; 
}; 

struct Dot { 
Pixel RGB; 
unsigned Size; 
}; 

#define N 1086 
void DUT(Dot Arr[N]) {
... 
} 

set_directive_disaggregate DUT Arr

構造体全体 (Dot および RGB) を集約解除する場合は、次のように set_directive_disaggregate を割り当てます。

void DUT(Dot Arr[N]) { 
#pragma HLS disaggregate variable=Arr->RGB 
... 
} 

set_directive_disaggregate DUT Arr->RGB
この場合、結果は次のようになります。
void DUT(char Arr_RGB_R[N], char Arr_RGB_G[N], char Arr_RGB_B[N], unsigned Arr_Size[N]) { 
... 
}