Intel® High Level Synthesis Compiler Pro Edition: Reference Manual

ID 683349
Date 12/19/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

12.1.3. The ihc::math_dsp_control Function

Use the ihc::math_dsp_control function to control the hardware implementation for supported data types and math functions at a local-scope.

The ihc::math_dsp_control function is defined in the HLS/math_dsp_control.h header file. Include this header file in your component or task code to use the function.

Syntax

ihc::math_dsp_control<HW_impl_pref, lambda_expr_propagation>

where the template parameters are defined as follows:

HW_impl_pref

The HW_impl_pref template parameter takes an enum data type with one of the following values:
Table 35.  HW_impl_pref Values
Value Description
ihc::Preference::DSP The compiler tries to implement supported math operations with DSP blocks.

This value is the default.

ihc::Preference::Softlogic The compiler tries to implement supported math operations with soft logic using ALMs.
ihc::Preference::Compiler_default The compiler implements supported math operations with DSP blocks or soft logic (ALMs) based on data type and operation.

lambda_expr_propagation

The lambda_expr_propagation template parameter is a Boolean value that determines the propagation of the HW_impl_pref value to function calls in the lambda expression as follows:
Table 36.   lambda_expr_propagation Values
Value Description
true The HW_impl_pref value is propagated to function calls in the lambda expression function.

This value is the default.

false The HW_impl_pref value is not propagated to function calls in the lambda expression function.

The HW_impl_pref value applies only to math operations directly called in the lama expression.

Nested Calls

A HW_impl_pref value never applies to any nested ihc::math_dsp_control function calls. Each ihc::math_dsp_control function call requires its own HW_impl_pref value specified.

Example

component float test_lib(float a, float b) {
  ihc::math_dsp_control<ihc::Preference::Softlogic>([&]{ 
    a += 7.89f; // Soft-logic
    a += b;     // Soft-logic 
  }); 
  return a;
}