syn.directive.function_instantiate - 2024.1 English

Vitis Unified Software Platform Documentation: Application Acceleration Development (UG1393)

Document ID
UG1393
Release Date
2024-07-03
Version
2024.1 English

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 is used to create a unique RTL implementation for each instance of a function, allowing each instance to be optimized 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, or if func_sub is a small function it is inlined into function func.

Tip: By default, the Vitis HLS tool automatically inlines small functions. This is true even for function instantiations. Using the set_directive_inline off option can be used to 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 format function[/region label]) where the instances of a function are to be made unique.
  • <variable> specifies the function argument to be specified as a constant in the various function instantiations.

Options

This command has no options.

Examples

For the example code shown above, the following Tcl (or pragma placed in function func_sub) allows each instance of function func_sub to be independently optimized with respect to input incr.

syn.directive.inline off=func_sub
syn.directive.function_instantiate=func_sub incr