DSP Blockset |
 |
Code Generation Support
ANSI C Code Generation Support
You can generate ANSI C code from DSP Blockset blocks by using Real-Time Workshop (RTW) or Real-Time Workshop Embedded Coder. All DSP Blockset blocks support the following code generation targets:
- Generic real-time (GRT) -- In Real-Time Workshop
- Embedded real-time (ERT) -- In Real-Time Workshop Embedded Coder
The following topics provide more information on ANSI C code generation support:
Highly Optimized Generated C Code
All DSP Blockset blocks generate highly optimized ANSI C code. This C code is often suitable for use in real-time embedded processors, and include the following optimizations:
- Function reuse (run-time libraries) -- The generated code reuses common algorithmic functions via calls to run-time functions. Run-time functions are highly optimized ANSI C functions that implement core algorithms such as FFT and convolution. Run-time functions are precompiled into ANSI C run-time libraries, and enable the blocks to generate smaller, faster code that requires less RAM.
- Parameter reuse (RTW run-time parameters) -- In many cases, if there are multiple instances of a block that all have the same value for a specific parameter, each block instance points to the same variable in the generated code. This reduces memory requirements.
- Blocks have parameters for code optimization -- Various blocks provide parameters for specifying whether to optimize the generated code for memory or for speed (these optimizations also affect simulation). For example, the FFT and Sine Wave blocks provide this capability.
- Other optimizations -- Use of contiguous input and output arrays, reusable inputs, overwritable arrays, and in-place algorithms provide smaller generated C code that is more efficient at run-time.
Related C Code Generation Topics
To learn more about ANSI C code generation, see the following related documentation:
- Real-Time Workshop documentation -- How to use Real-Time Workshop to generate code from Simulink models
- Real-Time Workshop Embedded Coder documentation -- How to use Real-Time Workshop Embedded Coder to generate code from Simulink models
- The topic on run-time parameters in the Simulink Writing S-Function documentation -- How run-time parameters aid in generation of better C code
| Steps to Disabling Boolean Support | | Configuring Simulink for DSP Systems |  |