Create, Edit, and View Coverage Filter Rules

Create and Edit Coverage Filter Rules

Create a Coverage Filter Rule

To create a coverage filter rule:

  1. In the Coverage pane of the Configuration Parameters dialog box, enable model coverage.

  2. To record coverage results, simulate the model.

  3. Create a new filter rule in one of two ways:

    • In the model window, right-click a model object and select Coverage > Exclude.

    • In the Details section of the Coverage Report, click Justify or Exclude for a model object.

Depending on which option you select, the Type field in the Coverage Filter Viewer is set for the coverage filter rule you selected. You cannot override the value in the Type field.

Select the Filtering Mode

When you create a filtering rule, the default filtering mode is Excluded. Excluded objects do not appear in the coverage reports. You can also set the filtering mode to Justified. Justified blocks appear as achieving 100% coverage.

For more information, see Coverage Filtering.

Add Rationale to a Coverage Filter Rule

Optionally, you can add text that describes why you exclude that object or objects from coverage recording. This information can be useful to others who review the coverage for your model. When you add a coverage filter rule, the Coverage Filter Viewer opens. To add the rationale:

  1. Double-click the Rationale field for the rule.

  2. Delete the existing text.

  3. Add the rationale for excluding this object.


The Rationale field and Mode field are the only coverage filter rule fields that you can edit in the Coverage Filter Viewer.

After you add a new coverage filter rule or edit an existing coverage filter rule, click Apply to enable the Generate report and Highlight model with coverage results links.

Justify Dead Logic from Simulink Design Verifier Dead Logic Analysis

You can create justification rules in the Coverage Results Explorer using the dead logic detected during a Simulink® Design Verifier™ Dead Logic Analysis.

  1. Open the Results Explorer from the Coverage app.

  2. Click Current Cumulative Data to access the coverage results for the current simulation and navigate to the Filter tab.

  3. Click Make justification filter rules for dead logic (using Simulink Design Verifier).

    Simulink Design Verifier runs the Dead Logic Analysis and populates the list of filters.

  4. Click Generate report.

    The justified rules from the previous step are shown in the Objects Filtered from Coverage Analysis section at the beginning of the report. To navigate to the rules’ corresponding items in the Details section of the report, use the hyperlinks in the rule descriptions. Clicking the hyperlinks in the Rationale column navigates to the Coverage Results Explorer.

    You can add justification rules for elements that do not receive coverage to the filter by clicking in the Details section of the report.

Save Coverage Filter to File

After you define the coverage filter rules, save the rules to a file so that you can reuse them with this model or with other models. By default, coverage filter files are named <model_name>_covfilter.cvf.

In the Current Cumulative Data section of the Coverage Filter Viewer:

  1. Click Save filter.

  2. Specify a file name and folder for the filter file and click Save.

If you make multiple changes to the coverage filter rules, apply the changes to the coverage filter file each time.

Load Coverage Filter File

After you save a coverage filter file, you can load the coverage filter file for other models.

In the Current Cumulative Data section of the Coverage Filter Viewer:

  1. Click Load filter.

  2. Navigate to the filter file and click Open.

You can have only one coverage filter file attached to a model at a time. If you attach a different coverage filter file, the newly attached file replaces the previously attached file.

Two or more models can have the same coverage filter file attached. If a model has an attached filter file that contains coverage filter rules for specific objects in a different model, those rules are ignored during coverage recording.

Update the Report with the Current Filter Settings

If you change the filtering settings or add filters after you simulate the model, you can update the coverage report and model highlighting without resimulating the model. After you have simulated the model, in the Current Cumulative Data section of the Coverage Filter Viewer:

  1. Apply or Revert any changes you have made.

  2. Click Generate Report.

View Coverage Filter Rules in Your Model

Whenever you define a coverage filter rule or remove an existing coverage filter rule, the Coverage Filter Viewer opens. This dialog box lists the coverage filter rules for your model. For more information, see Coverage Filter Viewer.

The Coverage Filter Viewer is available in the Current Cumulative Data section of the Coverage Results viewer. Alternatively, you can right-click anywhere in the model window and select Coverage > Open Filter Viewer

If you are inside a subsystem, you can view any coverage filter rule attached to the subsystem. To open the Coverage Filter Viewer, right-click any object inside the subsystem and select Coverage > Show filter parent.