set_directive_disaggregate - 2021.2 Chinese

Vitis 高层次综合用户指南 (UG1399)

Document ID
UG1399
Release Date
2021-12-15
Version
2021.2 Chinese

描述

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