set_directive_function_instantiate - 2021.2 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
Release Date
2021-12-15
Version
2021.2 English

Description

By default:

  • Functions remain as separate hierarchy blocks in the RTL.
  • All instances of a function, at the same level of hierarchy, uses the same RTL implementation (block).

The set_directive_function_instantiate command is used to create a unique RTL implementation for each instance of a function, allowing each instance to be optimized.

By default, the following code results in a single RTL implementation of function foo_sub for all three instances.

char foo_sub(char inval, char incr)
{
  return inval + incr;
}
void foo(char inval1, char inval2, char inval3,
  char *outval1, char *outval2, char * outval3)
{
  *outval1 = foo_sub(inval1, 1);
  *outval2 = foo_sub(inval2, 2);
  *outval3 = foo_sub(inval3, 3);
}

Using the directive as shown in the example section below results in three versions of function foo_sub, each independently optimized for variable incr.

Syntax

set_directive_function_instantiate <location> <variable>
  • <location> is the location (in the format function[/label]) where the instances of a function are to be made unique.
  • <variable> <string> specifies which function argument <string> is to be specified as constant.

Options

This command has no options.

Examples

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

set_directive_function_instantiate foo_sub incr