Main Content

Collect Coverage for Models

Measure coverage for models, identify untested elements of your design

Collect coverage during simulation to measure which elements in your model or Stateflow® charts are tested. Simulink® Coverage™ measures several types of coverage, such as execution, decision, condition, and modified condition/decision coverage. The most basic coverage level determines whether an item executes during simulation, while more extensive coverage levels determine whether individual logical conditions are fully exercised and independently affect the output of logical expressions.

Functions

expand all

simRun and script programmatic simulations of Simulink models
cvtestCreate model coverage test specification object
cvsimSimulate and return model coverage results for test objects
cvdataAccess Simulink Coverage data in the MATLAB workspace
cvexitExit coverage environment
parsimSimulate dynamic system multiple times in parallel or serial
slvnvlogsignalsLog test data for component or model during simulation
slvnvmergedataCombine test data from data files
slvnvmakeharnessGenerate Simulink Coverage harness model
slvnvharnessoptsGenerate default options for slvnvmakeharness
slvnvmergeharnessCombine test data from harness models
slvnvruntestSimulate model by using input data
slvnvruncgvtestUse Code Generation Verification (CGV) API to execute model
slvnvruntestoptsGenerate simulation or execution options for slvnvruntest or slvnvruncgvtest
slvnvextractExtract atomic subsystem or subchart contents into new model

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
Exclude inactive choices of variantsExclude inactive choices of variants (Since R2022a)

Select Coverage Metrics

Structural coverage levelTypes of coverage to analyze
Lookup tableEnable lookup table coverage
Signal rangeEnable signal range coverage
Signal sizeEnable signal size coverage
Objectives and constraintsEnable objectives and constraints coverage
Saturation on integer overflowEnable saturation on integer overflow coverage
Relational boundaryEnable relational boundary coverage
Relational boundary coverage absolute toleranceRelational boundary coverage absolute tolerance
Relational boundary coverage relative toleranceRelational boundary coverage relative tolerance
MCDC modeModified condition decision coverage analysis mode

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

Override Simulink Optimizations

Force block reduction offAnalyze coverage for every supported block in model
Treat Simulink logic blocks as short-circuitedUse logical short-circuiting during coverage analysis

Set Coverage Simulation Options

Warn when unsupported blocks exist in modelDisplay a warning if Simulink Coverage detects unsupported blocks
Update coverage results on pauseUpdate coverage results on pause

Topics

Model Coverage Definitions

Using Model Coverage

Model Coverage for Stateflow Charts

Featured Examples