Programmer’s Model - 2025.2 English - UG1399

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
Release Date
2026-01-22
Version
2025.2 English
  1. Include the header: Add #include "hls_task.h" to access the Auto-Restart helper class
  2. Set up your test bench: Initialize variables and buffers with data for the DUT
  3. Invoke with Auto-Restart: Call the DUT using hls::autorestart name_of_class_instance(num_iters, dut_function, arg1, arg2, ...); where num_iters is the number of iterations

When invoked, the AXI4-Lite (SAXI4-Lite) interface writes the iteration count(num_iters) to the kernel's Auto-Restart counter register at address 0x10. The kernel then executes that number of iterations back-to-back with no gaps.

Example

#include "hls_task.h"

void top(...) {
  #pragma HLS INTERFACE s_axilite autorestart port=return
...
}
void main()
{
 for(i.. )
 {
  input[i] = i;
 }
 // Run 3 iterations back-to-back with test 
 hls::autorestart run_top(top, input, output);
}
for(i.. )
{
input[i] = i*i;
}
// Run 10 iterations back-to-back
run_top(10, top, input, output);
 

Note: The top function must have the autorestart counter in the s_axilite adapter, as enabled via #pragma HLS interface s_axilite port=return autorestart