set_directive_allocation - 2021.2 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
English (United States)
Release Date
2021.2 English


Specifies instance restrictions for resource allocation.

The ALLOCATION pragma or directive can limit the number of RTL instances and hardware resources used to implement specific functions, loops, or operations. For example, if the C/C++ source has four instances of a function foo_sub, the set_directive_allocation command can ensure that there is only one instance of foo_sub in the final RTL. All four instances are implemented using the same RTL block. This reduces resources used by the function, but negatively impacts performance by sharing those resources.

The operations in the C/C++ code, such as additions, multiplications, array reads, and writes, can also be limited by the set_directive_allocation command.


set_directive_allocation [OPTIONS] <location> <instances>
  • <location> is the location string in the format function[/label].
  • <instances> is a function or operator.

    The function can be any function in the original C/C++ code that has not been either inlined by the set_directive_inline command or inlined automatically by Vitis HLS.

    For a complete list of operations that can be limited using the ALLOCATION pragma, refer to the config_op command.


-limit <integer>

Sets a maximum limit on the number of instances (of the type defined by the -type option) to be used in the RTL design.

-type [function|operation]
The instance type can be function (default) or operation.


Given a design foo_top with multiple instances of function foo, limits the number of instances of foo in the RTL to 2.

set_directive_allocation -limit 2 -type function foo_top foo

Limits the number of multipliers used in the implementation of My_func to 1. This limit does not apply to any multipliers that might reside in sub-functions of My_func. To limit the multipliers used in the implementation of any sub-functions, specify an allocation directive on the sub-functions or inline the sub-function into function My_func.

set_directive_allocation -limit 1 -type operation My_func mul