Section 18.3 Using covergroup in classes
REPLACE
When a covergroup is defined within a class and no explicit variables of that covergroup are declared in the class, then a variable with the same name as the coverage group is implicitly declared, e.g, in the above example, a variable cov1 (of the embedded coverage group) is implicitly declared. Whether the coverage group variable is implicitly or explicitly declared, each class contains exactly one variable of each embedded coverage group. Each embedded coverage group thus becomes part of the class, tightly binding the class properties to the coverage definition. Declaring multiple variables of the same embedded coverage group shall result in a compiler error.
WITH
A covergroup declaration within a class is an embedded covergroup declaration. An embedded covergroup declaration declares an anonymous covergroup type and an instance variable of the anonymous type. The covergroup_identifier defines the name of the instance variable. In the above example, a variable cov1 (of the anonymous coverage group) is implicitly declared.
UPDATE
An embedded covergroup variable may only be assigned in the new method. An embedded coverage group must can be explicitly instantiated in the new method. If it is not, then the coverage group is not created and no data will be sampled.
Section 18.2 - Syntax 18-1—Covergroup syntax
DELETE
variable_decl_assignment ::=
...
| [ covergroup_variable_identifier ] = new [ ( list_of_arguments ) ]15
DELETE note 15
15. It shall be legal to omit the covergroup_variable_identifier from a covergroup instantiation is within a class that has no other instantiation of the covergroup.
Annex A.2.4 Declaration assignments
MODIFY
variable_decl_assignment ::=
variable_identifier { variable_dimension } [ = expression ]
| dynamic_array_variable_identifier [ ] [ = dynamic_array_new ]
| class_variable_identifier [ = class_new ]
| [ covergroup_variable_identifier ] = new [ ( list_of_arguments ) ]15
Annex A.10 Footnotes (normative)
DELETE
15) It shall be legal to omit the covergroup_variable_identifier from a covergroup instantiation only if this implicit instantiation is within a class that has no other instantiation of the covergroup.