Example of Recursive Tasks and Functions - Example of Recursive Tasks and Functions - 2022.2 English - UG901

Vivado Design Suite User Guide: Synthesis (UG901)

Document ID
UG901
Release Date
2022-11-16
Version
2022.2 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