Functional coverage Flashcards

1
Q

How to detect overlapping bins

A

We can used below option

option.detect_overlap=boolean

Default value = false/0

When true, reports a warning for an overlap between the range list of the two bins of a coverpoint.

Applicable to CG & CP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Can we display uncovered bins

A

Below option saves uncovered cross-product bins in the coverage database and includes them in the coverage report.’

Applicable to only Cross coverpoint

options.cross_num_print_missing = <num></num>

Default value of num =0;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

I want to ensure that only multiple hits to a bin is contributing to coverage

A

We can customize the atleast count which is 1 by default

It can be applicable to both CG and CP

option.at_least = 10; // only when 10hits are reached, it is counted as covered

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What if I am ok with <100 coverage?

A

We can set the goal of covergroup to give value

covergroup cg;

option.goal = 80;

endgroup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Annotate covergroups

A

We can add comment to define covergroup

covergroup cg;

option.comment = “Sample CG”;

endgroup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is per instance coverage

A

Cases where we want to capture coverage per instance :

Say we have multiple instances of a driver which have CG defined

We have defined a generic CG and need to capture coverage separately for each instance

We use below option to CG

option.per_instance =1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Example of bins of cross coverage

A

covergroup Covport;

port: coverpoint tr.port {

bins port[] = {[0:$]};

}

kind: coverpoint tr.kind {

bins lo = {[$:5]};

bins hi[] = {[8:$]};

bins misc = default;

}

cross kind, port {

bins all_zero = binsof(port) intersect{0} && binsof(kind) intersect {0};

ignore_bins lo = binsof(kind.lo);

}

endgroup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do we exclude coverpoints from converage metric

A

For cases, where we only need cross coverage, and defined a coverpoint to facilitate cross coverage, we can set weight of coverpoint to 0.

addr : coverpoint tr.addr {

option.weight = 0;

}

len : coverpoint tr.len{

option.weight = 0;

}

cross addr,len;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to create generic cover groups

A

We can create covergroup, which take args, which are used internally.

This needs to be passed during construction : new()

Signal being passed should be using ref qualified. Otherwise only the signals at new will be sampled.

covergroup cg_addr(ref logic[31:0] addr,input int val) {

coverpoint addr {

bins low = {[$:val]};

bins high = {[val+1,$]};

}

option.per_instance =1;

endgroup

covergroup cg_addr;

cg_addr = new(tr.addr,5);

CG can also take constant as input, but ensure it is not of ref type, but input type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is cross coverage

A

Cross coverage is useful when we want to measure coverage of coverpoint combinations

It takes coverpoint or single variable name as argument

Here coverpoints should be local to the covergroup, and should be named

Like coverpoints, we can define bins for cross

covergroup CovPort;

kind: coverpoint tr.kind;

port : coverpoint tr.port;

cross kind, port;

endgroup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Can we catch incorrect traffic

A

We can use illegal_bins to generate error when we hit the defined bin

coverpoint tr.size {

illegal_bins unaliagned = { 0,1};

}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Do do we remove invalid bins

A

We can define explicitly all valid bins using “bins” construct.

However, we have huge bin set, but want to exclude for of the values, we can use ignore bins as below :

coverpoint tr.awsize {

–> ignore_bins unaligned = {0,1};

}

When used in combination with auto_bin_max , the value is applied as

{ actual domain - illegal domain } / val

not {actual_domain}/val - illegal_domain

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How to track transition coverage

A

We can add bins to define transition of coverpoints

Egs :

coverpoint tr.len {

bins rise_fall = (0=>1), (1=>0);

}

coverpoint irq {

bins assert_for_3_clks = (0=>1[*3] => 0);

}

coverpoint req {

bins req_for_3_to_5_clks = (0 =>1[*3:5] => 0);

}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How to control coverage sampling

A

Trigger event

covergroup cp @(event);
  cp1 : coverpoint addr;
endgroup
initial begin 
  cp c1 = new();
  ->event;
  addr = 1; -> event;
end

As sampling is controlled by event,we can disable sampling,
c1.stop();
c1.start();

Explicit trigger
Then we can call sample() on when we need to collect data
~~~
initial begin
cp c1 = new();
c1.sample();
end
~~~

Implicit trigger present :

Disable CG :

Define a disable condition in covergroup

coverpoint tr.addr iff( !apb.reset_n) {..}

coverpoint tr.len iff( error_event);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Examples of wildcards in functional coverage

A

We can use wildcards in defining list range, like in dynamic lists

coverpoint tr.len {

bins low = {2:4]};

bins mid = {5,6};

bins high = { [7:$] }; <--- here $ denotes highest valid value

bins misc = default ;

}

For defining bins with dontcare conditions :

coverpoint tr.addr[7:0] {

--> wildcard bins unaligned_addr { 8'h?1, 8'h?2, 8'h?3,

8'h?5, 8'h?6, 8'h?7};

wildcard bins aligned_addr { 8'h?0, 8'h?4 };
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

When do we need to define bins

A

Typically auto created bins cover the domain on all possible values, based on size of coverpoint variable/expression

However, we may want to define explicit bins if

Create a grouping on bins

coverpoint tr.addr {

bins high = { [7:10] };

bins mid= { 5,6 };

bins<- low = { [0:4] };

}

Sometimes expected values are not power of 2

coverpoint ->(tr.size + tr.len + 5’h0)<- {

bins len[]<- = { [0:23] };

}

17
Q

How to we limit number of bins created

A

We can use auto_bin_max option to control count of bins.

Can be used for CG or CP

options.auto_bin_max = <val></val>

18
Q

Where do you add covergroup

A

It is always best to define CG at the boundary btw TB and RTL

Sampling must wait stimulus is actually received by the DUT.

Care must be taken to discard stimulus coverage for error injection cases. Have separate CG for error stimulus

Best to add CG to static classes, like ENV,DRV, etc.

Do not define CG in dynamic objections such as TXs.

19
Q

What are bins?

A

They define the domain of possible values of a cover point.

They are automatically created for a defined CP., if nothing is explicitly specified.

We can limit the number of bins created using

coverpoint tr.addr {

options.auto_bin_max = <val>;</val>

}

20
Q

What is cover group? Elaborate on this?

A

Collection of cover points which are sampled at the same time

Definition

covergroup <name> (<optional>) <optional wait event);</optional></name>

endgroup

Creation :

It always has to be created using “new()”

Can take arguments in new function

Trigger :

Explicit sample :

cg.sample();

Event triggered sampling

covergroup cg @(posedge clk);

21
Q

What is cover point

A

Its a sampling point, which can be a variable or expression

Eg :

coverpoint tr.addr;

coverpoint {tr.len,tr.size};

22
Q

When you will say that verification is completed?

A

Measures used to ensure verification completeness

Code coverage

Functional coverage

Bug rate

Each of these metrics help in deciding verification closure

High CC, Low FC

Feature missing in Design

Feature covered, but test unable to reach it, may need to fine tune stimulus

High FC, Low CC

Inadequate vplan

Unreachable code

High BR

Design unstable??

23
Q

What is the importance of coverage in SystemVerilog verification?

A

Coverage is a generic term for measuring progress to complete design verification

Used as metric for verification completion

24
Q

What is code coverage

A

Measures how much of the design implementation is exercised by the tests

lines of code(line coverage),

which paths through the code (path coverage)

expressions (expression coverage),

variables values (toggle coverage),

states and transitions in a state machine (FSM coverage).

25
Q

What is Function coverage

A

measure of which design features have been exercised by the tests

tied to the design intent and is sometimes called “specification coverage,”