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

Model Settings

expand all

Set Scope of Coverage Analysis

Enable coverage analysisAnalyze coverage
Scope of coverage analysisSet scope of coverage analysis
Select ModelsSelect models to include in coverage analysis
Select SubsystemSelect subsystem to include in coverage analysis
Include in analysis: MATLAB filesEnable coverage for external MATLAB files
Include in analysis: C/C++ S-functionsAnalyze coverage for C/C++ S-Function blocks
Structural coverage levelTypes of coverage to analyze

Set Coverage Recording Interval

Restrict coverage recording intervalAnalyze coverage during a specific time interval
Coverage interval start timeSimulation time to begin coverage analysis
Coverage interval stop timeSimulation time to stop coverage analysis

Topics

Code Coverage Basics

Coverage for MATLAB Code Used in Simulink

Coverage for Integrated C/C++ Code

Coverage for Generated Code

Featured Examples