Main Content

Conditions for Code Replacement of Math Functions with HVX

Each math 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 Hexagon Vector Extension (HVX). You use this code replacement when generating C/C++ code from a model or from MATLAB® code.

If you do not meet the specific requirements, then the generated C/C++ code runs on the Qualcomm Hexagon Processors. However, this generated code does not use library support.

The library supports these Math functions only when you set specific properties, as indicated in this table:

FunctionInput RequirementsParameter RequirementsEquivalent Functions
sin
  • Vector or matrix

  • Real values

 
  • qhmath_hvx_sin_af

cos
  • Vector or matrix

  • Real values

 
  • qhmath_hvx_cos_af

sqrt
  • Vector or matrix

  • Real values

Length should be ≥ 4

  • qhmath_hvx_sqrt_af

rsqrt (Fixed-Point Designer)
  • Vector or matrix

  • Real values

 
  • qhmath_hvx_rsqrt_af

log
  • Vector or matrix

  • Real values

 
  • qhmath_hvx_log_af

log2
  • Vector or matrix

  • Real values

 
  • qhmath_hvx_log2_af

log10
  • Vector or matrix

  • Real values

 
  • qhmath_hvx_log10_af

asin

For MATLAB and row-major of Simulink block

  • Vector or matrix

  • Real values

 
  • qhmath_hvx_asin_af

acos

For MATLAB and row-major of Simulink block

  • Vector or matrix

  • Real values

 
  • qhmath_hvx_acos_af

atan
  • Vector or matrix

  • Real values

 
  • qhmath_hvx_atan_af

sinh
  • Vector or matrix

  • Real values

 
  • qhmath_hvx_sinh_af

cosh
  • Vector or matrix

  • Real values

 
  • qhmath_hvx_cosh_af

tanh
  • Vector or matrix

  • Real values

 
  • qhmath_hvx_tanh_af

exp
  • Vector or matrix

  • Real values

 
  • qhmath_hvx_exp_af

power
  • Vector or matrix

  • Real values

 
  • qhmath_hvx_pow_af

tan
  • Vector or matrix

  • Real value

 
  • qhmath_hvx_tan_af

hypot
  • Vector or matrix

  • Real value

Length should be ≥ 25
  • qhmath_hvx_hypot_af

See Also

| |

Topics