Certain Simulink^{®} objects can receive any type of model coverage. Other Simulink objects can receive only certain types of coverage, as the following table shows. Click a link in the first column to get more detailed information about coverage for specific model objects.
All Simulink objects can receive Execution coverage, except blocks that are not instrumented in model coverage:
Merge Blocks
Scope Blocks
Outport Blocks
Inport Blocks
Width Blocks
Display Blocks
For Stateflow^{®} states, events, and state temporal logic decisions, model coverage provides decision coverage. For Stateflow transitions, model coverage provides decision, condition, and MCDC coverage. Model coverage provides condition and MCDC coverage for logical expressions in assignment statements in states and transitions. For more information, see Model Coverage for Stateflow Charts.
Model Object | Decision | Condition | MCDC | Lookup Table | Simulink Design Verifier™ | Saturate on Integer Overflow | Relational Boundary |
---|---|---|---|---|---|---|---|
Discrete-Time Integrator (when saturation limits are enabled or reset) | |||||||
Index Vector | |||||||
See also Triggered Models. | |||||||
(Relative to slew rates) | |||||||
Simulink Design Verifier Functions in MATLAB Function Blocks | |||||||
The Abs block receives decision coverage. Decision coverage is based on:
Input to the block being less than zero.
Data type of the input signal.
For input to the block being less than zero, the decision coverage measures:
The number of time steps that the block input is less than zero, indicating a true decision.
The number of time steps the block input is not less than zero, indicating a false decision.
If you select the Saturate on integer overflow coverage metric, the Abs block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage.
If the input data type to the Abs block is uint8
, uint16
,
or uint32
, the Simulink
Coverage™ software
reports no coverage for the block.
The software sets the block output equal to the block input without
making a decision. If the input data type to the Abs block
is Boolean, an error occurs.
The Abs block contains an implicit comparison of the input with zero. Therefore, if you select the Relational Boundary coverage metric, the Abs block receives relational boundary coverage. For more information, see Relational Boundary Coverage.
If you select the Saturate on integer overflow coverage metric, the Bias block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage.
The Combinatorial Logic block receives decision and condition coverage. Decision coverage is based on achieving each output row of the truth table. The decision coverage measures the number of time steps that each output row of the truth table is set to the block output.
The condition coverage measures the number of time steps that each input is false (equal to zero) and the number of times each input is true (not equal to zero). If the Combinatorial Logic block has a single input element, the Simulink Coverage software reports only decision coverage, because decision and condition coverage are equivalent.
If all truth table values are set to the block output for at least one time step, decision coverage is 100%. Otherwise, the software reports the coverage as the number of truth table values output during at least one time step, divided by the total number of truth table values. Because this block always has at least one value in the truth table as output, the minimum coverage reported is one divided by the total number of truth table values.
If all block inputs are false for at least one time step and true for at least one time step, condition coverage is 100%. Otherwise, the software reports the coverage as achieving a false value at each input for at least one time step, plus achieving a true value for at least one time step, divided by two raised to the power of the total number of inputs (i.e., 2^number_of_inputs). The minimum coverage reported is the total number of inputs divided by two raised to the power of the total number of inputs.
The Compare to Constant block receives condition coverage.
Condition coverage measures:
the number of times that the comparison between the input and the specified constant was true.
the number of times that the comparison between the input and the specified constant was false.
The Compare to Constant block contains a comparison of the input with a constant. Therefore, if you select the Relational Boundary coverage metric, the Compare to Constant block receives relational boundary coverage. For more information, see Relational Boundary Coverage.
The Compare to Zero block receives condition coverage.
Condition coverage measures:
the number of times that the comparison between the input and zero was true.
the number of times that the comparison between the input and zero was false.
The Compare to Zero block contains a comparison of the input with zero. Therefore, if you select the Relational Boundary coverage metric, the Compare to Zero block receives relational boundary coverage. For more information, see Relational Boundary Coverage.
If you select the Saturate on integer overflow coverage metric, the Data Type Conversion block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage.
The Dead Zone block receives decision coverage. The Simulink Coverage software reports decision coverage for these parameters:
Start of dead zone
End of dead zone
The Start of dead zone parameter specifies the lower limit of the dead zone. For the Start of dead zone parameter, decision coverage measures:
The number of time steps that the block input is greater than or equal to the lower limit, indicating a true decision.
The number of time steps that the block input is less than the lower limit, indicating a false decision.
The End of dead zone parameter specifies the upper limit of the dead zone. For the End of dead zone, decision coverage measures:
The number of time steps that the block input is greater than the upper limit, indicating a true decision.
The number of time steps that the block input is less than or equal to the upper limit, indicating a false decision.
When the upper limit is true, the software does not measure Start of dead zone coverage for that time step. Therefore, the total number of Start of dead zone decisions equals the number of time steps that the End of dead zone is false.
If you select the Saturate on integer overflow coverage metric, the Dead Zone block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage.
The Dead Zone block contains an implicit comparison of the input with an upper and lower limit value. Therefore, if you select the Relational Boundary coverage metric, the Dead Zone block receives relational boundary coverage. For more information, see Relational Boundary Coverage.
The Direct Lookup Table (n-D) block receives lookup table coverage. For an n-dimensional lookup table, the number of output break points is the product of all the number of break points for each table dimension.
Lookup table coverage measures:
The number of times during simulation that each combination of dimension input values is between each of the break points.
The number of times during simulation that each combination of dimension input values is below the lowest break point and above the highest break point for each table dimension.
The total number of coverage points for an n-dimensional lookup table is the product of the number of break points in each table dimension plus one. In the coverage report, an increasing white-to-green color scale, with six evenly spaced data ranges starting with zero, indicates the number of time steps that the software measures each interpolation or extrapolation point.
The software determines a percentage of total coverage by measuring the total interpolation and extrapolation points that achieve a measurement of at least one time step during simulation between a break point or beyond the end points.
If you select the Saturate on integer overflow coverage metric, the Discrete Filter block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage.
If you select the Saturate on integer overflow coverage metric, the Discrete FIR Filter block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage.
The Discrete-Time Integrator block receives decision coverage. The Simulink Coverage software reports decision coverage for these parameters:
External reset
Limit output
If you set External reset to none
,
the Simulink
Coverage software does not report
decision coverage for the reset decision. Otherwise, the decision
coverage measures:
The number of time steps that the block output is reset, indicating a true decision.
The number of time steps that the block output is not reset, indicating a false decision.
If you do not select Limit output, the software does not report decision coverage for that decision. Otherwise, the software reports decision coverage for the Lower saturation limit and the Upper saturation limit.
For the Upper saturation limit, decision coverage measures:
The number of time steps that the integration result is greater than or equal to the upper limit, indicating a true decision.
The number of time steps that the integration result is less than the upper limit, indicating a false decision.
For the Lower saturation limit, decision coverage measures
The number of time steps that the integration result is less than or equal to the lower limit, indicating a true decision.
The number of time steps that the integration result is greater than the lower limit, indicating a false decision.
For a time step when the upper limit is true, the software does not measure Lower saturation limit coverage. Therefore, the total number of lower limit decisions equals the number of time steps that the upper limit is false.
If you select the Saturate on integer overflow coverage metric, the Discrete-Time Integrator block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage.
If you select the Saturate on integer overflow coverage metric, the Discrete Transfer Fcn block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage.
If you select the Saturate on integer overflow coverage metric, the Dot Product block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage.
The Enabled Subsystem block receives decision, condition, and MCDC coverage.
Decision coverage measures:
The number of time steps that the block is enabled, indicating a true decision.
The number of time steps that the block is disabled, indicating a false decision.
If at least one time step is true and at least one time step is false, decision coverage is 100%. If no time steps are true, or if no time steps are false, decision coverage is 50%.
The Simulink Coverage software measures condition coverage for the enable input only if the enable input is a vector. For the enable input, condition coverage measures the number of time steps each element of the enable input is true and the number of time steps each element of the enable input is false. The software reports condition coverage based on the total number of possible conditions and how many are true for at least one time step and how many are false for at least one time step.
The software measures MCDC coverage for the enable input only
if the enable input is a vector. Because the enable of the subsystem
is an OR
of the vector inputs, MCDC coverage is
100% if, during at least one time step, each vector enable input is
exclusively true and if, during at least one time step, all
vector enable inputs are false. For MCDC coverage measurement, the
software treats each element of the vector as a separate condition.
The Enabled and Triggered Subsystem block receives decision, condition, and MCDC coverage. Decision coverage measures:
The number of time steps that a trigger edge occurs while the block is enabled, indicating a true decision.
The number of time steps that a trigger edge does not occur while the block is enabled, or the block is disabled, indicating a false decision.
If at least one time step is true and at least one time step is false, decision coverage is 100%. If no time steps are true, or if no time steps are false, decision coverage is 50%.
The software measures condition coverage for the enable input and for the trigger input separately:
For the enable input, condition coverage measures the number of time steps the enable input is true and the number of time steps the enable input is false.
For the trigger input, condition coverage measures the number of time steps the trigger edge occurs, indicating true, and the number of time steps the trigger edge does not occur, indicating false.
The software reports condition coverage based on the total number of possible conditions and how many conditions are true for at least one time step and how many are false for at least one time step. The software treats each element of a vector as a separate condition coverage measurement.
The software measures MCDC coverage for the enable input and
for the trigger input in combination. Because the enable input of
the subsystem is an AND
of these two inputs, MCDC
coverage is 100% if all of the
following occur:
During at least one time step, both inputs are true.
During at least one time step, the enable input is true and the trigger edge is false.
During one time step, the enable input is false and the trigger edge is true.
The software treats each vector element as a separate MCDC coverage measurement. It measures each trigger edge element against each enable input element. However, if the number of elements in both the trigger and enable inputs exceeds 12, the software does not report MCDC coverage.
The Fcn block receives condition and MCDC coverage.
The Simulink
Coverage software reports condition
or MCDC coverage for Fcn blocks only if the top-level
operator is Boolean (&&
, ||
,
or !
).
Condition coverage is based on input values or arithmetic expressions that are inputs to Boolean operators in the block. The condition coverage measures:
The number of time steps that each input to a Boolean operator is true (not equal to zero).
The number of time steps that each input to a Boolean operator is false (equal to zero).
If all Boolean operator inputs are false for at least one time step and true for at least one time step, condition coverage is 100%. Otherwise, the software reports condition coverage based on the total number of possible conditions and how many are true for at least one time step and how many are false for at least one time step.
The software measures MCDC coverage for Boolean expressions within the Fcn block. If, during at least one time step, each condition independently sets the output of the expression to true and if, during at least one time step, each condition independently sets the output of the expression to false, MCDC coverage is 100%. Otherwise, the software reports MCDC coverage based on the total number of possible conditions and how many times each condition independently sets the output to true during at least one time step and how many conditions independently set the output to false during at least one time step.
If the Fcn block contains a relational operation and you select the Relational Boundary coverage metric, the Fcn block receives relational boundary coverage. For more information, see Relational Boundary Coverage.
The For Iterator block and For Iterator Subsystem receive decision coverage. The Simulink Coverage software measures decision coverage for the loop condition value, which is determined by one of the following:
The iteration value being at or below the iteration limit, indicated as true.
The iteration value being above the iteration limit, indicated as false.
The software reports the total number of times that each loop condition evaluates to true and to false. If the loop condition evaluates to true at least once and false at least once, decision coverage is 100%. If no loop conditions are true, or if no loop conditions are false, decision coverage is 50%.
If you select the Saturate on integer overflow coverage metric, the Gain block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage.
The If block that causes an If Action Subsystem to execute receives condition, decision, and MCDC coverage:
The software measures decision coverage for the if
condition
and all elseif
conditions
defined in the If block.
If the if
condition or any
of the elseif
conditions contains a logical expression
with multiple conditions, such as u1 & u2 & u3
,
the software also measures condition and MCDC coverage for each condition
in the expression, u1
, u2
, and u3
in
the preceding example.
The software does not directly measure the else
condition.
When there are no elseif
conditions,
the else
condition is the direct complement of
the if
condition, or the else
condition
is the direct complement of the last elseif
condition.
The software reports the total number of time steps that each if
and elseif
condition
evaluates to true and to false. If the if
or elseif
condition
evaluates to true at least once, and evaluates to false at least once,
decision coverage is 100%. If no if
or elseif
conditions
are true, or if no if
or elseif
conditions
are false, decision coverage is 50%. If the previous if
or elseif
condition
never evaluates as false, an elseif
condition
can have 0% decision coverage.
The If block contains a comparison between its inputs. Therefore, if you select the Relational Boundary coverage metric, the If block receives relational boundary coverage. For more information, see Relational Boundary Coverage.
The Index Vector block receives decision coverage based on passing each element of the vector signal input to the output of the block.
If each vector index is passed to the block output for at least one time step, decision coverage is 100%. Otherwise, Simulink Coverage reports coverage as the percentage of the total number of vector indices in the input signal that passed through to the output.
If you select the Saturate on integer overflow coverage metric, the Index Vector block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage.
The Interpolation Using Prelookup block receives lookup table coverage. For an n-D lookup table, the number of output break points equals the product of all the number of break points for each table dimension. The lookup table coverage measures:
The number of times during simulation that each combination of dimension input values is between each of the break points.
The number of times during simulation that each combination of dimension input values is below the lowest break point and above the highest break point for each table dimension.
The total number of coverage points for an n-dimensional lookup table is the product of the number of break points in each table dimension plus one. In the coverage report, an increasing white-to-green color scale, with six evenly spaced data ranges starting with zero, indicates the number of time steps that the software measures each interpolation or extrapolation point.
The software determines a percentage of total coverage by measuring the total interpolation and extrapolation points that achieve a measurement of at least one time step during simulation between a break point or beyond the end points.
If you select the Saturate on integer overflow, the Interpolation Using Prelookup block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage. The software treats each element of a vector or matrix as a separate coverage measurement.
Simulink blocks and Stateflow charts that are linked to library objects receive the same coverage that they would receive if they were not linked to library objects. The Simulink Coverage software records coverage individually for each library object in the model. If your model contains multiple instances of the same library object, each instance receives its own coverage data.
The Logical Operator block receives condition and MCDC coverage. The Simulink Coverage software measures condition coverage for each input to the block. The condition coverage measures:
The number of time steps that each input is true (not equal to zero).
The number of time steps that each input is false (equal to zero).
If all block inputs are false for at least one time step and true for at least one time step, the software condition coverage is 100%. Otherwise, the software reports the condition coverage based on the total number of possible conditions and how many are true at least one time step and how many are false at least one time step.
The software measures MCDC coverage for all inputs to the block. If, during at least one time step, each condition independently sets the output of the block to true and if, during at least one time step, each condition independently sets the output of the block to false, MCDC coverage is 100%. Otherwise, the software reports the MCDC coverage based on the total number of possible conditions and how many times each one of them independently set the output to true for at least one time step and how many independently set the output to false for at least one time step.
The 1-D Lookup Table block receives lookup table coverage; for a one-dimensional lookup table, the number of input and output break points is equal. Lookup table coverage measures:
The number of times during simulation that the input and output values are between each of the break points.
The number of times during simulation that the input and output values are below the lowest break point and above the highest break point.
The total number of coverage points for a one-dimensional lookup table is the number of break points in the table plus one. In the coverage report, an increasing white-to-green color scale, with six evenly spaced data ranges starting with zero, indicates the number of time steps that the software measures each interpolation or extrapolation point.
The software determines a percentage of total coverage by measuring the total interpolation and extrapolation points that achieve a measurement of at least one time step during simulation between a break point or beyond the end points.
If you select the Saturate on integer overflow coverage metric, the 1-D Lookup Table block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage. The software treats each element of a vector or matrix as a separate coverage measurement.
The 2-D Lookup Table block receives lookup table coverage. For a two-dimensional lookup table, the number of output break points equals the number of row break points multiplied by the number of column inputs. Lookup table coverage measures:
The number of times during simulation that each combination of row input and column input values is between each of the break points.
The number of times during simulation that each combination of row input and column input values is below the lowest break point and above the highest break point for each row and column.
The total number of coverage points for a two-dimensional lookup table is the number of row break points in the table plus one, multiplied by the number of column break points in the table plus one. In the coverage report, an increasing white-to-green color scale, with six evenly spaced data ranges starting with zero, indicates the number of time steps that the software measures each interpolation or extrapolation point.
If you select the Saturate on integer overflow coverage metric, the 2-D Lookup Table block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage. The software treats each element of a vector or matrix as a separate coverage measurement.
The n-D Lookup Table block receives lookup table coverage. For an n-dimensional lookup table, the number of output break points equals the product of all the number of break points for each table dimension. Lookup table coverage measures:
The number of times during simulation that each combination of dimension input values is between each of the break points.
The number of times during simulation that each combination of dimension output values is below the lowest break point and above the highest break point for each table dimension.
The total number of coverage points for an n-dimensional lookup table is the product of the number of break points in each table dimension plus one. In the coverage report, an increasing white-to-green color scale, with six evenly spaced data ranges starting with zero, indicates the number of time steps that the software measures each interpolation or extrapolation point.
The software determines a percentage of total coverage by measuring the total interpolation and extrapolation points that achieve a measurement of at least one time step during simulation between a break point or beyond the end points.
If you select the Saturate on integer overflow coverage metric, the n-D Lookup Table block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage. The software treats each element of a vector or matrix as a separate coverage measurement.
If you select the Saturate on integer overflow coverage metric, the Math Function block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage. The software treats each element of a vector or matrix as a separate coverage measurement.
For information about the type of coverage that the Simulink Coverage software reports for the MATLAB Function block, see Model Coverage for MATLAB Functions.
Simulink Coverage records only Decision, Condition, and MCDC coverage for MATLAB System blocks.
The MinMax block receives decision coverage based on passing each input to the output of the block.
For decision coverage based on passing each input to the output of the block, the coverage measures the number of time steps that the simulation passes each input to the block output. The number of decision points is based on the number of inputs to the block and whether they are scalar, vector, or matrix.
If all inputs are passed to the block output for at least one time step, the Simulink Coverage software reports the decision coverage as 100%. Otherwise, the software reports the coverage as the number of inputs passed to the output during at least one time step, divided by the total number of inputs.
If you select the Saturate on integer overflow coverage metric, the MinMax block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage. The software treats each element of a vector or matrix as a separate coverage measurement.
The Model block does not receive coverage directly;
the model that the block references receives coverage. If the simulation
mode for the referenced model is set to Normal
,
the Simulink
Coverage software reports coverage
for all objects within the referenced
model that receive coverage. . If the simulation mode for the referenced
model is set to SIL
or PIL
and
you have Embedded Coder^{®} installed, the Simulink
Coverage software
reports coverage for the code generated from your model .If the simulation
mode is set to a value other than Normal
, SIL
,
or PIL
, the software cannot measure coverage
for the referenced model.
In the Coverage pane of the Configuration Parameters dialog box, select the referenced models for which you want to report coverage. The software generates a coverage report for each referenced model you select.
If your model contains multiple instances of the same referenced
model, the software records coverage for all
instances of that model where the simulation mode of the Model block
is set to Normal
. The coverage report for
that referenced model combines the coverage data for all
Normal mode instances of that model.
The coverage reports for referenced models are linked from a summary report for the parent model.
Note
For details on how to select referenced models to report coverage, see Referenced Models.
The Multiport Switch block receives decision coverage based on passing each input, excluding the first control input, to the output of the block.
For decision coverage based on passing each input, excluding the first control input, to the output of the block, the coverage measures the number of time steps that each input is passed to the block output. The number of decision points is based on the number of inputs to the block and whether the control input is scalar or vector.
If all inputs, excluding the first control input, are passed to the block output for at least one time step, decision coverage is 100%. Otherwise, the Simulink Coverage software reports coverage as the number of inputs passed to the output during at least one time step, divided by the total number of inputs minus one.
If you select the Saturate on integer overflow coverage metric, the Multiport Switch block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage. The software treats each element of a vector or matrix as a separate coverage measurement.
If you select the Saturate on integer overflow coverage metric, the PID Controller and PID Controller (2 DOF) blocks receive saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage. The software treats each element of a vector or matrix as a separate coverage measurement.
If you select the Saturate on integer overflow coverage metric, the Product block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage. The software treats each element of a vector or matrix as a separate coverage measurement.
The Proof Assumption block receives Simulink Design Verifier coverage. Simulink Design Verifier coverage is based on the points and intervals defined in the block dialog box. Simulink Design Verifier coverage measures the number of time steps that each point or interval defined in the block is satisfied. The total number of objective outcomes is based on the number of points or intervals defined in the Proof Assumption block.
If all points and intervals defined in the block are satisfied for at least one time step, Simulink Design Verifier coverage is 100%. Otherwise, the Simulink Coverage software reports coverage as the number of points and intervals satisfied during at least one time step, divided by the total number of points and intervals defined for the block.
The Proof Objective block receives Simulink Design Verifier coverage. Simulink Design Verifier coverage is based on the points and intervals defined in the block dialog box. Simulink Design Verifier coverage measures the number of time steps that each point or interval defined in the block is satisfied. The total number of objective outcomes is based on the number of points or intervals defined in the Proof Objective block.
If all points and intervals defined in the block are satisfied for at least one time step, Simulink Design Verifier coverage is 100%. Otherwise, the Simulink Coverage software reports coverage as the number of points and intervals satisfied during at least one time step, divided by the total number of points and intervals defined for the block.
The Rate Limiter block receives decision coverage. The Simulink Coverage software reports decision coverage for the Rising slew rate and Falling slew rate parameters.
For the Rising slew rate, decision coverage measures:
The number of time steps that the block input changes more than or equal to the rising rate, indicating a true decision.
The number of time steps that the block input changes less than the rising rate, indicating a false decision.
For the Falling slew rate, decision coverage measures:
The number of time steps that the block input changes less than or equal to the falling rate, indicating a true decision.
The number of time steps that the block input changes more than the falling rate, indicating a false decision.
The software does not measure Falling slew rate coverage for a time step when the Rising slew rate is true. Therefore, the total number of Falling slew rate decisions equals the number of time steps that the Rising slew rate is false.
If at least one time step is true and at least one time step is false, decision coverage for each of the two individual decisions for the block is 100%. If no time steps are true, or if no time steps are false, decision coverage is 50%. The software treats each element of a vector or matrix as a separate coverage measurement.
The Rate Limiter block implicitly compares the derivative of the input signal with an upper and lower limit value. Therefore, if you select the Relational Boundary coverage metric, the Rate Limiter block receives relational boundary coverage. For more information, see Relational Boundary Coverage.
The Relational Operator block receives condition coverage.
Condition coverage measures:
the number of times that the specified relational operation was true.
the number of times that the specified relational operation was false.
The Relational Operator block contains a comparison between its inputs. Therefore, if you select the Relational Boundary coverage metric, the Relational Operator block receives relational boundary coverage. For more information, see Relational Boundary Coverage.
The Relay block receives decision coverage. The Simulink Coverage software reports decision coverage for the Switch on point and the Switch off point parameters.
For the Switch on point, decision coverage measures:
The number of consecutive time steps that the block input is greater than or equal to the Switch on point, indicating a true decision.
The number of consecutive time steps that the block input is less than the Switch on point, indicating a false decision.
For the Switch off point, decision coverage measures:
The number of consecutive time steps that the block input is less than or equal to the Switch off point, indicating a true decision.
The number of consecutive time steps that the block input is greater than the Switch off point, indicating a false decision.
The software does not measure Switch off point coverage for a time step when the switch on threshold is true. Therefore, the total number of Switch off point decisions equals the number of time steps that the Switch on point is false.
If at least one time step is true and at least one time step is false, decision coverage for each of the two individual decisions for the block is 100%. If no time steps are true, or if no time steps are false, decision coverage is 50%. The software treats each element of a vector or matrix as a separate coverage measurement.
The Relay block contains an implicit comparison of its second input with a threshold value. Therefore, if you select the Relational Boundary coverage metric, the Relay block receives relational boundary coverage. For more information, see Relational Boundary Coverage.
Model coverage is supported for C/C++ S-Functions. The coverage report for the model contains results for each instance of an S-Function block in the model. The results for an S-Function block link to a separate coverage report for the C/C++ code in the block.
To generate coverage report for S-Functions:
When creating the S-Functions, enable support for coverage. For more information, see Make S-Function Compatible with Model Coverage.
When generating the coverage report, enable support for S-Functions. For more information, see Generate Coverage Report for S-Function.
The following coverage types are reported for S-Functions:
The coverage data for S-Function blocks is obtained in the following way:
The coverage result for a block is a weighted average of the result over all files in the block.
For instance, an S-Function block has two files, file1.c
and file2.c
.
The decision coverage for file1.c
is 75% (3/4 outcomes
covered) and that for file2.c
is 50% (10/20 outcomes
covered). The decision coverage for the block is 13/24 ≈ 54
%.
For each file, the coverage result is a weighted average of the result over all functions in the file.
For each function, the coverage result is a weighted average of the result over all statements in the function that receive that coverage.
Note
Model coverage for S-Functions have the following restrictions:
Only Level-2 C/C++ S-Functions are supported for coverage. For an example of a level-2 C S-Function, see Create a Basic C MEX S-Function.
C++ class templates are not instrumented for coverage.
The Saturation block receives decision coverage. The Simulink Coverage software reports decision coverage for the Lower limit and Upper limit parameters.
For the Upper limit, decision coverage measures:
The number of time steps that the block input is greater than or equal to the upper limit, indicating a true decision.
The number of time steps that the block input is less than the upper limit, indicating a false decision.
For the Lower limit, decision coverage measures:
The number of time steps that the block input is greater than the lower limit, indicating a true decision.
The number of time steps that the block input is less than or equal to the lower limit, indicating a false decision.
The software does not measure Lower limit coverage for a time step when the upper limit is true. Therefore, the total number of Lower limit decisions equals the number of time steps that the Upper limit is false.
If at least one time step is true and at least one time step is false, decision coverage for each of the two individual decisions for the Saturation block is 100%. If no time steps are true, or if no time steps are false, decision coverage is 50%. The software treats each element of a vector or matrix as a separate coverage measurement.
The Saturation block contains an implicit comparison of the input with an upper and lower limit value. Therefore, if you select the Relational Boundary coverage metric, the Saturation block receives relational boundary coverage. For more information, see Relational Boundary Coverage.
If you select the Saturate on integer overflow coverage metric, the Saturation Dynamic block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage. The software treats each element of a vector or matrix as a separate coverage measurement.
The following functions in MATLAB Function blocks receive Simulink Design Verifier coverage:
sldv.condition
(Simulink Design Verifier)
sldv.test
(Simulink Design Verifier)
sldv.assume
(Simulink Design Verifier)
sldv.prove
(Simulink Design Verifier)
Each of these functions evaluates an expression expr
,
for example, sldv.test(
,
where expr
)expr
is any
valid Boolean MATLAB^{®} expression. Simulink
Design Verifier coverage
measures the number of time steps that the expression expr
evaluates
to true.
If expr
is true for at least one
time step, Simulink
Design Verifier coverage for that function
is 100%. Otherwise, the Simulink
Coverage software
reports coverage for that function as 0%.
If you select the Saturate on integer overflow coverage metric, the Sqrt, Signed Sqrt, and Reciprocal Sqrt blocks receive saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage. The software treats each element of a vector or matrix as a separate coverage measurement.
If you select the Saturate on integer overflow coverage metric, the Sum, Add, Subtract, and Sum of Elements blocks receive saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage. The software treats each element of a vector or matrix as a separate coverage measurement.
The Switch block receives decision coverage based on the control input to the block. Decision coverage measures:
The number of time steps that the control input evaluates to true.
The number of time steps the control input evaluates to false.
The number of decision points is based on whether the control input is scalar or vector.
If you select the Saturate on integer overflow coverage metric, the Switch block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage. The software treats each element of a vector or matrix as a separate coverage measurement.
The Switch block contains an implicit comparison of its second input with a threshold value. Therefore, if you select the Relational Boundary coverage metric, the Switch block receives relational boundary coverage. For more information, see Relational Boundary Coverage.
The SwitchCase block and SwitchCase Action Subsystem receive
decision coverage. The Simulink
Coverage software
measures decision coverage individually for each switch case defined
in the block and also for the default case. The number of decision
outcomes is equal to the number of case conditions plus one for the default
case,
if one is defined.
The software reports the total number of time steps that each case evaluates to true. If each case, including the default case, evaluates to true at least once, decision coverage is 100%. The software determines the decision coverage by the number of cases that evaluate true for at least one time step divided by the total number of cases.
If the SwitchCase block does not contain a default
case,
the software measures decision coverage for the number of time steps
in which none of the cases evaluated
to true. In the coverage report, this coverage is reported as implicit-default.
The Test Condition block receives Simulink Design Verifier coverage. Simulink Design Verifier coverage is based on the points and intervals defined in the block dialog box. Simulink Design Verifier coverage measures the number of time steps that each point or interval defined in the block is satisfied. The total number of objective outcomes is based on the number of points or intervals defined in the Test Condition block.
If all points and intervals defined in the block are satisfied for at least one time step, Simulink Design Verifier coverage is 100%. Otherwise, the Simulink Coverage software reports coverage as the number of points and intervals satisfied during at least one time step, divided by the total number of points and intervals defined for the block.
The Test Objective block receives Simulink Design Verifier coverage. Simulink Design Verifier coverage is based on the points and intervals defined in the block dialog box. Simulink Design Verifier coverage measures the number of time steps that each point or interval defined in the block is satisfied. The total number of objective outcomes is based on the number of points or intervals defined in the Test Objective block.
If all points and intervals defined in the block are satisfied for at least one time step, Simulink Design Verifier coverage is 100%. Otherwise, the Simulink Coverage software reports coverage as the number of points and intervals satisfied during at least one time step, divided by the total number of points and intervals defined for the block.
A Model block can reference a model that contains edge-based trigger ports at the root level of the model. Triggered models receive decision, condition, and MCDC coverage.
Decision coverage measures:
The number of time steps that the referenced model is triggered, indicating a true decision.
The number of time steps that the referenced model is not triggered, indicating a false decision.
If at least one time step is true and at least one time step is false, decision coverage for the Model block that references the triggered model is 100%. If no time steps are true, or if no time steps are false, decision coverage is 50%.
Only if the trigger input is a vector, the Simulink Coverage software measures condition coverage for the trigger port in the referenced model. For the trigger port, condition coverage measures:
The number of time steps that each element of the trigger port is true.
The number of time steps that each element of the trigger port is false.
The software reports condition coverage based on the total number of possible conditions and how many are true for at least one time step and how many are false for at least one time step.
If the trigger port is a vector, the software measures MCDC
coverage for the trigger port only. Because the trigger port of the
referenced model is an OR
of the vector inputs,
if, during at least one time step, each vector trigger port is exclusively
true and if, during at least one time step, all
vector trigger port inputs are false, MCDC coverage is 100%. The software
treats each element of the vector as a separate condition for MCDC
coverage measurement.
The Triggered Subsystem block receives decision, condition, and MCDC coverage.
Decision coverage measures:
The number of time steps that the block is triggered, indicating a true decision.
The number of time steps that the block is not triggered, indicating a false decision.
If at least one time step is true and at least one time step is false, decision coverage is 100%. If no time steps are true, or if no time steps are false, decision coverage is 50%.
The Simulink Coverage software measures condition coverage for the trigger input only if the trigger input is a vector. For the trigger input, condition coverage measures:
The number of time steps that each element of the trigger edge is true.
The number of time steps that each element of the trigger edge is false.
The software reports condition coverage based on the total number of possible conditions and how many are true for at least one time step and how many are false for at least one time step.
If the trigger input is a vector, the software measures MCDC
coverage for the trigger input only. Because the trigger edge of the
subsystem is an OR
of the vector inputs, if, during
at least one time step, each vector trigger edge input is exclusively
true and if, during at least one time step, all
vector trigger edge inputs are false, MCDC coverage is 100%. The software
treats each element of the vector as a separate condition for MCDC
coverage measurement.
The Truth Table block is a Stateflow block that enables you to use truth table logic directly in a Simulink model. The Truth Table block receives condition, decision, and MCDC coverage. For more information on model coverage with Stateflow truth tables, see Model Coverage for Stateflow Truth Tables.
If you select the Saturate on integer overflow coverage metric, the Unary Minus block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage. The software treats each element of a vector or matrix as a separate coverage measurement.
If you select the Saturate on integer overflow coverage metric, the Weighted Sample Time Math block receives saturate on integer overflow coverage. For more information, see Saturate on Integer Overflow Coverage. The software treats each element of a vector or matrix as a separate coverage measurement.
The While Iterator block and While Iterator Subsystem receive
decision coverage. Decision coverage is measured for the while
condition
value, which is determined by the while
condition
being satisfied (true), or the while
condition
not being satisfied (false). Simulink
Coverage software
reports the total number of times that each while
condition
evaluates to true and to false. If the while
condition
evaluates to true at least once, and false at least once, decision
coverage for the while
condition is 100%. If no while
conditions
are true, or if no while
conditions
are false, decision coverage is 50%.
If the iteration limit is exceeded (true) or is not exceeded
(false), the software measures decision coverage independently. If
the iteration limit evaluates to true at least once, and false at
least once, decision coverage for the iteration limit is 100%. If
no iteration limits are true, or
if no iteration limits are false,
decision coverage is 50%. If you set Maximum number of iterations to -1
(no
limit), the decision coverage for the iteration limit is true for
all iterations and false for zero
iterations, and decision coverage is 50%.