Contenuto principale

Conditions for Code Replacement of MATLAB Functions with HVX

R2026b

Each MATLAB® function 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 Vector eXtensions (HVX) library. 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 HVX support to achieve optimized execution on Qualcomm Hexagon processors.

HVX supports these MATLAB functions for floating-point data only when you configure the required properties, as specified in this table.

Basic Math Operations

FunctionInput RequirementsProperty RequirementsEquivalent Functions
sqrt
  • Input must be a vector or matrix

  • Real value

Length must be ≥ 4

  • qhmath_hvx_sqrt_af

rsqrt (Fixed-Point Designer)
  • Input must be a vector or matrix

  • Real value

-
  • qhmath_hvx_rsqrt_af

log
  • Input must be a vector or matrix

  • Real value

-
  • qhmath_hvx_log_af

log2
  • Input must be a vector or matrix

  • Real value

-
  • qhmath_hvx_log2_af

log10
  • Input must be a vector or matrix

  • Real value

-
  • qhmath_hvx_log10_af

exp
  • Input must be a vector or matrix

  • Real value

-
  • qhmath_hvx_exp_af

power
  • Input must be a vector or matrix

  • Real value

-
  • qhmath_hvx_pow_af

Trigonometric Operations

FunctionInput RequirementsProperty RequirementsEquivalent Functions
sin
  • Input must be a vector or matrix

  • Real value

-
  • qhmath_hvx_sin_af

cos
  • Input must be a vector or matrix

  • Real value

-
  • qhmath_hvx_cos_af

asin

For MATLAB and row-major of Simulink block

  • Input must be a vector or matrix

  • Real value

-
  • qhmath_hvx_asin_af

acos

For MATLAB and row-major of Simulink block

  • Input must be a vector or matrix

  • Real value

-
  • qhmath_hvx_acos_af

atan
  • Input must be a vector or matrix

  • Real value

-
  • qhmath_hvx_atan_af

sinh
  • Input must be a vector or matrix

  • Real value

-
  • qhmath_hvx_sinh_af

cosh
  • Input must be a vector or matrix

  • Real value

-
  • qhmath_hvx_cosh_af

tanh
  • Input must be a vector or matrix

  • Real value

-
  • qhmath_hvx_tanh_af

tan
  • Input must be a vector or matrix

  • Real value

-
  • qhmath_hvx_tan_af

hypot
  • Input must be a vector or matrix

  • Real value

Length must be ≥ 25
  • qhmath_hvx_hypot_af

Fourier Transform Operations

FunctionInput RequirementsOutput RequirementsInput AlignmentOutput AlignmentProperty RequirementsEquivalent Functions
fft

  • Input must be real

  • Supports input sizes that are powers of 2, starting from 64.

  • Output must be complex

128128

Note

To enable code replacement, use the syntax fft(x). The code generator replaces only this form with a HVX implementation.

If you specify additional inputs such as n or dim (for example, fft(X,n) or fft(X,n,dim)), the code generator generates the default plain C code.

mw_qhdsp_hvx_r1dfft_af_builtin

fft

  • Input must be complex

  • Supports input sizes that are powers of 2, starting from 64.

  • Output must be complex

128128mw_qhdsp_hvx_c1dfft_af_opt_builtin
ifft
  • Input must be complex

  • Supports input sizes that are powers of 2, starting from 32.

  • Output must be complex

128128

Note

To enable code replacement, use the syntax ifft(x). The code generator replaces only this form with a HVX implementation.

If you specify additional inputs such as n or dim (for example, ifft(X,n) or ifft(X,n,dim)), the code generator generates the default plain C code.

mw_qhdsp_hvx_c1difft_af_builtin

See Also

Topics