set_directive_bind_op

Description

Vitis HLS implements the operations in the code using specific implementations. The set_directive_bind_op command specifies that for a specified variable, an operation (mul, add, div) should be mapped to a specific device resource (impl) in the RTL. If the directive is not specified, Vitis HLS automatically determines the resource to use.

For example, to indicate that a specific multiplier operation (mul) is implemented in the device fabric rather than a DSP, you can use the set_directive_bind_op command.

You can also specify the latency of the operation using the -latency option.

IMPORTANT: To use the -latency option, the operation must have an available multi-stage implementation. The HLS tool provides a multi-stage implementation for all basic arithmetic operations (add, subtract, multiply and divide), all floating-point operations, and all block RAMs.

Syntax

set_directive_bind_op [OPTIONS] <location> <variable> <op>
  • <location> is the location (in the format function[/label]) which contains the variable.
  • <variable> is the variable to be assigned.
  • <op> specifies the type of operation for the variable.

    Supported operations include: mul, add, sub, fadd, fsub, fdiv, fexp, flog, fmul, frsqrt, frecip, fsqrt, dadd, dsub, ddiv, dexp, dlog, dmul, drsqrt, drecip, dsqrt, hadd, hsub, hdiv, hmul, hsqrt.

Options

-impl <value>

Defines the implementation to use for the specified operation (op).

Supported values include: dsp, fabric, meddsp, fulldsp, maxdsp, primitivedsp.

-latency <int>

Defines the default latency for the binding of the operation type to the implementation. The valid latency varies according to the specified op and impl. The default is -1, which lets Vitis HLS choose the latency.

Example 1

In the following example, a two-stage pipelined multiplier is specified to implement the multiplication for variable <c> of the function foo.

int foo (int a, int b) {
int c, d;
c = a*b;
d = a*c;
return d;
}
And the set_directive command is as follows:
set_directive_bind_op -op mul -imp MulnS -latency 2 "foo" c
TIP: The HLS tool selects the core to use for variable <d>.

See Also