Description
By default:
- Functions remain as separate hierarchy blocks in the RTL, or are decomposed (inlined) into higher-level functions.
- All instances of a function, at the same level of hierarchy, uses the same RTL implementation (block).
The syn.directive.function_instantiate
command creates a unique RTL implementation for each instance of a function. You can
optimize each instance around a specific argument or variable.
By default, the following code results in a single RTL implementation of
function func_sub for all three instances. If func_sub is a small function, Vitis inlines it
into function func.
set_directive_inline off option can prevent this automatic inlining.char func_sub(char inval, char incr)
{
return inval + incr;
}
void func(char inval1, char inval2, char inval3,
char *outval1, char *outval2, char * outval3)
{
*outval1 = func_sub(inval1, 1);
*outval2 = func_sub(inval2, 2);
*outval3 = func_sub(inval3, 3);
}
Using the directive as shown in the example section below results in three
versions of function func_sub, each independently optimized
for variable incr.
Syntax
syn.directive.function_instantiate=<location> <variable>
-
<location>is the location (in the formatfunction[/region label]) where the instances of a function are to be made unique. -
<variable>specifies the function argument as a constant in the various function instantiations.
Options
This command has no options.
Examples
The following Tcl allows Vitis to independently optimize
each instance of func_sub with respect to input incr. (The Tcl can also be the pragma placed in function func_sub)
syn.directive.inline off=func_sub
syn.directive.function_instantiate=func_sub incr