Tutorials

Learn More

A coverpoint is an integral expression or variable that has to be covered on sampling the covergroup. A covergroup can have one or more coverage points that can be labeled. Each coverpoint is associated with single or multiple bins that can be explicitly defined.

Syntax:

covergroup <covergroup_name>;
  <coverpoint label>: coverpoint <coverpoint_name>;
  <coverpoint label>: coverpoint <coverpoint_name>;
  ...
endgroup

//Example:
covergroup cg @(posedge clk); 
  cp1: coverpoint addr; 
  cp2: coverpoint data; 
endgroup : cg

Bins in functional coverage

The construct bins provide a facility to create a set of bins for a particular range or all possible values in the range for the mentioned coverpoint variable.

  1. The bins can be generated automatically or explicitly written by an engineer.
  2. They can be excluded or ignored from the coverage. 
  3. They can also be marked as illegal.

Syntax:

covergroup <covergroup_name>;
<coverpoint label>: coverpoint <coverpoint_name> {bins <bin_name> = {<values>} };
  ...
endgroup

Without explicit bins declaration

module func_coverage;
  logic [3:0] addr;
  logic [2:0] data;
  logic en;

  covergroup c_group;
    cp1: coverpoint addr;
    cp2: coverpoint data;
    cp3: coverpoint en;
  endgroup

  c_group cg = new();
  ...
  ...
endmodule

Since bins are explicitly specified. They are auto-generated as follows.

variables

bins

addr

cp1.auto[0], cp1.auto[1], … cp1.auto[15]

data

cp2.auto[0], cp2.auto[1], … cp2.auto[7]

en

cp3.auto[0], cp1.auto[1]

With explicit bins declaration

module func_coverage;
  logic [3:0] addr; 
  logic [2:0] data;
  logic en;

  covergroup c_group; 
    cp1: coverpoint addr {bins b1 = {1, 10, 12};
                          bins b2[] = {[2:9], 11};
                          bins b3[4] = {0:8};
                         }
    cp2: coverpoint data {bins b1 = {4,$};
                          bins b2[] = {2, 3, 6};
                         }
    cp3: coverpoint en {bins b1 = {1}; }
  endgroup

  c_group cg = new();
  ...
  ...
endmodule

variables

bins

Description

addr

bins b1 = {1, 10, 12};

Constructs single bin for 1, 10, 12 value. 

bins b2[] = {[2:9], 11};

Constructs 2 bins ie.
b2[0] = 2 ~9,
b2[1] = 11.

bins b3[4] = {0:7};

Constructs 4 bins with possible values as
b3[0] = 0 ~1,
b3[1] = 1~2,

b3[2] = 3~4,

b3[3] = 5~7,

data

bins b1 = {4,$};

Constructs single bin for 4~7

bins b2[] = {2, 3, 6};

Constructs 3 bins as

b2[0] = 2,

b2[1] = 3,

b2[2] = 6,

en

bins b1 = {1};

Constructs single bin for value = 1