|
|
1 class coverage_not_state {
2 bit [3:0] value;
3 event now;
4
5 coverage_group something {
6 sample_event = sync(ALL,now);
7 sample value {
8 state AB_0 (0:7);
9 state AB_1 (8:14);
10 bad_state AB_BAD (not state);
11 }
12 }
13
14 task update_coverage (bit [3:0] value) {
15 this.value = value;
16 trigger(now);
17 }
18 }
19
20
21
22 program test {
23 coverage_not_state cov = new();
24 bit [3:0] v;
25 repeat (10) {
26 v = urandom__range(14,0);
27 printf("Value is %d\n",v);
28 cov.update_coverage(v);
29 delay(1);
30 }
31 // This should cause verification error
32 v = 15;
33 printf("Value is %d\n",v);
34 cov.update_coverage(v);
35 delay(1);
36 }
You could download file coverage_not_state.vr here
|