Collect Coverage for Code
Measure coverage for code in model elements or generated from models
Simulink® Coverage™ measures code coverage and indicates the untested elements of your design. You can collect coverage for the C/C++ code in supported model elements, MATLAB® Function blocks, or the code generated from models in software-in-the-loop (SIL) mode or processor-in-the-loop (PIL) mode. Simulink Coverage measures several types of code coverage analysis, such as statement, condition, decision, and modified condition/decision coverage.
Code Coverage Basics
- Types of Code Coverage
Perform several types of code coverage analysis for the code within supported Simulink elements or for code generated from models in SIL mode or PIL mode.
- Specify Code Coverage Options
Set options for code coverage.
Coverage for MATLAB Code Used in Simulink
- Model Coverage for MATLAB Functions
Use model coverage for MATLAB Function blocks and interpret the results.
- Coverage for MATLAB Function Blocks
This example explains how Model Coverage relates to MATLAB® code inside a MATLAB Function Block.
Coverage for Integrated C/C++ Code
- Coverage for Models with Code Blocks and Simulink Blocks
Record coverage for models with a combination of code blocks and other Simulink blocks.
- Coverage for Custom C/C++ Code in Simulink Models
Analyze model coverage for C/C++ S-Functions.
- View Coverage Results for Custom C/C++ Code in S-Function Blocks
View coverage results for the C/C++ code in S-Function blocks in your model.
Coverage for Generated Code
- Code Coverage for Models in Software-in-the-Loop (SIL) Mode and Processor-in-the-Loop (PIL) Mode
Configure code coverage for SIL and PIL simulations and review results.
- View and Filter Code Coverage Results Using the Code Pane
This example shows how to view code coverage results and justify code coverage outcomes directly from the Code pane in Simulink®.