+ All Categories
Home > Documents > functional_coverage.docx

functional_coverage.docx

Date post: 06-Dec-2015
Category:
Upload: raj
View: 212 times
Download: 0 times
Share this document with a friend
Popular Tags:
45
INTRODUCTION Systemverilog Functional Coverage Features Coverage of variables and expressions Cross coverage Automatic and user-defined coverage bins -- Values, transitions, or cross products Filtering conditions at multiple levels Flexible coverage sampling -- Events, Sequences, Procedural Directives to control and query coverage COVER GROUP The covergroup construct encapsulates the specification of a coverage model. Each covergroup specification can include the following components: A clocking event that synchronizes the sampling of coverage points A set of coverage points Cross coverage between coverage points Optional formal arguments Coverage options A Cover group is defined between key words covergroup & endgroup . A Covergroup Instance can be created using the new () operator . covergroup cg ; ... ... ... endgroup cg cg_inst = new ; The above example defines a covergroup named "cg". An instance of "cg" is declared as "cg_inst" and created using the "new" operator. SAMPLE Coverage should be triggered to sample the coverage values. Sampling can be done using
Transcript

INTRODUCTION  

Systemverilog Functional Coverage Features    Coverage of variables and expressions  Cross coverage  Automatic and user-defined coverage bins 

-- Values, transitions, or cross products  Filtering conditions at multiple levels  Flexible coverage sampling 

-- Events, Sequences, Procedural  Directives to control and query coverage 

COVER GROUP   The covergroup construct encapsulates the specification of a coverage model. Each covergroup specification can include the following components: 

A clocking event that synchronizes the sampling of coverage points  A set of coverage points  Cross coverage between coverage points  Optional formal arguments  Coverage options 

A Cover group is defined between key words covergroup & endgroup. A Covergroup Instance can be created using the new() operator. 

covergroup cg; ... ... ... endgroup 

cg cg_inst = new; The above example defines a covergroup named "cg". An instance of "cg" is declared as "cg_inst" and created using the "new" operator. 

SAMPLE   Coverage should be triggered to sample the coverage values. Sampling can be done using 

 Any event expression -edge, variable  End-point of a sequence  Event can be omitted  Calling sample() method. 

covergroup cg @(posedge clk); ... ... ... endgroup The above example defines a covergroup named "cg". This covergroup will be automatically sampled each time there is a posedge on "clk" signal. covergroup cg; ... ... ... endgroup 

cg cg_inst = new; 

initial // or task or function or always block begin ... ... cg_inst.sample(); ... ... end Sampling can also be done by calling explicitly calling .sample() method in procedural code. This is used when coverage sampling is required based on some calculations rather than events. COVER POINTS   A covergroup can contain one or more coverage points. A coverage point can be an integral variable or an integral expression. A coverage point creates a hierarchical scope, and can be optionally labeled. If the label is specified then it designates the name of the coverage point. program main; bit [0:2] y; bit [0:2] values[$]= '{3,5,6}; 

covergroup cg; cover_point_y : coverpoint y; endgroup 

cg cg_inst = new(); 

initial foreach(values[i]) 

begin y = values[i]; cg_inst.sample(); end 

endprogram In the above example, we are sampleing the cover point "y". The cover point is named "cover_point_y" . In the Coverage report you will see this name. A cover group "cg" is defined and its instance "cg_inst" is created. The value of "y" is sampled when cg_inst.sample() method is called. Total possible values for Y are 0,1,2,3,4,5,6,7. The variable "y" is assigned only values 3,5,6. The coverage engine should report that only 3 values are covered and there are 8 possible values. Commands To Simulate And Get The Coverage Report:  

 VCS Compilation command: vcs -sverilog -ntb_opts dtm filename.sv Simulation Command: ./simv Command to generate Coverage report: Coverage report in html format will be in the ./urgReport directory urg -dir simv.vdb VARIABLE : cover_point_y Expected : 8 Covered : 3 Percent: 37.50. 

In the above report, the coverage percentage is calculated by Covered/Expected. 

COVERPOINT EXPRESSION   Coverpoint Expression   A coverage point can be an integral variable or an integral Expression. SystemVerilog allows specifying the cover points in various ways. 

 1)Using XMR Example: Cover_xmr : coverpoint top.DUT.Submodule.bus_address; 

 2)Part select Example: Cover_part: coverpoint bus_address[31:2]; 

 3)Expression Example: Cocver_exp: coverpoint (a*b); 

 4)Function return value Example: Cover_fun: coverpoint funcation_call(); 

 5)Ref variable Example: covergroup (ref int r_v) cg; cover_ref: coverpoint r_v; endgroup 

Coverage Filter  

The expression within the iff construct specifies an optional condition that disables coverage for that cover point. If the guard expression evaluates to false at a sampling point, the coverage point is ignored. 

For example: 

covergroup cg; coverpoint cp_varib iff(!reset); // filter condition endgroup 

In the preceding example, cover point varible "cp_varib" is covered only if the value reset is low. 

GENERIC COVERAGE GROUPS  

Generic coverage groups can be written by passing their traits as arguments to the coverage constructor. This allows creating a reusable coverage group which can be used in multiple places. 

For example, To cover a array of specified index range. 

covergroup cg(ref int array, int low, int high ) @(clk); coverpoint// sample variable passed by reference { bins s = { [low : high] }; } endgroup 

int A, B; rgc1 = new( A, 0, 50 );// cover A in range 0 to 50 rgc2 = new( B, 120, 600 );// cover B in range 120 to 600 

The example above defines a coverage group, gc, in which the signal to be sampled as well as the extent of the coverage bins are specified as arguments. Later, two instances of the coverage group are created; each instance samples a different signal and covers a different range of values. 

COVERAGE BINS  

A coverage-point bin associates a name and a count with a set of values or a sequence of value transitions. If the bin designates a set of values, the count is incremented every time the coverage point matches one of the values in the set. If the bin designates a sequence of value transitions, the count is incremented every time the coverage point matches the entire sequence of value transitions. 

Bins can be created implicitly or explicitly. 

Implicit Bins  

While define cover point, if you do not specify any bins, then Implicit bins are created. The number of bins creating can be controlled by auto_bin_max parameter. 

Example for non enum cover point 

program main; bit [0:2] y; bit [0:2] values[$]= '{3,5,6}; 

covergroup cg; 

cover_point_y : coverpoint y { option.auto_bin_max = 4 ; } endgroup 

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

endprogram 

In the above example, the auto_bin_max is declared as 4. So, the total possible values are divided in 4 parts and each part correspoits to one bin. The total possible values for variable "y" are 8. They are divided in to 4 groups. 

Bin[0] for 0 and 1 Bin[1] for 2 and 3 Bin[2] for 4 and 5 Bin[3] for 6 and 7 

Varible Y is assigned values 3,5 and 6. Values 3,5 and 6 belongs to bins bin[1],bin[2] and bin[3] respectively. Bin[0] is not covered. 

Coverage report: -------------------- VARIABLE : cover_point_y Expected : 4 Covered : 3 Percent: 75.00 

Uncovered bins ------------------ auto[0:1] 

Covered bins ------------------ auto[2:3] auto[4:5] auto[6:7] 

Example of enum data type: For Enum data type, the numbers of bins are equal to the number of elements of enum data type. The bin identifiers are the enum member name. 

typedef enum { A,B,C,D } alpha; program main; alpha y; alpha values[$]= '{A,B,C}; 

covergroup cg; cover_point_y : coverpoint y; endgroup 

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

endprogram 

In The above example, the variable "y" is enum data type and it can have 4 enum members A,B,C and D. Variable Y is assigned only 3 Enum members A,B and C. 

Coverage report: --------------------- VARIABLE : cover_point_y Expected : 4 Covered : 3 Percent: 75.00 

Uncovered bins -------------------- auto_D 

Covered bins -------------------- auto_C auto_B auto_A 

EXPLICIT BIN CREATION  

Explicit bin creation is recommended method. Not all values are interesting or relevant in a cover point, so when the user knows the exact values he is going to cover, he can use explicit bins. You can also name the bins. 

program main; bit [0:2] y; bit [0:2] values[$]= '{3,5,6}; 

covergroup cg; cover_point_y : coverpoint y { bins a = {0,1}; bins b = {2,3}; bins c = {4,5}; bins d = {6,7}; } 

endgroup 

cg cg_inst = new(); initial 

foreach(values[i]) begin y = values[i]; cg_inst.sample(); end 

endprogram 

In the above example, bins are created explicitly. The bins are named a,b,c and d. 

Coverage report: ------------------- VARIABLE : cover_point_y Expected : 4 Covered : 3 Percent: 75.00 

Uncovered bins -------------------- a 

Covered bins -------------------- b c d 

Array Of Bins  

To create a separate bin for each value (an array of bins) the square brackets, [], must follow the bin name. 

program main; bit [0:2] y; 

bit [0:2] values[$]= '{3,5,6}; 

covergroup cg; cover_point_y : coverpoint y { bins a[] = {[0:7]}; } 

endgroup 

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

endprogram 

In the above example, bin a is array of 8 bins and each bin associates to one number between 0 to 7. 

Coverage report: -------------------- VARIABLE : cover_point_y Expected : 8 Covered : 3 Percent: 37.50 

Uncovered bins ------------------- a_0 a_1 a_2 a_4 a_7 

Covered bins ------------------- a_3 a_5 

a_6 

To create a fixed number of bins for a set of values, a number can be specified inside the square brackets. 

program main; bit [0:3] y; bit [0:2] values[$]= '{3,5,6}; 

covergroup cg; cover_point_y : coverpoint y { bins a[4] = {[0:7]}; } 

endgroup 

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

endprogram 

In the above example, variable y is 4 bit width vector. Total possible values for this vector are 16. But in the cover point bins, we have giving the interested range as 0 to 7. So the coverage report is calculated over the range 0 to 7 only. In this example, we have shown the number bins to be fixed to size 4. 

Coverage report: -------------------- VARIABLE : cover_point_y 

Expected : 4 Covered : 3 Percent: 75.00 

Uncovered bins ------------------- a[0:1] 

Covered bins ------------------ a[2:3] a[4:5] a[6:7] 

Default Bin  

The default specification defines a bin that is associated with none of the defined value bins. The default bin catches the values of the coverage point that do not lie within any of the defined bins. However, the coverage calculation for a coverage point shall not take into account the coverage captured by the default bin. 

program main; bit [0:3] y; bit [0:2] values[$]= '{3,5,6}; 

covergroup cg; cover_point_y : coverpoint y { bins a[2] = {[0:4]}; bins d = default; } 

endgroup 

cg cg_inst = new(); initial foreach(values[i]) begin y = values[i]; 

cg_inst.sample(); end 

endprogram 

In the above example, we have specified only 2 bins to cover values from 0 to 4. Rest of values are covered in default bin ~Sd~T which is not using in calculating the coverage percentage. 

Coverage report: -------------------- VARIABLE : cover_point_y Expected : 2 Covered : 1 Percent: 50.00 

Uncovered bins ------------------ a[0:1] 

Covered bins ---------------- a[2:4] 

Default bin ----------------- d 

TRANSITION BINS  

Transitional functional point bin is used to examine the legal transitions of a value. SystemVerilog allows to specifies one or more sets of ordered value transitions of the coverage point. 

Type of Transitions: 

 Single Value Transition  Sequence Of Transitions 

 Set Of Transitions  Consecutive Repetitions  Range Of Repetition  Goto Repetition  Non Consecutive Repetition 

Single Value Transition  

Single value transition is specified as: value1 => value2 

program main; bit [0:3] y; bit [0:2] values[$]= '{3,5,6}; 

covergroup cg; cover_point_y : coverpoint y { bins tran_34 = (3=>4); bins tran_56 = (5=>6); } 

endgroup 

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

endprogram 

In the above example, 2 bins are created for covering the transition of point "y" from 3 to 4 and other for 5 to 6. The variable y is given the values and only the transition 5 to 6 is occurring. 

Coverage report: -------------------- VARIABLE : cover_point_y Expected : 2 Covered : 1 Percent: 50.00 

Uncovered bins ------------------ tran_34 

Covered bins ---------------- tran_56 

Sequence Of Transitions  

A sequence of transitions is represented as: value1 => value3 => value4 => value5 

In this case, value1 is followed by value3, followed by value4 and followed by value5. A sequence can be of any arbitrary length. 

program main; bit [0:3] y; bit [0:2] values[$]= '{3,5,6}; 

covergroup cg; cover_point_y : coverpoint y { bins tran_345 = (3=>4>=5); bins tran_356 = (3=>5=>6); } 

endgroup 

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

endprogram 

In the above example, 2 bins re created for covering the transition of point "y" from 3 to 4 to 5 and other for 3 to 5 to 6. The variable y is given the values and only the transition 3 to 5 to 6 is occurring. 

Coverage report: -------------------- VARIABLE : cover_point_y Expected : 2 Covered : 1 Percent: 50.00 

Uncovered bins ------------------ tran_345 

Covered bins ----------------- tran_356 

Set Of Transitions  

A set of transitions can be specified as: range_list1 => range_list2 

program main; bit [0:3] y; bit [0:2] values[$]= '{3,5,6}; 

covergroup cg; cover_point_y : coverpoint y { bins trans[] = (3,4=>5,6); } 

endgroup 

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

endprogram 

In the above example, bin trans creates 4 bin for covering 3=>5,4=>5,3=>6 and 4=>6. 

Coverage report: -------------------- VARIABLE : cover_point_y Expected : 4 Covered : 1 Percent: 25.00 

Uncovered bins ------------------ tran_34_to_56:3->6 tran_34_to_56:4->5 tran_34_to_56:4->6 

Covered bins 

---------------- tran_34_to_56:3->5 

Consecutive Repetitions  

Consecutive repetitions of transitions are specified using trans_item [* repeat_range ] 

Here, trans_item is repeated for repeat_range times. For example, 3 [* 5] is the same as 3=>3=>3=>3=>3 

program main; bit [0:3] y; bit [0:2] values[$]= '{3,3,3,4,4}; 

covergroup cg; cover_point_y : coverpoint y { bins trans_3 = (3[*5]); bins trans_4 = (4[*2]); } 

endgroup 

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

endprogram 

Coverage report: -------------------- VARIABLE : cover_point_y 

Expected : 2 Covered : 1 Percent: 50.00 

Uncovered bins ------------------ trans_3 

Covered bins ---------------- trans_4 

Range Of Repetition  

An example of a range of repetition is: 3 [* 3:5] is the same as 3=>3=>3, 3=>3=>3=>3, 3=>3=>3=>3=>3 

program main; bit [0:3] y; bit [0:2] values[$]= '{4,5,3,3,3,3,6,7}; 

covergroup cg; cover_point_y : coverpoint y { bins trans_3[] = (3[*3:5]); } 

endgroup 

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

endprogram 

In the above example, only the sequence 3=>3=>3=>3 is generated. Other expected sequences 3=>3=>3 and 3=>3=>3=>3=>3 are not generated. 

Coverage report: -------------------- VARIABLE : cover_point_y Expected : 3 Covered : 1 Percent: 33.33 

Uncovered bins ------------------ tran_3:3[*3] tran_3:3[*5] 

Covered bins ---------------- tran_3:3[*4] 

Goto Repetition  

The goto repetition is specified using: trans_item [-> repeat_range]. The required number of occurrences of a particular value is specified by the repeat_range. Any number of sample points can occur before the first occurrence of the specified value and any number of sample points can occur between each occurrence of the specified value. The transition following the goto repetition must immediately follow the last occurrence of the repetition. For example: 3 [-> 3] is the same as ...=>3...=>3...=>3 

where the dots (...) represent any transition that does not contain the value 3. 

A goto repetition followed by an additional value is represented as follows: 1 => 3 [ -> 3] => 5 is the same as 1...=>3...=>3...=>3 =>5 

program main; bit [0:3] y; bit [0:2] values[$]= '{1,6,3,6,3,6,3,5}; 

covergroup cg; cover_point_y : coverpoint y { bins trans_3 = (1=>3[->3]=>5); } 

endgroup 

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

endprogram 

Coverage report: -------------------- VARIABLE : cover_point_y Expected : 1 Covered : 1 Percent: 100.00 

Non Consecutive Repetition  

The nonconsecutive repetition is specified using: trans_item [= repeat_range]. The required number of occurrences of a particular value is specified by the repeat_range. Any number of sample points can occur before the first occurrence of

the specified value and any number of sample points can occur between each occurrence of the specified value. The transition following the nonconsecutive repetition may occur after any number of sample points so long as the repetition value does not occur again. 

For example: 3 [= 2] is same as ...=>3...=>3 

A nonconsecutive repetition followed by an additional value is represented as follows: 1 => 3 [=2] => 5 is the same as 1...=>3...=>3...=>5 

program main; bit [0:3] y; bit [0:2] values[$]= '{1,6,3,6,3,6,5}; 

covergroup cg; cover_point_y : coverpoint y { bins trans_3 = (1=>3[=2]=>5); } 

endgroup 

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

endprogram 

Coverage report: -------------------- VARIABLE : cover_point_y Expected : 1 

Covered : 1 Percent: 100.00 

WILDCARD BINS  

By default, a value or transition bin definition can specify 4-state values. When a bin definition includes an X or Z, it indicates that the bin count should only be incremented when the sampled value has an X or Z in the same bit positions. The wildcard bins definition causes all X, Z, or ? to be treated as wildcards for 0 or 1 (similar to the ==? operator). For example: 

wildcard bins g12_16 = { 4'b11?? }; 

The count of bin g12_16 is incremented when the sampled variable is between 12 and 16: 

1100 1101 1110 1111 

program main; reg [0:3] y; reg [0:3] values[$]= '{ 4'b1100,4'b1101,4'b1110,4'b1111}; 

covergroup cg; cover_point_y : coverpoint y { wildcard bins g12_15 = { 4'b11?? } ; } 

endgroup 

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

endprogram 

Coverage report: -------------------- VARIABLE : cover_point_y Expected : 1 Covered : 1 Percent: 100.00 

Covered bin --------------- g12_15 Number of times g12_15 hit : 4 

Similarly, transition bins can define wildcard bins. For example: 

wildcard bins T0_3 = (2'b0x => 2'b1x); 

The count of transition bin T0_3 is incremented for the following transitions (as if by (0,1=>2,3)): 

00 => 10 , 00 => 11, 01 => 10 , 01 => 11 

program main; reg [0:1] y; reg [0:1] values[$]= '{ 2'b00,2'b01,2'b10,2'b11}; 

covergroup cg; cover_point_y : coverpoint y { wildcard bins trans = (2'b0X => 2'b1X ); } 

endgroup 

cg cg_inst = new(); 

initial foreach(values[i]) begin y = values[i]; cg_inst.sample(); end 

endprogram 

Coverage report: -------------------- VARIABLE : cover_point_y Expected : 1 Covered : 1 Percent: 100.00 

Covered bin --------------- trans Number of times trans hit : 1 (01 => 10) 

IGNORE BINS  

A set of values or transitions associated with a coverage-point can be explicitly excluded from coverage by specifying them as ignore_bins. 

program main; bit [0:2] y; bit [0:2] values[$]= '{1,6,3,7,3,4,3,5}; 

covergroup cg; cover_point_y : coverpoint y { ignore_bins ig = {1,2,3,4,5}; } 

endgroup 

cg cg_inst = new(); initial foreach(values[i]) 

begin y = values[i]; cg_inst.sample(); end 

endprogram 

In the above program, total possible values for y are 0 to 7. Ignore_bins specified to Ignored values between 1 to 5. So the Expected values are 0,6 and 7. Out of these expected values, only 6 and 7 are generated. 

Coverage report: -------------------- VARIABLE : cover_point_y Expected : 3 Covered : 2 Percent: 66.66 

Uncovered bins ------------------ auto[0] 

Excluded/Illegal bins ------------------------- ig auto[1] auto[2] auto[3] auto[4] auto[5] 

Covered bins ---------------- auto[6] auto[7] ILLEGAL BINS  

A set of values or transitions associated with a coverage-point can be marked as

illegal by specifying them as illegal_bins. All values or transitions associated with illegal bins are excluded from coverage. If an illegal value or transition occurs, a runtime error is issued. 

program main; bit [0:2] y; bit [0:2] values[$]= '{1,6,3,7,3,4,3,5}; 

covergroup cg; cover_point_y : coverpoint y { illegal_bins ib = {7}; } 

endgroup 

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

endprogram 

Result: ------------ ** ERROR ** Illegal state bin ib of coverpoint cover_point_y in covergroup cg got hit with value 0x7 

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[3] auto[2] auto[1] auto[1] 

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[0],j[0]> <i[1],j[0]> <i[0],j[1]> <i[1],j[1]> Cross x2 has the following bins: i_zero <i[1],j[0]> <i[1],j[1]> 

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. 

Weight  

Syntax : weight= number default value: 1 

Description : If set at the covergroup syntactic level, it specifies the weight of this covergroup instance for computing the overall instance coverage of the simulation. If set at the coverpoint (or cross) syntactic level, it specifies the weight of a coverpoint (or cross) for computing the instance coverage of the enclosing covergroup. The specified weight shall be a non-negative integral value. 

Goal  

Syntax :goal=number default value: 100 

Description : Specifies the target goal for a covergroup instance or for a coverpoint or a cross of an instance. 

Name  

Syntax :name=string default value:unique name 

Description : Specifies a name for the covergroup instance. If unspecified, a unique name for each instance is automatically generated by the tool. 

Comment  

Syntax :comment=string default value: "" 

Description : 

A comment that appears with a covergroup instance or with a coverpoint or cross of the covergroup instance. The comment is saved in the coverage database and included in the coverage report. 

At_least  

Syntax :at_least=number default value: 1 

Description : Minimum number of hits for each bin. A bin with a hit count that is less than number is not considered covered. 

Detect_overlap  

Syntax :detect_overlap=Boolean default value: 0 

Description : When true, a warning is issued if there is an overlap between the range list (or transition list) of two bins of a coverpoint. 

Auto_bin_max  

Syntax :auto_bin_max=number default value: 64 

Description : Maximum number of automatically created bins when no bins are explicitly defined for a coverpoint. 

Cross_num_print_missing  

Syntax :cross_num_print_missing=number default value: 0 

Description : Number of missing (not covered) cross product bins that shall be saved to the coverage database and printed in the coverage report. 

Per_instance  

Syntax :per_instance=Boolean default value: 0 

Description : Each instance contributes to the overall coverage information for the covergroup type. When true, coverage information for this covergroup instance shall be saved in the coverage database and included in the coverage report. When false, implementations are not required to save instance-specific information. 

Get_inst_coverage  

Syntax :get_inst_coverage=Boolean default value: 0 

Description : Only applies when the merge_instances type option is set . Enables the tracking of per instance coverage with the get_inst_coverage built-in method. When false, the value returned by get_inst_coverage shall equal the value returned by get_coverage 

Following Table summarizes the syntactical level (covergroup, coverpoint, or cross)

in which type options can be specified. 

 

COVERAGE METHODS  

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

 void sample(): Description : Triggers sampling of the covergroup 

 real get_coverage() real get_coverage(ref int, ref int) Description : Calculates type coverage number (0...100) The get_coverage() method returns the cumulative (or type) coverage, which considers the contribution of all instances of a particular coverage item. and it is a static method that is available on both types (via the :: operator) and instances (using the "." operator). 

The get_coverage() method both accept an optional set of arguments, a pair of int values passed by reference. When the optional arguments are specified, the get_coverage() method assign to the first argument the value of the covered bins, and to the second argument the number of bins for the given coverage item. These two values correspond to the numerator and the denominator used for calculating the particular coverage number (i.e., the return value before scaling by 100). 

 real get_inst_coverage() real get_inst_coverage(ref int, ref int) Description : Calculates the coverage number (0...100) get_inst_coverage() method returns the coverage of the specific instance on which

it is invoked, thus, it can only be invoked via the "." operator. 

The get_inst_coverage() method both accept an optional set of arguments, a pair of int values passed by reference. When the optional arguments are specified, the get_inst_coverage() method assign to the first argument the value of the covered bins, and to the second argument the number of bins for the given coverage item. These two values correspond to the numerator and the denominator used for calculating the particular coverage number (i.e., the return value before scaling by 100). 

 void set_inst_name(string) Description : Sets the instance name to the given string 

 void start() Description : Starts collecting coverage information 

 void stop() Description : Stops collecting coverage information 

 

SYSTEM TASKS  

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 types. This number is computed as described above. 

COVER PROPERTY  

Cover statement can be used to monitor sequences and other behavioral aspects of the design. The tools can gather information about the evaluation and report the results at the end of simulation. When the property for the cover statement is successful, the pass statements can specify a coverage function, such as monitoring all paths for a sequence. The pass statement shall not include any concurrent assert, assume or cover statement. A cover property creates a single cover point. 

Coverage results are divided into two: coverage for properties, coverage for sequences. For sequence coverage, the statement appears as: 

Cover property ( sequence_expr ) statement_or_null 

Cover Property Results  

The results of coverage statement for a property shall contain:  Number of times attempted  Number of times succeeded  Number of times failed  Number of times succeeded because of vacuity 

In addition, statement_or_null is executed every time a property succeeds. 

Vacuity rules are applied only when implication operator is used. A property succeeds non-vacuously only if the consequent of the implication contributes to the success. 

Cover Sequence Results  

Results of coverage for a sequence shall include:  Number of times attempted  Number of times matched (each attempt can generate multiple matches) 

In addition, statement_or_null gets executed for every match. If there are multiple matches at the same time, the statement gets executed multiple times, one for each match. 

It is recommended to cover sequences and not properties and its easy to convert a property into a sequence if required. 

(S) Coverage property can be declared in 

 A design or a separate module  Packages  Interfaces  Program block 

Cover properties are not allowed in class. 

Comparison Of Cover Property And Cover Group.  

Cover groups can reference data sets where as cover property references a temporal expression. 

 Cover group can be triggered using .sample method () Cover property dont have this option. 

 Cover group has multiple bins options. Cover property has only one bin. 

 Cover group cannot handle complex temporal relationships. Cover properties can cover complex temporal expressions. 

 Cover group automatically handles the crosses. Cover properties cannot do crosses. 

 Cover group has lot of filtering options. Cover property has no specific filtering constructs but it can be filtered. 

 Cover properties cannot be used in classes. Cover groups can be used in classes. So, cover groups can reference the variables in class. 

 Cover groups are most useful at a higher level of abstractions where as cover property makes sense to use when we want to work at low level signals. 

We can mix cover group and cover property to gain the OO and temporal advantages. Using properties for temporal expressions and trigger the cover group.