|
|
|
|
|
|
|
|
|
|
|
|
Introduction to Coverage
|
|
|
Typically in verification flow, we do code coverage, but doing code coverage shows only if all the lines of the DUT is executed, if all the possible cases of a expression are covered. Which is kind of ok to start with, but it is no way good for saying that verification is completed. |
|
|
|
|
|
For declaring a verification to be complete we need to check also if all the functions of DUT are tested or not. Like to say if read followed by write to same address of a memory did it happen or to say if 64 Bytes packets happened when port mirroring is enabled. |
|
|
|
|
|
Typically when we start documenting test cases in test plan document, we also start documenting functional coverage plan. So when we start coding testbench, we code coverage along testbench. E language gives very good set of features that are useful in measuring coverage. |
|
|
|
|
|
Defining Coverage Groups
|
|
|
Defines a coverage group. A coverage group is struct member that contains a list of data items for which data is collected over time. Once data coverage items have been defined in a coverage group, they can be used to define special coverage group items called transition and cross items. The is keyword can also be used to define a new coverage group. |
|
|
|
|
|
The sampling event of a coverage group cannot be defined in a when subtype of a struct. However, a coverage group that uses an event defined in a parent struct can be defined in a when subtype. If they are extended by adding a per_instance item, the instances refer only to the when subtype. If a per_instance item is instead defined in a base type and additional items are added under the when construct, then the cover group instances refer to the base type and the cover item values refer to the when subtype. |
|
|
|
|
|
The empty keyword can be used to define an empty coverage group that will be extended later by using a cover is also struct member with the same name |
|
|
|
|
|
Syntax
|
|
|
|
|
|
cover event-type [using coverage-group-option, ...] is {
coverage-item-definition; ...
};
|
|
|
|
|
|
|
|
|
|
|
|
Example Define Coverage Group
|
|
|
|
|
|
1 <'
2 type cpu_opcode: [ADD, SUB, OR, AND, JMP, LABEL];
3 type cpu_reg: [reg0, reg1, reg2, reg3];
4
5 struct inst {
6 opcode: cpu_opcode;
7 op1: cpu_reg;
8 op2: byte;
9 event info;
10 event data_change;
11 event inst_driven;
12 cover data_change using no_collect is {
13 item data: uint(bits:16) = op2;
14 };
15 cover info is {
16 item opcode;
17 };
18 cover inst_driven is {
19 item opcode;
20 item op1;
21 };
22
23 post_generate() is also {
24 emit info;
25 emit data_change;
26 emit inst_driven;
27 };
28 };
29
30 extend sys {
31 inst : inst;
32 run() is also {
33 for {var i: uint = 0; i < 10 ; i = i + 1} do {
34 gen inst;
35 print inst;
36 };
37 };
38 };
39 '>
You could download file coverage1.e here
|
|
|
|
|
|
Simulation log
|
|
|
|
|
|
inst = inst-@0: inst of unit: sys
---------------------------------------------- @coverage1
0 opcode: ADD
1 op1: reg3
2 op2: 59
inst = inst-@1: inst of unit: sys
---------------------------------------------- @coverage1
0 opcode: OR
1 op1: reg3
2 op2: 90
inst = inst-@2: inst of unit: sys
---------------------------------------------- @coverage1
0 opcode: SUB
1 op1: reg3
2 op2: 188
inst = inst-@3: inst of unit: sys
---------------------------------------------- @coverage1
0 opcode: JMP
1 op1: reg3
2 op2: 97
inst = inst-@4: inst of unit: sys
---------------------------------------------- @coverage1
0 opcode: OR
1 op1: reg1
2 op2: 105
inst = inst-@5: inst of unit: sys
---------------------------------------------- @coverage1
0 opcode: LABEL
1 op1: reg2
2 op2: 4
inst = inst-@6: inst of unit: sys
---------------------------------------------- @coverage1
0 opcode: SUB
1 op1: reg1
2 op2: 14
inst = inst-@7: inst of unit: sys
---------------------------------------------- @coverage1
0 opcode: LABEL
1 op1: reg3
2 op2: 204
inst = inst-@8: inst of unit: sys
---------------------------------------------- @coverage1
0 opcode: JMP
1 op1: reg2
2 op2: 170
inst = inst-@9: inst of unit: sys
---------------------------------------------- @coverage1
0 opcode: LABEL
1 op1: reg0
2 op2: 250
Wrote 1 cover_struct to coverage1_1.ecov
|
|
|
|
|
|
Coverage report
|
|
|
|
|
|
Cover group: inst.info
======================
Grade: 0.83 Weight: 1
** opcode **
Samples: 11 Tests: 1 Grade: 0.83 Weight: 1
grade goal samples tests %t opcode
------------------------------------------------
1.00 1 1 1 9 ADD
1.00 1 2 1 18 SUB
1.00 1 3 1 27 OR
0.00 1 0 0 0 AND
1.00 1 2 1 18 JMP
1.00 1 3 1 27 LABEL
Cover group: inst.inst_driven
=============================
Grade: 0.92 Weight: 1
** opcode **
Samples: 11 Tests: 1 Grade: 0.83 Weight: 1
grade goal samples tests %t opcode
------------------------------------------------
1.00 1 1 1 9 ADD
1.00 1 2 1 18 SUB
1.00 1 3 1 27 OR
0.00 1 0 0 0 AND
1.00 1 2 1 18 JMP
1.00 1 3 1 27 LABEL
** op1 **
Samples: 11 Tests: 1 Grade: 1.00 Weight: 1
grade goal samples tests %t op1
------------------------------------------------
1.00 1 1 1 9 reg0
1.00 1 2 1 18 reg1
1.00 1 2 1 18 reg2
1.00 1 6 1 55 reg3
|
|
|
|
|
|
Example Turn off Coverage
|
|
|
|
|
|
1 <'
2 extend sys {
3 setup() is also {
4 set_config(cover, mode, off); //turns off coverage collection
5 };
6 };
7 '>
You could download file coverage2.e here
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Copyright © 1998-2014 |
Deepak Kumar Tala - All rights reserved |
Do you have any Comment? mail me at:deepak@asic-world.com
|
|