代码生成
借助 MathWorks® 产品的代码生成功能,您可以从 MATLAB® 代码或 Simulink® 模型中生成代码。与手动编写成千上万行代码相比,这样做可以提高工作效率和代码质量。您可以为信号处理、工业控制、嵌入式视觉和深度学习等应用生成代码。生成 C、C++、CUDA®、Verilog®、VHDL® 和 PLC 代码,或为 AUTOSAR 或 DDS 等中间件架构和标准生成代码。要使您的代码获得认证,请根据 ISO26262 和 DO-178C 等标准验证代码。
适用产品: 代码生成
MATLAB Coder
从 MATLAB 代码生成 C 和 C++ 代码
Embedded Coder
生成针对嵌入式系统优化的 C 和 C++ 代码
HDL Coder
为 FPGA 和 ASIC 设计生成 Verilog、SystemVerilog 和 VHDL 代码
HDL Verifier
Find RTL bugs and generate testbenches for ASICs or FPGAs
Fixed-Point Designer
定点和浮点算法的建模和优化
GPU Coder
Generate CUDA code for NVIDIA GPUs
Simulink Coder
从 Simulink 和 Stateflow 模型中生成 C 和 C++ 代码
DDS Blockset
Design and simulate DDS applications
AUTOSAR Blockset
设计和仿真 AUTOSAR 软件
C2000 Microcontroller Blockset
设计、仿真和实现适用于 Texas Instruments C2000 微控制器的应用程序
STM32 Microcontroller Blockset
Design, simulate, and implement applications for STMicroelectronics STM32 microcontrollers
Raspberry Pi Blockset
Design, simulate, and deploy applications for Raspberry Pi.
Simulink PLC Coder
Generate IEC 61131-3 Structured Text and Ladder Diagrams for PLCs and PACs
Simulink Code Inspector
自动化并管理源代码审查以满足安全标准
DO Qualification Kit
Qualify Simulink and Polyspace verification tools for DO-178, DO-278, and DO-254
IEC Certification Kit
Qualify software tools for ISO 26262 and IEC 61508 certification
主题
C/C++ 代码生成
- 使用 Embedded Coder 生成代码 (Embedded Coder)
MathWorks 代码生成技术为算法生成 C 或 C++ 代码和可执行程序。您可以通过使用 MATLAB 以编程方式编写算法,或在 Simulink 环境中以图形方式编写算法。您可以为 MATLAB 函数和 Simulink 模块生成对实时和嵌入式应用程序很有用的代码。为浮点算法生成的源代码和可执行程序与 MATLAB 代码执行和 Simulink 仿真的功能行为的匹配度非常高。使用 Fixed-Point Designer 产品,您可以生成与模型仿真结果按位匹配的定点代码。代码生成之所以能实现如此广泛的支持和高度的准确性,是因为它紧密集成了 MATLAB 和 Simulink 的执行引擎和仿真引擎。Simulink 中内置的加速仿真模式就使用了代码生成技术。 - 部署用于实时快速原型的算法模型 (Simulink Coder)
部署用于实时测试的算法模型。 - 使用 MATLAB Coder 生成 C 代码 (MATLAB Coder)
使用 MATLAB Coder™ 从示例 MATLAB 函数生成 C 代码。
HDL 代码生成
- Generate Code and Synthesize on FPGA Using HDL Workflow Advisor (HDL Coder)
The HDL Workflow Advisor guides you through the stages of generating HDL code for a Simulink subsystem and the FPGA design process, such as: - 从 MATLAB 进行基本 HDL 代码生成和 FPGA 综合 (HDL Coder)
此示例说明如何创建一个 HDL Coder™ 工程,为您的 MATLAB® 设计生成代码,并综合 HDL 代码。在此示例中,您将: - Verify HDL Design Using SystemVerilog DPI Test Bench (HDL Coder)
This example shows how to use SystemVerilog DPI test bench for verification of HDL code where a large data set is required.
GPU 代码生成
- Generate Code by Using the GPU Coder App (GPU Coder)
Generate CUDA code from MATLAB code by using the GPU Coder™ app. - Code Generation from Simulink Models with GPU Coder (GPU Coder)
Generate CUDA code from Simulink models by using GPU Coder. - Code Generation for Deep Learning Networks (GPU Coder)
Get started with CUDA code generation for image classification networks such asResNet.
PLC 代码生成
- Generating Ladder Diagram Code from Simulink (Simulink PLC Coder)
Generate Ladder Diagram code (L5X) from Simulink. - Generate Structured Text Code for a Simple Simulink Subsystem (Simulink PLC Coder)
This example shows how to select a target IDE for a Simulink® model, generate IEC 61131-10 code, and view the generated files. - Model, Simulate, and Generate Code for Ladder Logic-Based Elevator Controller (Simulink PLC Coder)
Rapidly prototype the ladder logic-based controller for a single car elevator by using Simulink® PLC Coder™ to model and simulate the ladder logic.
中间件架构的代码生成
- 生成 AUTOSAR C 代码和 XML 描述 (AUTOSAR Blockset)
从 AUTOSAR 组件模型生成符合 AUTOSAR 标准的 C 代码并导出 AUTOSAR XML (ARXML) 描述。 - 生成 AUTOSAR Adaptive C++ 代码和 XML 描述 (AUTOSAR Blockset)
从 AUTOSAR Adaptive 组件模型生成符合 AUTOSAR 标准的 C++ 代码并导出 AUTOSAR XML (ARXML) 描述。 - DDS Blockset Shapes Demo (DDS Blockset)
DDS Blockset implementation of the Shapes Demo.
认证和标准
- Highway Lane Following: A Model-Based Design Example for ISO 26262:2018 (IEC Certification Kit)
Demonstrates the use of Simulink to apply a Model-Based Design workflow to an ISO 26262 ASIL D project. - Helicopter Flight Control: A Model-Based Design Example for DO-178C and DO-331 (DO Qualification Kit)
Demonstrates the use of the DO-178C project template in a helicopter flight control project.





