Main Content

Supported Simulink Blocks with CMSIS Library for ARM Cortex-A Processors

The Embedded Coder® Support Package for ARM® Cortex®-A Processors provides a code replacement library (CRL) ARM Cortex-A CMSIS to generate calls to CMSIS-DSP library optimized for ARM Cortex-A processors.

For more information on CMSIS-DSP library, see https://github.com/ARM-software/CMSIS-DSP.

To improve the speed of your models and performance of the generated code, you can set the model configuration parameters under the Code Generation>Optimization category. For more information on how to set the model parameters, see Model Configuration Parameters: Code Generation Optimization.

Note

  • ARM Cortex-A CMSIS CRL supports both 32 bit and 64 bit ARM Cortex-A architectures.

  • Only 64 bit ARM Cortex-A architectures support the half data type.

  • If you encounter situations where the ARM Cortex-A CMSIS CRL does not provide code replacements due to the input vector length being below the threshold, you can enable CMSIS function generation for all input lengths. To do this, set the environment variable DISABLE_ARMCORTEXA_CMSIS_CRL_THRESHOLDS to true using the following command:

    setenv('DISABLE_ARMCORTEXA_CMSIS_CRL_THRESHOLDS',true)

Basic Math Operations

OperationWrappers calling CMSIS FunctionSupported data typesInput/Output specificationsParameter specificationsReplaced Simulink® block
Elementwise real addition
  • mw_arm_add_f64

  • mw_arm_add_f32

  • mw_arm_add_f16

  • mw_arm_add_q31

  • mw_arm_add_q15

  • mw_arm_add_q7

  • double

  • single

  • half

  • fixdt(true,32,*)

  • fixdt(true,16,*)

  • fixdt(true,8,*)

  • Vector

  • Matrix

  • Both input and output must have same word length.

  • Both inputs must be of the same data type.

-Sum
Real vector offset
  • mw_arm_offset_f64

  • mw_arm_offset_f32

  • mw_arm_offset_f16

  • mw_arm_offset_q31

  • mw_arm_offset_q15

  • mw_arm_offset_q7

Elementwise real subtraction
  • mw_arm_sub_f64

  • mw_arm_sub_f32

  • mw_arm_sub_f16

  • mw_arm_sub_q31

  • mw_arm_sub_q15

  • mw_arm_sub_q7

  • double

  • single

  • half

  • fixdt(true,32,*)

  • fixdt(true,16,*)

  • fixdt(true,8,*)

  • Vector

  • Matrix

  • Both input and output must have same word length.

  • Both inputs must be of the same datatype.

-Sum
Elementwise real multiplication
  • mw_arm_mult_f64

  • mw_arm_mult_f32

  • mw_arm_mult_f16

  • mw_arm_mult_q31

  • mw_arm_mult_q15

  • mw_arm_mult_q7

  • double

  • single

  • half

  • fixdt(true,32,*)

  • fixdt(true,16,*)

  • fixdt(true,8,*)

  • Vector

  • Matrix

  • Both input and output must have same word length.

  • Ensure that inputs with floating-point data types, such as double, single, or half, are of the same type.

  • For fixed-point inputs, both the inputs must be of equal word length.

  • For inputs of type, fixdt(true,32,L1) and fixdt(true,32,L2), the output will be of type fixdt(true,32,L1+L2-31)

  • For inputs of type, fixdt(true,16,L1) and fixdt(true,16,L2), the output can be of type fixdt(true,16,L1+L2-15).

  • For inputs of type, fixdt(true,8,L1) and fixdt(true,8,L2), the output can be of type fixdt(true,8,L1+L2-7).

-Product, Matrix Multiply
Real vector scale
  • mw_arm_scale_f64

  • mw_arm_scale_f32

  • mw_arm_scale_f16

  • mw_arm_scale_q31

  • mw_arm_scale_q15

  • mw_arm_scale_q7

  • Set the Multiplication parameter in the Gain block to Matrix(K*u).

  • The Gain parameter value of the Gain must be a scalar

Gain
Real absolute
  • mw_arm_abs_f64

  • mw_arm_abs_f32

  • mw_arm_abs_f16

  • mw_arm_abs_q31

  • mw_arm_abs_q15

  • mw_arm_abs_q7

  • double

  • single

  • half

  • fixdt(true,32,31)

  • fixdt(true,16,15)

  • fixdt(true,8,7)

  • Vector

  • Matrix

  • Both input and output must have same word length.

-Abs
Real dot product
  • mw_arm_dot_prod_f64

  • mw_arm_dot_prod_f32

  • mw_arm_dot_prod_q31

  • mw_arm_dot_prod_q15

  • mw_arm_dot_prod_q7

  • double

  • single

  • fixdt(true,32,*)

  • fixdt(true,16,*)

  • fixdt(true,8,*)

  • Vector

  • Both input and output must have same word length.

fixed-point real dot product:

  • For inputs of type, fixdt(true,32,L1) and fixdt(true,32,L2), the output will be of type fixdt(true,64,L1+L2-14)

  • For inputs of type, fixdt(true,16,L1) and fixdt(true,16,L2), the output can be of type fixdt(true,64,L1+L2), fixdt(true,32,L1+L2-6), or fixdt(true,16,L1+L2-18).

-Dot Product
Vector log real
  • mw_arm_vlog_f64

  • mw_arm_vlog_f32

  • double

  • single

  • Scalar

  • Vector

  • Matrix

  • Both input and output must have same word length.

Set the Function parameter of Math Function to log.

Math Function
Vector exponential real
  • mw_arm_vexp_f64

  • mw_arm_vexp_f32

  • mw_arm_vexp_f16

  • double

  • single

  • half

  • Scalar

  • Vector

  • Matrix

  • Both input and output must have same word length.

Set the Function parameter of Math Function block to exp.

Math Function
Saturate
  • mw_arm_clip_f32

  • mw_arm_clip_q31

  • mw_arm_clip_q15

  • mw_arm_clip_q7

  • single

  • fixdt(true,32,31)

  • fixdt(true,16,15)

  • fixdt(true,8,7)

  • Vector

  • Matrix

  • Real inputs

  • Both input and output must have same word length.

  • For fixed-point data type, the lower limit and higher limit data type must match.

  • Upper and lower limits of the Saturation block must be scalar values.

  • The fraction length of input, upper limit, and lower limit can be different.

Saturation

Complex Math Operations

OperationWrappers calling CMSIS FunctionSupported data typesInput/Output specificationsParameter specificationsReplaced Simulink block
Complex dot product
  • mw_arm_cmplx_dot_prod_f32

  • single

  • Vector and matrix

  • Complex inputs

-Dot Product
Complex-by-complex multiplication
  • mw_arm_cmplx_mult_cmplx_f64

  • mw_arm_cmplx_mult_cmplx_f32

  • double

  • single

  • Vector and matrix

  • Both inputs must be complex

Product, Matrix Multiply
Complex-by-real multiplication or real-by-complex multiplication
  • mw_arm_cmplx_mult_real_f32

  • mw_arm_real_mult_cmplx_f32

  • single

  • Vector and matrix

  • Real and complex inputs

  • One input must be real and the other input must be complex

Product, Matrix Multiply

Matrix Operations

OperationFunction NameSupported Data TypesInput/Output SpecificationsParameter specificationsReplaced Simulink block
Matrix-by-vector multiplicationneon_mv_mul_u8x16uint8
  • Vector and matrix

  • Number of rows and columns of first input must be a multiple of 16 to get code replacement.

  • Number of rows of second input must be a multiple of 16 to get code replacement.

-Product, Matrix Multiply
neon_mv_mul_u16x8uint16
  • Vector and matrix

  • Number of rows and columns of first input must be a multiple of 8 to get code replacement.

  • Number of rows of second input must be a multiple of 8 to get code replacement.

neon_mv_mul_u32x4uint32
  • Vector and matrix

  • Number of rows and columns of first input must be a multiple of 4 to get code replacement.

  • Number of rows of second input must be a multiple of 4 to get code replacement.

Matrix-by-matrix multiplicationneon_mm_mul_u16x8uint16
  • Matrix

  • Number of rows and columns of first and second input must be a multiple of 8 to get code replacement.

neon_mm_mul_u32x4uint32
  • Matrix

  • Number of rows and columns of first and second input must be a multiple of 4 to get code replacement.