entity example is generic ( RECURSION_DEPTH : natural); end example; architecture rtl of example is ------------------------------------------------------------------------------ -- Function declarations ------------------------------------------------------------------------------ function function_1 ( constant RECURSION_DEPTH : natural) return natural; function function_2 ( constant RECURSION_DEPTH : natural) return natural; ------------------------------------------------------------------------------ -- Function definitions ------------------------------------------------------------------------------ function function_1 ( constant RECURSION_DEPTH : natural) return natural is begin if (RECURSION_DEPTH > 0) then return function_2( RECURSION_DEPTH => RECURSION_DEPTH-1); else return 0; end if; end function_1; function function_2 ( constant RECURSION_DEPTH : natural) return natural is variable retval : natural; begin retval := function_1( RECURSION_DEPTH => RECURSION_DEPTH); return retval; end function_2; ------------------------------------------------------------------------------ -- Function call ------------------------------------------------------------------------------ constant retval : natural := function_1( RECURSION_DEPTH => RECURSION_DEPTH); begin end rtl;