Main Content

Conditions for Code Replacement of Simulink Blocks with QHL

R2026b

Each Simulink® block that can be used with the Embedded Coder® Support Package for Qualcomm® Hexagon® Processors requires specific conditions to allow code replacement by using the Qualcomm Hexagon library (QHL). You use this code replacement library to generate C/C++ code from a Simulink model or from MATLAB® code.

When you satisfy the specified conditions, the generated C/C++ code uses QHL support to achieve optimized execution on Qualcomm Hexagon processors.

Basic Math Operations

QHL supports these Simulink math blocks for floating-point data type only when you configure the required properties, as specified in this table.

FunctionInput RequirementsParameter RequirementsEquivalent Functions
Addition (+)
  • Input can be vector or matrix

  • Real or Complex Values

  • Real Input Length > 1000

    OR

    Complex Input Length >= 500

  • Vector and matrix real inputs

    • qhblas_vector_add_af

  • Vector and matrix complex inputs

    • mw_qhblas_vector_add_acf

Subtraction (-)
  • Input can be vector or matrix

  • Real or Complex Values

  • Real Input Length > 1000

    OR

    Complex Input Length >= 500

  • Vector and matrix real inputs

    • qhblas_vector_sub_af

  • Vector and matrix complex inputs

    • mw_qhblas_vector_sub_acf

Element-wise matrix multiplication
  • Input can be vector or matrix

  • Real or Complex Values

  • Real Input Length > 1000

    OR

    Complex Input Length >= 500

  • Vector and matrix real inputs

    • qhblas_vector_hadamard_af

  • Vector and matrix complex inputs

    • mw_qhblas_vector_hadamard_acf

Multiplication - scaling
  • Input can be vector or matrix

  • Real or Complex Values

  • Real Input Length > 1000

    OR

    Complex Input Length >= 500

  • Vector and matrix real inputs

    • qhblas_vector_add_af

  • Vector and matrix complex inputs

    • mw_qhblas_vector_add_acf

Dot product
  • Input can be a vector or matrix

  • Real values

  • Real Input Length > =100

  • For vector, and matrix real inputs - qhblas_f_vector_dot_af

  • For vector, and matrix complex inputs - qhblas_cf_vector_dot_acf

Absolute
  • Input must be a scalar, vector, or matrix

  • Real values

Input length must be > 11

  • Vector, and matrix real inputs

    • qhmath_abs_af

Square-root
  • Input must be a scalar, vector, or matrix

  • Real values

-
  • Scalar real inputs

    • qhmath_sqrt_f

  • Vector, and matrix real inputs

    • qhmath_sqrt_af

Reciprocal square-root
  • Input must be a scalar, vector, or matrix

  • Real values

-
  • Scalar real inputs

    • qhmath_rsqrt_f

  • Vector, and matrix real inputs

    • qhmath_rsqrt_af

Natural logarithm
  • Input must be a scalar, vector, or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_log_f

  • Vector, and matrix real inputs

    • qhmath_log_af

  • Scalar complex inputs

    • mw_qhcomplex_clog_f

  • Vector and matrix complex inputs

    • mw_qhcomplex_clog_af

Base 2 logarithm
  • Input must be a scalar, vector, or matrix

  • Real values

-
  • Scalar real inputs

    • qhmath_log2_f

  • Vector, and matrix real inputs

    • qhmath_log2_af

Common logarithm (base 10)
  • Input must be a scalar, vector, or matrix

  • Real values

-
  • Scalar real inputs

    • qhmath_log10_f

  • Vector, and matrix real inputs

    • qhmath_log10_af

Exponential
  • Input must be a scalar, vector, or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_cexp_f

  • vector, and matrix real inputs

    • qhmath_cexp_af

  • scalar complex inputs

    • mw_qhcomplex_cexp_f

  • Vector, and Matrix complex inputs

    • mw_qhcomplex_cexp_af

Power
  • Input must be a scalar, vector, or matrix

  • Real and complex values

-
  • Scalar, matrix real inputs (base) and vector, matrix real inputs (exponent)

    • mw_qhmath_pow_f

  • Vector real inputs (base) and scalar real inputs (exponent)

    • qhmath_pow_af

  • Scalar, vector, and matrix complex inputs (base and exponent)

    • mw_qhcomplex_cpow_f

Minimum
  • Input must be a vector or matrix

  • Real values

Input length must be > 22

  • Vector and matrix real inputs

    • mw_qhblas_f_vector_self_min_af

Maximum
  • Input must be a vector or matrix

  • Real values

Input length must be > 22

  • Vector and matrix real inputs

    • mw_qhblas_f_vector_self_max_af

QHL supports these Simulink math blocks for fixed-point Q15 data type only when you configure the required properties, as specified in this table.

FunctionInput RequirementsInput DataTypeParameter RequirementsEquivalent Functions
Addition (+)
  • Input can be vector or matrix

  • Real or Complex Values

fixdt(1,16,*)

  • Real Input Length ≥ 16

    OR

    Complex Input Length ≥ 8

  • Word length must be 16 bits with adjustable fractional length (0–15 bits)

  • Vector and matrix real inputs

    • mw_qhblas_vector_add_ah

  • Vector and matrix complex inputs

    • mw_qhblas_vector_add_ach

Subtraction (-)
  • Input can be vector or matrix

  • Real or Complex Values

fixdt(1,16,*)

  • Real Input Length ≥ 16

    OR

    Complex Input Length ≥ 8

  • Word length must be 16 bits with adjustable fractional length (0–15 bits)

  • Vector and matrix real inputs

    • mw_qhblas_vector_sub_ah

  • Vector and matrix complex inputs

    • mw_qhblas_vector_sub_ach

Element-wise matrix multiplication
  • Input can be vector or matrix

  • Real Value

fixdt(1,16,*)

  • Real Input Length ≥ 8

  • Word length must be 16 bits with adjustable fractional length (0–15 bits)

  • Vector and matrix real inputs

    • mw_qhblas_vector_hadamard_ah

Multiplication - Scaling
  • Input can be vector or matrix

  • Real or Complex Values

fixdt(1,16,*)

  • Real Input Length ≥ 8

    OR

    Complex Input Length ≥ 1

  • Vector and matrix real inputs

    • mw_qhblas_vector_scaling_ah

  • Vector and matrix complex inputs

    • mw_qhblas_vector_add_ach

Dot product
  • Input can be a vector or matrix

  • Real values

fixdt(1,16,15)

  • Real Input Length ≥ 100

  • For vector and matrix real inputs - mw_qhblas_h_vector_dot_ah

Absolute
  • Input must be a vector or matrix

  • Real values

fixdt(1,16,15)

-
  • Vector and matrix real inputs

    • mw_qhmath_abs_ah

Square root
  • Input must be a scalar, vector, or matrix

  • Real unsigned values

fixdt(0,16,*)

-
  • Scalar real inputs

    • qhmath_sqrt_h

  • Vector and matrix real inputs

    • qhmath_sqrt_ah

Maximum
  • Input must be a vector or matrix

  • Real values

fixdt(1,16,15)

Input length must be > 22

  • Vector and matrix real inputs

    • mw_qhblas_h_vector_self_max_ah

Minimum
  • Input must be a vector or matrix

  • Real values

fixdt(1,16,15)

Input length must be > 22

  • Vector and matrix real inputs

    • mw_qhblas_h_vector_self_min_ah

Dot product
  • Input can be a vector or matrix

  • Real values

fixdt(1,16,15)

  • Real Input Length ≥ 100

  • For vector and matrix real inputs - mw_qhblas_h_vector_dot_ah

Trigonometric Operations

QHL supports these Simulink trigonometric blocks for floating-point data type only when you configure the required properties, as specified in this table.

FunctionInput RequirementsParameter RequirementsEquivalent Functions
sin
  • Input must be a scalar, vector or matrix

  • Real or complex Values

-
  • Scalar real inputs

    • qhmath_sin_f

  • Scalar, vector, and matrix real inputs

    • qhmath_sin_af

  • Scalar, vector, and matrix complex inputs

    • mw_qhcomplex_csin_f

cos
  • Input must be a scalar, vector or matrix

  • Real or complex Values

-
  • Scalar real inputs

    • qhmath_cos_f

  • Scalar, vector, and matrix real inputs

    • qhmath_cos_af

  • Scalar, vector, and matrix complex inputs

    • mw_qhcomplex_ccos_f

tan
  • Input must be a scalar, vector, or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_tan_f

  • Vector and matrix real inputs

    • qhmath_tan_af

  • Scalar, vector, and matrix complex inputs

    • mw_qhcomplex_ctan_f

asin
  • Input must be a scalar, vector or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_asin_f

  • Vector, and matrix real inputs

    • qhmath_asin_af

  • Scalar complex inputs

    • mw_qhcomplex_casin_f

  • Vector and matrix complex inputs

    • mw_qhcomplex_casin_af

acos
  • Input must be a scalar, vector or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_acos_f

  • Vector, and matrix real inputs

    • qhmath_acos_af

  • Scalar complex inputs

    • mw_qhcomplex_cacos_f

  • Vector and matrix complex inputs

    • mw_qhcomplex_cacos_af

atan
  • Input must be a scalar, vector or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_atan_f

  • Vector and matrix real inputs

    • qhmath_atan_af

  • Scalar complex inputs

    • mw_qhcomplex_catan_f

  • Vector and matrix complex inputs

    • mw_qhcomplex_catan_af

sinh
  • Input must be a scalar, vector or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_asinh_f

  • Vector and matrix real inputs

    • qhmath_asinh_af

  • Scalar complex inputs

    • mw_qhcomplex_csinh_f

  • Vector and matrix complex inputs

    • mw_qhcomplex_csinh_af

cosh
  • Input must be a scalar, vector or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_acosh_f

  • Vector and matrix real inputs

    • qhmath_acosh_af

  • Scalar complex inputs

    • mw_qhcomplex_ccosh_f

  • Vector and matrix complex inputs

    • mw_qhcomplex_ccosh_af

tanh
  • Input must be a scalar, vector, or matrix

  • Real and complex values

-
  • Scalar real inputs

    • qhmath_ctanh_f

  • Vector and matrix real inputs

    • qhmath_ctanh_af

  • Scalar complex inputs

    • mw_qhcomplex_ctanh_f

  • Vector and matrix complex inputs

    • mw_qhcomplex_ccosh_af

Hypotenuse
  • Input must be a scalar real value

-
  • Scalar real inputs

    • qhmath_hypot

See Also

Topics