主要内容

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

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

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

To improve the speed of your models and the performance of the generated code, you can set the model configuration parameters under Code Generation > Optimization. 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.

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

    setenv('DISABLE_ARMCORTEXA_CMSIS_CRL_THRESHOLDS','true')

    To generate optimized code, thresholds are introduced . Forcing CMSIS function generation for all input lengths using this command can degrade performance.

Basic Math Operations

OperationWrappers Calling CMSIS FunctionSupported Data TypesInput/Output SpecificationsParameter SpecificationsReplaced Simulink® Block
Element-wise 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 the 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

Element-wise 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 the same word length.

  • Both inputs must be of the same data type.

-Sum
Element-wise 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 the 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 is 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 value of Gain parameter 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 the 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 the 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 the same word length.

Set the Function parameter of Math Function block 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 the 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 the same word length.

  • For the 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

OperationWrappers Calling CMSIS FunctionSupported Data TypesInput/Output SpecificationsParameter specificationsReplaced Simulink Block
Matrix multiplication
  • mw_arm_mat_mult_f64

  • mw_arm_mat_mult_f32

  • mw_arm_mat_mult_q15

  • mw_arm_mat_mult_q7

  • double

  • single

  • fixdt(true,16,*)

  • fixdt(true,8,*)

  • Matrix

  • Real inputs

-Product, Matrix Multiply
Complex matrix multiplication
  • mw_arm_cmplx_mat_mult_f32

  • mw_arm_cmplx_mat_mult_q15

  • single

  • fixdt(true,16,*)

  • Matrix

  • Complex inputs

-Product, Matrix Multiply
Matrix transpose
  • mw_arm_mat_trans_f64

  • mw_arm_mat_trans_f32

  • mw_arm_mat_trans_f16

  • mw_arm_mat_trans_q31

  • mw_arm_mat_trans_q15

  • mw_arm_mat_trans_q7

  • double

  • single

  • half

  • fixdt(true,32,*)

  • fixdt(true,16,*)

  • fixdt(true,8,*)

  • Matrix

  • Real inputs

-Transpose
Complex matrix transpose
  • mw_arm_mat_cmplx_trans_f32

  • mw_arm_mat_cmplx_trans_q31

  • mw_arm_mat_cmplx_trans_q15

  • single

  • fixdt(true,32,*)

  • fixdt(true,16,*)

  • Matrix

  • Complex inputs

-Transpose
Matrix-by-vector multiplicationneon_mv_mul_u8x16uint8
  • Vector and matrix

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

  • Number of rows in 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 in first input must be a multiple of 8 to get code replacement.

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

neon_mv_mul_u32x4uint32
  • Vector and matrix

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

  • Number of rows in 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 in first and second input must be a multiple of 8 to get code replacement.

neon_mm_mul_u32x4uint32
  • Matrix

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

See Also