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

Vivado Design Suite User Guide: Synthesis (UG901)

Document ID
UG901
Release Date
2026-07-08
Version
2026.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