User guide

24-216
SystemVerilog Testbench Constructs
endprogram
This program contains the following:
The enumerated data type colors, with members named red, blue,
and yellow (whose default values are 0, 1, and 2).
A variable of type colors called my_color
A covergroup named cg1 that specifies the following:
- the clocking event that is the rising edge on signal clk.
- the coverage point that is to monitor the values of the variable
my_color. The identifier of the coverage point, for hierarchical
name purposes, is cp1.
an instantiation of covergroup cg1 using the new method.
A covergroup can be defined inside a class. Furthermore there can
be multiple covergroups in a class.
The following is an example of declaring a covergroup inside a class.
program P;
class MyClass;
int m_a;
covergroup Cov @(posedge clk);
coverpoint m_a;
endgroup
function new();
Cov = new;
endfunction
endclass
endprogram