Tutorials CROSS COVERAGE

Cross allows keeping track of information which is received simultaneous on more than one cover point. Cross coverage is specified using the cross construct.

program main;
bit [0:1] y;
bit [0:1] y_values[\$]= '{1,3};

bit [0:1] z;
bit [0:1] z_values[\$]= '{1,2};

covergroup cg;
cover_point_y : coverpoint y ;
cover_point_z : coverpoint z ;
cross_yz : cross cover_point_y,cover_point_z ;
endgroup

cg cg_inst = new();
initial
foreach(y_values[i])
begin
y = y_values[i];
z = z_values[i];
cg_inst.sample();
end

endprogram

In the above program, y has can have 4 values 0,1,2 and 3 and similarly z can have 4 values 0,1,2 and 3. The cross product of the y and z will be 16 values (00),(01),(02),(03),(10),(11)........(y,z)......(3,2)(3,3) .
Only combinations (11) and (32) are generated.

Cross coverage report: cover points are not shown.

Covered bins
-----------------
cover_point_y cover_point_z
auto auto
auto auto

User-Defined Cross Bins

User-defined bins for cross coverage are defined using bin select expressions.

Consider the following example code:

int i,j;
covergroup ct;
coverpoint i { bins i[] = { [0:1] }; }
coverpoint j { bins j[] = { [0:1] }; }
x1: cross i,j;
x2: cross i,j {
bins i_zero = binsof(i) intersect { 0 };
}
endgroup

Cross x1 has the following bins:
<i,j>
<i,j>
<i,j>
<i,j>
Cross x2 has the following bins:
i_zero
<i,j>
<i,j>

 << PREVIOUS PAGE TOP NEXT PAGE >> copyright © 2007-2017 :: all rights reserved www.testbench.in::Disclaimer