Code Generation
Generate optimized C, C++, CUDA, Verilog, or VHDL that complies with
standards
With the code generation capabilities from MathWorks® products, you can generate code from MATLAB® code or Simulink® models. Instead of writing thousands of lines of code by hand, you can increase your productivity and improve the quality of your code. You can generate code for use in applications such as signal processing, industrial controls, embedded vision, and deep learning. Generate C, C++, CUDA®, Verilog®, VHDL®, and PLC code or generate code for middleware architecture and standards such as AUTOSAR or DDS. To qualify your code for certification, verify it against standards such as ISO26262 and DO-178C.
Products for Code Generation
Topics
C/C++ Code Generation
- Code Generation by Using Embedded Coder (Embedded Coder)
MathWorks code generation technology produces C or C++ code and executable programs for algorithms. - Deploy Algorithm Model for Real-Time Rapid Prototyping (Simulink Coder)
Deploy algorithm model for testing in real time. - Generate C Code by Using the MATLAB Coder App (MATLAB Coder)
Use the MATLAB Coder™ app to generate C code from an example MATLAB function.
HDL Code Generation
- 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: - Basic HDL Code Generation and FPGA Synthesis from MATLAB (HDL Coder)
This example shows how to create a HDL Coder™ project, generate code for your MATLAB® design, and synthesize the HDL code. - 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 Code Generation
- 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 Code Generation
- 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 the target IDE for a Simulink® model, generate IEC 61131-10 code, and view 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.
Code Generation for Middleware Architectures
- Generate AUTOSAR C Code and XML Descriptions (AUTOSAR Blockset)
Generate AUTOSAR-compliant C code and export AUTOSAR XML (ARXML) descriptions from AUTOSAR component model. - Generate AUTOSAR Adaptive C++ Code and XML Descriptions (AUTOSAR Blockset)
Generate AUTOSAR-compliant C++ code and export AUTOSAR XML (ARXML) descriptions from AUTOSAR adaptive component model. - DDS Blockset Shapes Demo (DDS Blockset)
DDS Blockset implementation of Shapes Demo.
Certification and Standards
- 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.