Example of Recursive Tasks and Functions - 2022.1 English

Vivado Design Suite User Guide: Synthesis (UG901)

Document ID
UG901
Release Date
2022-06-06
Version
2022.1 English

function automatic [31:0] fac;

input [15:0] n;

if (n == 1)

   fac = 1;

 

else

 

   fac = n * fac(n-1); //recursive function call

endfunction