set_directive_expression_balance - 2022.1 English

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
ft:locale
English (United States)
Release Date
2022-04-20
Version
2022.1 English

Description

Sometimes C/C++ code is written with a sequence of operations, resulting in a long chain of operations in RTL. With a small clock period, this can increase the latency in the design. By default, the Vitis HLS tool rearranges the operations using associative and commutative properties. As described in Optimizing Logic Expressions, this rearrangement creates a balanced tree that can shorten the chain, potentially reducing latency in the design at the cost of extra hardware.

Expression balancing rearranges operators to construct a balanced tree and reduce latency.

  • For integer operations expression balancing is on by default but may be disabled.
  • For floating-point operations, expression balancing is off by default but may be enabled.

The set_directive_expression_balance command allows this expression balancing to be turned off, or on, within a specified scope.

Syntax

set_directive_expression_balance [OPTIONS] <location>
  • <location> is the location (in the format function[/label]) where expression balancing should be disabled, or enabled.

Options

-off
Turns off expression balancing at the specified location.
Specifying the set_directive_expression_balance command enables expression balancing in the specified scope. Adding the -off option disables it.

Examples

Disables expression balancing within function My_Func.

set_directive_expression_balance -off My_Func

Explicitly enables expression balancing in function My_Func2.

set_directive_expression_balance My_Func2