User guide
24-230
SystemVerilog Testbench Constructs
Predefined Coverage Methods
SystemVerilog provides a set of predefined covergroup methods
described in this section. These predefined methods can be invoked
on an instance of a covergroup. They follow the same syntax as
invoking class functions and tasks on an object.
Predefined Coverage Group Functions
The predefined methods supported at this time are:
• get_coverage()
• get_inst_coverage()
• set_inst_name(string)
• sample()
• stop()
•start()
get_coverage()
Calculates the coverage number for the covergroup type (see
page 228 for definition). Return type: real.
Below is an example of using get_coverage() to calculate the
coverage number of a covergroup:
program test();
reg clk = 0;
reg [2:0] var = 3'b001;
class A;
covergroup covType @(clk); //covergroup, covType, defined
//in class A,
cp1: coverpoint var {