|
|
|
|
|
|
|
|
|
|
|
|
Instantiation of coverage_group
|
|
|
In order for coverage data to be collected, the declared coverage groups must be instantiated. Similar to classes in OpenVera, the coverage_group serves as a template that can be instantiated whenever needed. The construct can be defined as a top-level (file scope) construct or may be contained inside of a class. |
|
|
|
|
|
There are two types of instantiation based on definition of coverage_group. |
|
|
|
|
|
- Standalone Coverage Group : Once defined, a standalone coverage_group must be explicitly instantiated using the new() system call for coverage to be triggered.
- Instantiating Embedded Coverage Groups : Embedded coverage groups can be instantiated in one of two ways, either explicitly or implicitly. In addition, they can also be disabled using the null assignment statement.
|
|
|
|
|
|
|
|
|
|
|
|
Embedded Coverage Groups : Implicit
|
|
|
1 class coverage_covergroup {
2 // All variables declared here
3 integer abc;
4 bit [7:0] data;
5
6 // Declare coverage_groups here
7 coverage_group c1 {
8 sample_event = wait_var(abc);
9 // Body of coveragegroup here
10 sample data;
11
12 }
13
14 // All the class methods here
15 task new () {
16 // There is no new on coverage_group here
17 }
18 }
19
20 program test {
21 coverage_covergroup cov = new();
22 }
You could download file coverage_implicit.vr here
|
|
|
|
|
|
|
|
|
Embedded Coverage Groups : Explicit
|
|
|
1 class coverage_explicit {
2 bit [3:0] value;
3 event now;
4
5 coverage_group something {
6 sample_event = sync(ALL,now);
7 sample value;
8 }
9
10 task new () {
11 // Do explicit new on covergroup
12 something = new();
13 }
14
15 task update_coverage (bit [3:0] value) {
16 this.value = value;
17 trigger(now);
18 }
19 }
20
21 program test {
22 coverage_explicit cov = new();
23 bit [3:0] v;
24 repeat (10) {
25 v = random();
26 printf("Value is %d\n",v);
27 cov.update_coverage(v);
28 delay(1);
29 }
30 }
You could download file coverage_explicit.vr here
|
|
|
|
|
|
Embedded Coverage Groups : null
|
|
|
1 class coverage_null {
2 bit [3:0] value;
3 event now;
4
5 coverage_group something {
6 sample_event = sync(ALL,now);
7 sample value;
8 }
9
10 task update_coverage (bit [3:0] value) {
11 this.value = value;
12 trigger(now);
13 }
14 }
15
16 program test {
17 coverage_null cov = new();
18 bit [3:0] v;
19 // Disable coverage collection
20 cov.something = null;
21 repeat (10) {
22 v = random();
23 printf("Value is %d\n",v);
24 cov.update_coverage(v);
25 delay(1);
26 }
27 }
You could download file coverage_null.vr here
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Copyright © 1998-2014 |
Deepak Kumar Tala - All rights reserved |
Do you have any Comment? mail me at:deepak@asic-world.com
|
|