- Include the header: Add #include "hls_task.h" to access the Auto-Restart helper class
- Set up your test bench: Initialize variables and buffers with data for the DUT
- Invoke with Auto-Restart: Call the DUT using hls::autorestart
name_of_class_instance(
num_iters,dut_function,arg1,arg2, ...); wherenum_itersis 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