Simulink 中的定点代码生成
优化定点模型的代码生成
通过使用 Simulink® Coder™ 或 Embedded Coder®,您可以用 Fixed-Point Designer™ 生成 C 代码。从定点模型生成的代码仅使用整数类型,并自动包括处理定点位置中的差异所需的所有运算,例如移位。您可以在嵌入式定点处理器或快速原型设计系统上使用生成的代码,即使它们包含浮点处理器也没问题。
将 Fixed-Point Designer 与 HDL Coder™ 结合使用时,您可以从 Simulink 模型、Stateflow® 图和 MATLAB Function 模块生成逐位精确的、可综合的 Verilog® 和 VHDL® 代码。
主题
高性能代码模型
- Lookup Table Optimization
Optimize lookup tables in your model to improve efficiency. - Selecting Data Types for Basic Operations
How to select efficient data types for basic fixed-point operations. - Fixed-Point Code Generation Support
Simulink features supported for fixed-point code generation. - Use Simplest Rounding for Efficient Generated Code
The simplest rounding mode attempts to reduce or eliminate the need for extra rounding code in your generated code using a combination of techniques.
整合 MATLAB 代码
- Control Data Types and Generate Code with MATLAB Function Block
Use data type override andfimathobjects with the MATLAB Function block. - Generate Fixed-Point FIR Code Using MATLAB Function Block
Create and generate code for a fixed-point, low-pass, direct form FIR filter.
使用模型顾问
- Optimize Generated Code with the Model Advisor
Use the Model Advisor to identify model settings that might lead to non-optimal results in code generation. - Net Slope Computation
Control how the software handles net slope computations in generated code.
自定义生成的代码
- Control the Generation of Fixed-Point Utility Functions
Control the generation of fixed-point utility functions using specified minimum and maximum values.
保持标准合规性
- Use of Shifts by C Code Generation Products
Understand the use of shifts by MathWorks® coder products including how to control the shifts using optimization settings in the configuration parameters as well as modeling techniques.
疑难解答
Targeting an Embedded Processor
Describes issues that arise when targeting a fixed-point design for use on an embedded processor.
仿真和代码生成支持的数据类型。



