Code Generation
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
MATLAB Coder
Generate C and C++ code from MATLAB code
Embedded Coder
Generate C and C++ code optimized for embedded systems
HDL Coder
Generate Verilog, SystemVerilog, and VHDL code for FPGA and ASIC designs
HDL Verifier
Find RTL bugs and generate testbenches for ASICs or FPGAs
Fixed-Point Designer
Model and optimize fixed-point and floating-point algorithms
GPU Coder
Generate CUDA code for NVIDIA GPUs
Simulink Coder
Generate C and C++ code from Simulink and Stateflow models
DDS Blockset
Design and simulate DDS applications
AUTOSAR Blockset
Design and simulate AUTOSAR software
C2000 Microcontroller Blockset
Design, simulate, and implement applications for Texas Instruments C2000 microcontrollers
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
Automate and manage source code reviews for safety standards
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
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 Deployable Standalone Code by Using the MATLAB Coder App (MATLAB Coder)
Follow the steps of the code generation workflow to generate a standalone C++ dynamic linked library.
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: - Generate and Synthesize HDL Code for Symmetric FIR Filter Using the HDL Workflow Advisor (HDL Coder)
This example shows you how to create an HDL Coder™ project and use the MATLAB HDL Workflow Advisor to generate code from a MATLAB® design, verify the MATLAB design with an HDL test bench, and synthesize the generated 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 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.
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 the 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.





