When developing Simulink®您打算从中生成代码的模型,使用配置选项和优化来提高性能。这些选项减少了RAM和ROM的消耗,并加快了代码执行。如果您想要更多的防御代码,以某种效率为代价,则可以禁用其中一个或多个选项。
You can configure code execution profiling to determine whether the generated code meets the real-time requirements of your target hardware and code sections that require performance improvements. You can also use the Code Generation Advisor to check if a model’s current configuration is optimized for debugging or code execution.
Alter a model to increase the speed at which the code generator generates code.
Optimization Tools and Techniques
应用工具,例如模型顾问和技术来优化代码生成的模型。
在simulink UI级别上为您的makefile进行控制编译器优化。万博1manbetx
最大程度地减少由于亚正态数量计算延迟而导致的执行减速或超支的可能性。
If the input values in your application are in the range of the output type, remove code for out-of-range floating-point to integer conversions.
Remove Code That Maps NaN to Integer Zero
如果没有输入值的南
in your application, specify that the code generator remove code that maps南
到整数零。
使用代码替换库(CRL)自定义条目,以选择性地禁用数学功能和数学函数内部的非精彩检查。
Minimize Computations and Storage for Intermediate Results at Block Outputs
代码生成器将块计算折叠到单个表达式中,而不是为模型中每个块生成单独的代码语句和存储声明。
在可能的情况下,代码生成器将块输出声明为局部变量,因此它可以重复使用这些变量。
Model buses to maximize efficiency of the generated code.
Use the numerical values of invariant signals instead of their symbolic names in the generated code.
这code generator optimizes the generated code for vector assignments by replacing为了
loops withmemcpy
function calls.
Model buses to maximize efficiency of the generated code.
这code generator reduces stack memory by replacing temporary local arrays with local variables.
Reduce the amount of memory that stores state configuration variables andBoolean
变量。
Optimize Generated Code Using memset Function
这memset
清除内部存储函数,不管泰pe, to the integer bit pattern 0 (that is, all bits are off).
控制最大允许堆栈大小,以提供对数据是在生成代码中本地或全球定义的一定控制权。
Starting at a default value of 5, the code generator begins to use a为了
loop instead of separate statements to assign values to the elements of a signal or parameter array.
生成其浮点数据类型的代码仅是单个精度,例如,用于针对单精度处理器。
To generate more efficient code, match parameter data types with signal data types or store parameters in smaller data types.
这code generator optimizes the generated code by storing logical signals asBoolean
数据类型。
Optimize memory that the code generator allocates for elapsed time or absolute time.
Optimize Speed and Size of Signal Processing Algorithm by Using Fixed-Point Data
Model a fixed-point acoustic noise canceller.
Optimize Generated Code by Combining Multiple for Constructs
代码生成器使用数据依赖性分析来组合为了
构造以减少静态代码大小和运行时分支。
Starting at a default value of 5, the code generator begins to use a为了
loop instead of separate statements to assign values to the elements of a signal or parameter array.
这code generator eliminates dead (that is, unused) code paths from the generated code.
为了processors that support efficient multiplication, improve code efficiency by using floating-point multiplication to handle a net slope correction.
Remove Code for Blocks That Have No Effect on Computational Results
代码生成器通过删除不影响计算结果的代码来提高执行速度并降低ROM消耗。
Inline Numeric Values of Block Parameters
通过嵌入块参数的文字数值来减少全局RAM使用。
使用Simulink®,StateFlow®和MATLAB®优化生成的代码万博1manbetx
Generate fixed-point code in Simulink, Stateflow®, and MATLAB®。
自定义具有特定于目标的优化的生成算法代码。
Use Conditional Input Branch Execution
为了SwitchandMultiport Switch块,Simuli万博1manbetxnk仅执行计算控件输入和控件输入选择的数据输入的块。
Optimize Generated Code for Complex Signals
代码生成器对代表生成代码中信号的结构进行各种优化。
在MATLAB功能块中生成Lapack调用某些线性代数函数。指定要使用的拉帕克库。
Generate FFTW library calls for fast Fourier transforms in aMATLAB Function堵塞。指定FFTW库。
实现FFT库回调类方法,并提供支持的C代码,以防止同时访问FFTW计划。万博1manbetx
Control Memory Allocation for Variable-Size Arrays in a MATLAB Function Block
Disable dynamic memory allocation or specify a dynamic memory allocation threshold forMATLAB Functionblocks.