带计数的自动重启 - 2022.1 简体中文

Vitis 统一软件平台文档 应用加速开发 (UG1393)

Document ID
UG1393
Release Date
2022-05-25
Version
2022.1 简体中文

此示例使用相同的代码,但在此例中,内核配置为重新启动并运行 3 次迭代,然后停止。唯一要更改的是指定迭代次数,如以下代码示例中所示。

提示: 在“带计数的自动重启”用例中,不需要使用 abort(),因为主机知道何时停止。
143   xrt::kernel incr(device, uuid, "increment");
144   int adder1 = 20;  // arbitrarily chosen to be different from 0
145   int adder2 = 10;  // arbitrarily chosen to be different from 0
151   // start the incr kernel in auto restart mode with default adders
152   // since it is a streaming kernel it will be stalled waiting for
153   // input
154   auto incr_run = incr(xrt::autostart{3}, nullptr, nullptr, adder1);