covergroup_declaration ::= // from Annex A.2.11
covergroup covergroup_identifier [ (list_of_tf_proto_formals [ tf_port_list ] ) ] [ coverage_event
] ;
{ coverage_spec_or_option ; }
endgroup [ : covergroup_identifier ]
coverage_spec_or_option ::=
{attribute_instance}
coverage_spec
| {attribute_instance}
coverage_option ;
hierarchical_btf_identifier :: =
hierarchical_tf_identifier
| hierarchical_block_identifier
| hierarchical _identifier { [ class_scope :: ]
} method_identifier
If a clocking event is
specified, it defines the event at which coverage points are sampled. If the
clocking event is omitted, users must procedurally trigger the coverage sampling.
This is done via the built-in sample() method (see Section 20.7). Optionally, the strobe
option can be used to modify the
sampling behavior. When the strobe option is not set (the default), a coverage
point is sampled the instant the clocking event takes place, as if the process
triggering the event were to call the built-in sample() method. If the clocking event occurs multiple times in
a time step, the coverage point will also be sampled multiple times. The strobe
option (see Section 20.6.1) can be used to specify that coverage points are
sampled in the postponed region, thereby filtering multiple clocking events so
that only one sample per time slot is taken.
bins_or_options ::=
coverage_option
| [ wildcard ] bins_keyword bin_identifier [ [ [ expression
] ] ] = { range_list
} [ iff ( expression ) ]
| [ wildcard] bins_keyword bin_identifier [ [ ] ] = ( trans_list ) [ iff ( expression ) ]
| bins_keyword bin_identifier [ [ [ expression ] ]
] = default [ iff ( expression ) ]
| bins_keyword bin_identifier = default sequence [ iff ( expression ) ]
int bit [9:0] v_a;
covergroup
cg @(posedge clk);
coverpoint
v_a
{
bins
a = { [0:63],65 };
bins
b[] = { [127:150],[148:191] }; // note overlapping values
bins
c[] = { 200,201,202 };
bins d = { [1000:$] };
bins
others[] = default;
}
endgroup
In the example above, the
first bins construct
associates bin a1 a with the values of variable v_a between 0 and 63, and the value 65. The second bins
construct creates a set of 65 bins b[127], b[128],… b[191].
Likewise, the last third bins bins construct creates 3 bins: c[200], c[201],
and c[202]. The
fourth bins construct
associates bin d with the values between 1000 and 1023 ($ represents the
maximum value of v_a). Every value that does not match bins a, b[], or c[], or d[] is
added into its own distinct bin.
bins_or_options ::= // from Annex A.2.11
…
| [ wildcard ] bins_keyword bin_identifier [ [ [ expression
] ] ] = { range_list
} [ iff ( expression ) ]
| [ wildcard] bins_keyword bin_identifier [ [ ] ] = ( trans_list ) [ iff ( expression ) ]
…
trans_list ::= ( trans_set ) { , ( trans_set ) }
trans_range_list ::=
trans_item
| trans_item [ [ * repeat_range ] ]
| trans_item [ [ *–> [ –>repeat_range ] ]
| trans_item [ [ *= [ =repeat_range ] ]
trans_item ::= { range_list } | value_range
{range_list1} => {range_list2}
This specification expands
to transitions between each value in range_list1 and each value in
range_list2.
For example,
{1,5} => {6,
7}
Here, trans_item
is repeated for repeat_range times.
For example,
3 [* 5]
is the same as
3=>3=>3=>->3=>3
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
The repetition with non-consecutive
occurrence of a value is specified using: trans_item [*-> repeat_range ]. Here, the occurrence of a value is specified with an
arbitrary number of sample points where the value does not occur. For example,
3 [*->
3]
3 [*= 2]
bit
[4:1] v_a;
covergroup
cg @(posedge clk);
coverpoint
v_a
{
bins
sa = (4 => 5 => 6), ({[7:9],10}=>{11,12});
bins
sb[] = (4=> 5 => 6), ({ [7:9],10}=>{11,12});
bins allother = default sequence ;
}
endgroup
The example above defines two transition coverage bins. The first bins construct associates the following sequences with bin sa: 4=>5=>6, or 7=>11, 8=>11, 9=>11, 10=>11, 7=>12, 8=>12, 9=>12, 10=>12. The second bins construct associates an individual bin with each of the above sequences: sb[4=>5=>6], …,sb[10=>12]. The bin allother tracks all other transitions that are not covered by the other bins: sa and sb.
Transitions that specify
sequences of unbounded or undetermined varying length cannot be used with the
multiple bins construct (the [] notation).
For example, the length of the transition: 3[*=2], which uses non-consecutive repetition, is unbounded
and can vary during simulation. An attempt to specify multiple bins with such
sequences shall result in an error.
The count of transition bin
T0_3 is incremented for the following transitions (as if by ({0,1}=>{2,3})):
cover_cross ::= // from Annex A.2.11
[cover_point_identifer : ] cross cross list_of_coverpoints
[ iff ( expression ) ] select_bins_or_empty
bins_selection ::= bins_keyword bin_identifier = select_expression [ iff ( expression ) ]
The expression within the
optional iff
provides a conditional guard for the
cross coverage. If at any sample point, the condition evaluates to false, the
cross coverage is ignored. The expression within the
optional iff construct at the end of a cross bin
definition provides a per-bin guard condition. If the expression is false, the
cross bin is ignored.
covergroup
g1 (int
int w, string instComment) @(posedge clk) ;
b : coverpoint
b_var;
Syntax 20-5—Coverage option assignment syntax (not in Annex A)
covergroup
g1 (int
int w, string
string
instComment) @(posedge
clk) ;
b : coverpoint
b_var;
Syntax 20-6—Coverage type option assignment syntax (not in Annex A)