Using Simulink | ![]() ![]() |
The Coverage Settings dialog box allows you to select model coverage reporting options. The dialog box includes the following panes.
Coverage Pane
Enable Coverage Reporting. Causes Simulink to gather and report model coverage data during simulation.
Coverage Instrumentation Path. Path of the subsystem for which Simulink gathers and reports coverage data. By default, Simulink generates coverage data for the entire model.
To restrict coverage reporting to a particular subsystem, select Browse. Simulink displays a System Selector dialog.
Select the subsystem for which you want coverage reporting to be enabled. Click OK to dismiss the dialog.
Coverage Metrics. Select the types of test case coverage analysis that you want the tool to perform. See Coverage Analysis for more information.
Results Pane
Save cumulative results in workspace variable. If checked, this option causes the Model Coverage tool to accumulate and save the cumulative coverage results of successive simulations in the workspace variable specified in the cvdata object name field below.
Save last run in workspace variable. If checked, this option causes the Model Coverage tool to save the results of the last simulation run in the workspace variable specified in the cvdata object name field below.
Increment variable name with each simulation. If selected, this option causes Simulink to increment the name of the coverage data object variable used to save the last run with each simulation. This prevents the current simulation run from overwriting the results of the previous run.
Report Pane
Generate HTML report. Causes Simulink to create an HTML report containing the coverage data. Simulink displays the report in the MATLAB Help browser at the end of the simulation. Click the Setting button to select various reporting options (see HTML Settings).
Cumulative Runs. Accumulate and display coverage results from successive simulations in the report. The report is organized so that you can easily compare the additional coverage from the most recent run with the coverage from all prior runs in the session.
Cumulative coverage results can persist between MATLAB sessions by using cvsave
to save results at the end of the session and cvload
to load results at the beginning of the session. Note that the cvload
parameter RESTORETOTAL
must be 1
in order to restore cumulative results.
Calculating cumulative coverage results is also possible at the command line via the +
operator. The following script demonstrates this usage:
Last Run. Display only the results of the previous simulation run in the report.
Additional data to include in report. Names of coverage data from previous runs to include in the current report along with the current coverage data. Each entry causes a new set of columns to appear in the report.
Options Pane
Treat Simulink Logic blocks as short-circuited. Applies only to Condition and MC/DC coverage. If enabled, coverage analysis treats Simulink logic blocks as though they short-circuit their input. In other words, Simulink treats such a block as if the block ignores remaining inputs if the previous inputs alone determine the block's output. For example, if the first input to an And
block is false, MC/DC coverage analysis ignores the values of the other inputs in determining MC/DC coverage for a test case. You should select this option if you plan to generate code from a model and want the MC/DC coverage analysis to approximate the degree of coverage that your test cases would achieve for the generated code (most high-level languages short-circuit logic expressions). Note that a test case that does not achieve full MC/DC coverage for a non-short-circuited logic expressions might, in fact, achieve full coverage for short-circuited expressions.
Warn when unsupported blocks exist in a model. Select this option if you want the tool to warn you at the end of the simulation if the model contains blocks that require coverage analysis but are not currently covered by the tool.
Disable coverage for blocks used in assertion checks. Disable coverage of blocks from Simulink's Model Verification library (see Model Verification).
![]() | The Coverage Report | HTML Settings | ![]() |