Recursive functions cannot be synthesized. This applies to functions that can form multiple recursions:
unsigned foo (unsigned n)
{
if (n == 0 || n == 1) return 1;
return (foo(n-2) + foo(n-1));
}
Vitis HLS also does not support tail recursion, in which there is a finite number of function calls.
unsigned foo (unsigned m, unsigned n)
{
if (m == 0) return n;
if (n == 0) return m;
return foo(n, m%n);
}
In C++, templates can implement tail recursion and can then be used for synthesizable tail-recursive designs.
CAUTION:
Virtual Functions are not
supported.