Main Content

Enhance Code Execution Speed in TI C2000 Simulink Applications

In this topic you will learn various optimization techniques for enhancing the execution speed of Simulink applications on TI C2000 devices. This topic also explains the configuration parameter adjustments in the code generation settings, such as choosing Faster Runs in the build configuration and enabling the TI C28x Code Replacement Library (CRL) for hardware-optimized functions.

You can also explore efficient code and data loading strategies, the selection of data types for precision and performance, and considerations for devices with or without Floating Point Units (FPU). Advanced optimization options and additional resources are also provided.

The following optimization techniques will help enhancing the execution speed of Simulink applications on TI C2000 devices.

  • Enhance Build Configuration: Navigate to Configuration Parameters > Code Generation > Build Configuration and select Faster Runs to compile your code with higher optimization, effectively reducing run-time.

  • Enable Code Replacement Library (CRL): Ensure optimal hardware functions by selecting TI C28x in Configuration Parameters > Code Generation > Interface > Code replacement library. This replaces functions like addition and multiplication with efficient hardware-optimized counterparts.

  • Optimize Code/Data Loading: Improve processing speed by loading code/data in runtime from flash to RAM. For more information, see https://in.mathworks.com/matlabcentral/answers/673963-how-do-i-load-data-code-to-flash-and-run-from-ram-on-a-ti-c2000-device.

  • Inlined Parameter Behavior: Boost performance by changing Configuration Parameters > Code Generation > Optimization > Default parameter behavior to Inlined, optimizing default parameter behavior.

  • Data Type Optimization: Choose single datatype over double for precision. Also, investigate the signal data types and use the minimum required wherever possible. For example, if the variable Counter can take values between 0 and 130, a 16bit integer datatype would serve the purpose rather than double or single.

  • Fixed-Point Math Optimization: On devices without Floating Point Unit (FPU) support, avoid float operations and choose Fixed Point math to reduce computation overhead.

  • Utilize CRL for Fixed-Point Models: For models using Fixed-Point math, the CRL replaces it with highly optimized TI IQ Math routines (see Enable Code Replacement Library (CRL)). Ensure no CRL misses due to rounding or saturation options.

  • Leverage FastRTS Library: On devices with FPU support, use optimized floating-point math functions from the FastRTS library. For devices with FPU but no Trigonometric Math Unit (TMU), consider enabling FastRTS support.

  • Enable TMU with FPU On devices supporting TMU along with FPU, Select Enable TMU for more optimized float math routines,compared to FastRTS and covers most of the routines as found in FastRTS.

  • Unlock Advanced Optimization Options: Explore advanced optimization options under Configuration Parameters > Code Generation > Optimization > Advanced parameters. Also, refer to C2000™ C28x Optimization Guide and C28x Code Generation Tips and Tricks for additional resource.

See Also

| |