10-03-2012 08:20 AM
Reading the PDF of "Vivado Design Suite User Guide - High-Level Synthesis - UG902 (v2012.2) July 25, 2012", on page 53 it says:
"Tail recursion is synthesizable."
But on page 286 it says:
"Tail recursion, where there are a finite number of function calls, is also not supported:"
There is only one example for both:
unsigned foo (unsigned m, unsigned n)
{
if (m == 0) return n;
if (n == 0) return m;
return foo(n, m%n);
}
Am I missing something, or is the manual wrong?
Is tail recursion supported or not?
Many Thanks
Paulo Ferreira
02-21-2013 06:57 AM
Hello Paulo,
I double checked on that following your last post and yes effectively, the support for tail recursive functions have been removed. The tool will error out on them.
Since tail recursion is basically a loop in disguise, the simple functions can easily be transformed as the gcd example from the UG you highlighted:
while( m!=0 & n!=0 ) { //or same: while( m>0 & n>0 ) {
unsigned int mmodn=m%n;
m=n;
n=mmodn;
}
if (m == 0) return n;
else return m;
Please note that the example with the classes should still work as this is all static and determined at compile time.
I hope this helps.
10-03-2012 03:30 PM
What does this have to do with Synthesis?
10-03-2012 04:11 PM - edited 10-03-2012 04:12 PM
Hello Paulo,
The tail recursion is supported - AFAIK the statement you point on page 286 is incorrect: if you ignore it, all the references to tail recursion make sense and are consistent.
The "normal" recursion is not supported for the reasons explained in UG902.
There is a another tail recursion in C++ later at page 293.
10-03-2012 04:14 PM
10-04-2012 04:51 AM
Sorry for having placed the question in this forum, but on the description of this forum there is the mention of Vivado HLS...
And many thanks for the answer!
Paulo Ferreira
10-05-2012 02:36 AM
No problems about the location.. The description for the synthesis folder has been updated to remove the HLS mention.
Users can still post there but they should use the "design tools - others" folder / board.
About the tail recursion: glad that helped to clarify the situation. Let us know if you have any issues with that/other.
02-18-2013 08:45 AM
Well, I fiinally got a license for Vivado_HLS, and trying the examples from tthe manual, it says that recursion is not supported.
Reading the "fine" manual with lots of care it seems that "tail recursion" was "supported" on the first releease(s) but now there is no support for tail recursion.
The mention of "tail recursion" being supported has disappeared on the change from version 2012.2 to version 2012..3 of the High Level Synthesis User Guide...
So, I will need to do it, in another way.
So, the last word is: on Vivado HLS 2012.4 tail recursive functions are not supported..
My best regrads
Paulo Ferreira
02-21-2013 06:57 AM
Hello Paulo,
I double checked on that following your last post and yes effectively, the support for tail recursive functions have been removed. The tool will error out on them.
Since tail recursion is basically a loop in disguise, the simple functions can easily be transformed as the gcd example from the UG you highlighted:
while( m!=0 & n!=0 ) { //or same: while( m>0 & n>0 ) {
unsigned int mmodn=m%n;
m=n;
n=mmodn;
}
if (m == 0) return n;
else return m;
Please note that the example with the classes should still work as this is all static and determined at compile time.
I hope this helps.