|
|
1 class coverage_cross {
2 bit [1:0] value1;
3 bit [1:0] value2;
4 event now;
5
6 coverage_group something {
7 sample_event = sync(ALL,now);
8 sample value1,value2;
9 cross MY_CROSS (value1,value2);
10 }
11
12 task update_coverage (bit [1:0] value1,bit [1:0] value2) {
13 this.value1 = value1;
14 this.value2 = value2;
15 trigger(now);
16 }
17 }
18
19
20
21 program test {
22 coverage_cross cov = new();
23 bit [1:0] v1;
24 bit [1:0] v2;
25 repeat (10) {
26 v1 = random();
27 v2 = random();
28 printf("Value is %0d %0d\n",v1,v2);
29 cov.update_coverage(v1,v2);
30 delay(1);
31 }
32 }
You could download file coverage_cross.vr here
|