Collect Coverage for Code - MATLAB & Simulink (original) (raw)

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

slcovmex Build coverage-compatible MEX-function from C/C++ code
cvtest Create model coverage test specification object
cvsim Simulate and return model coverage results for test objects

Model Settings

expand all

Set Scope of Coverage Analysis

Enable coverage analysis Analyze coverage
Scope of coverage analysis Set scope of coverage analysis
Select Models Select models to include in coverage analysis
Select Subsystem Select subsystem to include in coverage analysis
Include in analysis: MATLAB files Enable coverage for external MATLAB files
Include in analysis: C/C++ S-functions Analyze coverage for C/C++ S-Function blocks
Structural coverage level Types of coverage to analyze

Set Coverage Recording Interval

Restrict coverage recording interval Analyze coverage during a specific time interval
Coverage interval start time Simulation time to begin coverage analysis
Coverage interval stop time Simulation time to stop coverage analysis

Topics

Code Coverage Basics

Coverage for Integrated C/C++ Code

Coverage for Generated Code

Software-in-the-Loop Code Coverage

Software-in-the-Loop Code Coverage

Collect code coverage metrics from a model reference using software-in-the-loop (SIL) mode.

Collect Code Coverage Metrics with Simulink Coverage

Collect code coverage metrics.

Use Justification Rules to Filter Code Coverage Outcomes

Use Justification Rules to Filter Code Coverage Outcomes

Filter code coverage outcomes in the coverage report after collecting coverage for a model in software-in-the-loop (SIL) or processor-in-the-loop (PIL) mode.

Coverage for S-Functions

Coverage for S-Functions

Configure an S-Function generated with the Legacy Code Tool to be compatible with coverage. The model coverage tool supports S-Functions that are: