Saturday, March 03, 2012

Coverage - Defining Coverage Points

Coverage - Defining Coverage Points

A coverage point can be an integral variable or an integral expression. Each coverage point includes a set of bins associated with its sampled values or its value transitions. The bins can be explicitly defined by the user or automatically created by SystemVerilog.

The syntax for specifying coverage points is given below.

covergroup mux;
coverpoint sel@(enable or reset) ;
initial
begin


end endgroup

Specifying bins for transitions:

value1 => value2

It represents the value of coverage point at two successive sample points, that is, value1 followed by value2 at the next sample point. A sequence of transitions is represented as: value1 => value3 => value4 => value5

Defining cross coverage:

A coverage group can specify cross coverage between two or more coverage points or variables. Cross coverage is specified using the cross construct. When a variable V is part of a cross coverage, SystemVerilog implicitly creates a coverage point for the variable, as if it had been created by the statement coverpoint V;.

Thus, a cross involves only coverage points. Expressions cannot be used directly in a cross; a coverage point must be explicitly defined first.

bit [3:0] a, b;
covergroup cov @(posedge clk);
aXb : cross a, b;
endgroup

Specifying coverage options:

Options control the behavior of the covergroup, coverpoint and cross. There are two types of options: those that are specific to an instance of a covergroup, and those that specify an option for the covergroup type as a whole.

Options are as follows ;

weight= number
goal=number
name= string
comment=string

Predefined coverage methods:

The following coverage methods are provided for the covergroup. These methods can be invoked procedurally at any time.

Predefined coverage system tasks and functions:

SystemVerilog provides the following system tasks and functions to help manage coverage data collection.

$set_coverage_db_name ( name ) — Sets the filename of the coverage database into which coverage information is saved at the end of a simulation run.
$load_coverage_db ( name ) — Load from the given filename the cumulative coverage information for all coverage group types.
$get_coverage ( ) — Returns as a real number in the range 0 to 100 the overall coverage of all coverage group

Organization of option and type_option members

The type and type_option members of a covergroup, coverpoint, and cross items are implicitly declared structures with the following composition:

No comments:

Post a Comment

Popular Posts