|
|
|
|
|
|
|
|
|
|
|
|
Defining Basic Coverage Items
|
|
|
Coverage item can be defined with below syntax |
|
|
|
|
|
item item-name[:type=exp] [using coverage-item-option, ...]
|
|
|
|
|
|
Parameter
|
Description
|
item-name
|
The name of the coverage item.
|
type=exp
|
Used to declare a new item.
|
coverage-item-option
|
Coverage item options as listed in below table
|
|
|
|
|
|
|
Options |
|
|
|
|
|
Option
|
Description
|
at_least=num
|
The minimum number of samples for each bucket of the item. Anything less than num is considered a hole.
|
ignore=item-bool-exp
|
Define values that are to be completely ignored. They do not appear in the statistics at all. The expression is a Boolean expression that can contain a coverage item name and constants.
|
illegal=item-bool-exp
|
Define values that are illegal. An illegal value causes a DUT error. If the check_illegal_immediately coverage configuration option is FALSE, the DUT error occurs during the check_test phase of the test. If that configuration option is TRUE, the DUT error occurs immediately (on the fly). Note that checking illegal values immediately has a significant negative impact on Specman performance.
|
no_collect=bool
|
When no_collect[=TRUE], this coverage item is not displayed in coverage reports and is not saved in the coverage files.
|
no_trace=bool
|
When no_trace[=TRUE], this item is not traced by the simulator. Use this option to collect data for echo event
|
num_of_buckets=num
|
Specifies how many buckets are to be created for the coverage item. This option overrides the max_int_buckets coverage configuration option for this coverage item. It cannot be used for string items or items that have ranges specified with the ranges coverage item option. It can be set to any value, including greater than max_int_buckets
|
per_instance=bool
|
When per_instance[=TRUE], coverage data is collected and graded for all the other items in a separate sub-group for each bucket of this item. This option can only be used for gradeable items.
|
radix=DEC|HEX|BIN
|
For items of type int or uint, specifies the radix used in coverage reports for implicit buckets. If the ranges option is not used to create explicit buckets for an item, a bucket is created for every value of the item that occurs in the test. Each different value sampled gets its own bucket, with the value as the name of the bucket. These are called implicit buckets.
|
ranges = {range(parameters);...}
|
Create buckets for this item's values or ranges of values. This option cannot be used for string items.
|
text=string
|
A text description for this coverage item. This can only be a quoted string, not a variable or expression. In the ASCII coverage report the text is shown along with the item name at the top of the coverage information for the item. In the Show Coverage GUI, the text is shown for each item.
|
weight=uint
|
Specifies the weight of the current item relative to other items in the same coverage group. It is a non-negative integer with a default of 1.
|
when=bool-exp
|
The item is sampled only when bool-exp is TRUE. The bool-exp is evaluated in the context of the parent struct.
|
|
|
|
|
|
|
|
|
|
|
|
|
Example
|
|
|
|
|
|
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 using per_instance, ignore = (opcode == ADD);
17 };
18 cover inst_driven is {
19 item opcode;
20 item op1 using at_least=2;
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 coverage3.e here
|
|
|
|
|
|
Simulation Output
|
|
|
|
|
|
inst = inst-@0: inst of unit: sys
---------------------------------------------- @coverage3
0 opcode: ADD
1 op1: reg3
2 op2: 59
inst = inst-@1: inst of unit: sys
---------------------------------------------- @coverage3
0 opcode: OR
1 op1: reg3
2 op2: 90
inst = inst-@2: inst of unit: sys
---------------------------------------------- @coverage3
0 opcode: SUB
1 op1: reg3
2 op2: 188
inst = inst-@3: inst of unit: sys
---------------------------------------------- @coverage3
0 opcode: JMP
1 op1: reg3
2 op2: 97
inst = inst-@4: inst of unit: sys
---------------------------------------------- @coverage3
0 opcode: OR
1 op1: reg1
2 op2: 105
inst = inst-@5: inst of unit: sys
---------------------------------------------- @coverage3
0 opcode: LABEL
1 op1: reg2
2 op2: 4
inst = inst-@6: inst of unit: sys
---------------------------------------------- @coverage3
0 opcode: SUB
1 op1: reg1
2 op2: 14
inst = inst-@7: inst of unit: sys
---------------------------------------------- @coverage3
0 opcode: LABEL
1 op1: reg3
2 op2: 204
inst = inst-@8: inst of unit: sys
---------------------------------------------- @coverage3
0 opcode: JMP
1 op1: reg2
2 op2: 170
inst = inst-@9: inst of unit: sys
---------------------------------------------- @coverage3
0 opcode: LABEL
1 op1: reg0
2 op2: 250
Wrote 1 cover_struct to coverage3_1.ecov
|
|
|
|
|
|
Coverage
|
|
|
|
|
|
Cover group: inst.info
======================
Grade: 0.80 Weight: 1
** opcode **
Samples: 10 Tests: 1 Grade: 0.80 Weight: 1
grade goal samples tests %t opcode
------------------------------------------------
1.00 1 2 1 20 SUB
1.00 1 3 1 30 OR
0.00 1 0 0 0 AND
1.00 1 2 1 20 JMP
1.00 1 3 1 30 LABEL
Cover group: inst.inst_driven
=============================
Grade: 0.85 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: 0.88 Weight: 1
grade goal samples tests %t op1
------------------------------------------------
0.50 2 1 1 9 reg0
1.00 2 2 1 18 reg1
1.00 2 2 1 18 reg2
1.00 2 6 1 55 reg3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Copyright © 1998-2014 |
Deepak Kumar Tala - All rights reserved |
Do you have any Comment? mail me at:deepak@asic-world.com
|
|