此示例使用的代码与前述示例相同,但在此例中,HLS 设计配置为运行并重启 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);