Main Content

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.

Functions

slcovmexBuild coverage-compatible MEX-function from C/C++ code
cvtestCreate model coverage test specification object
cvsimSimulate and return model coverage results for test objects

Topics

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

Coverage for MATLAB® Function Blocks

This example model 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.

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.

Featured Examples