|
|
|
|
|
|
|
|
|
|
|
|
Coverage Methods
|
|
|
Sytemverilog provides set of pre defined methods to work on covergroup. Below list of methods. |
|
|
|
|
|
- void sample() : Triggers the sampling of covergroup
- real get_coverage() : Calculate coverage number, return value will be 0 to 100
- real get_inst_coverage() :Calculate coverage number for given instance, return value will be 0 to 100
- void set_inst_name(string) :Set name of the instance with given string
- void start() :Start collecting coverage
- void stop() :Stop collecting coverage
|
|
|
|
|
|
|
|
|
|
|
|
Example : Coverage methods
|
|
|
|
|
|
1 module test();
2
3 logic [2:0] addr;
4 wire [2:0] addr2;
5
6 assign addr2 = addr + 1;
7
8 covergroup address_cov;
9 ADDRESS : coverpoint addr {
10 option.auto_bin_max = 10;
11 }
12 ADDRESS2 : coverpoint addr2 {
13 option.auto_bin_max = 10;
14 }
15 endgroup
16
17 address_cov my_cov = new;
18
19 initial begin
20 my_cov.ADDRESS.option.at_least = 1;
21 my_cov.ADDRESS2.option.at_least = 2;
22 // start the coverage collection
23 my_cov.start();
24 // Set the coverage group name
25 my_cov.set_inst_name("ASIC-WORLD");
26 $monitor("addr 8'h%x addr2 8'h%x",addr,addr2);
27 repeat (10) begin
28 addr = $urandom_range(0,7);
29 // Sample the covergroup
30 my_cov.sample();
31 #10 ;
32 end
33 // Stop the coverage collection
34 my_cov.stop();
35 // Display the coverage
36 $display("Instance coverage is %e",my_cov.get_coverage());
37 end
38
39 endmodule
You could download file coverage_methods.sv here
|
|
|
|
|
|
Simulation : Coverage methods
|
|
|
|
|
|
addr 8'h6 addr2 8'h7
addr 8'h4 addr2 8'h5
addr 8'h5 addr2 8'h6
addr 8'h2 addr2 8'h3
addr 8'h3 addr2 8'h4
addr 8'h7 addr2 8'h0
addr 8'h0 addr2 8'h1
addr 8'h7 addr2 8'h0
addr 8'h6 addr2 8'h7
addr 8'h3 addr2 8'h4
Instance coverage is 8.750000e+01
|
|
|
|
|
|
Report : Coverage methods
|
|
|
|
|
|
===========================================================
Group : test::address_cov
===========================================================
SCORE WEIGHT GOAL
87.50 1 100
-----------------------------------------------------------
Summary for Group test::address_cov
CATEGORY EXPECTED UNCOVERED COVERED PERCENT
Variables 16 2 14 87.50
Variables for Group test::address_cov
VARIABLE EXPECTED UNCOVERED COVERED PERCENT GOAL WEIGHT
ADDRESS 8 1 7 87.50 100 1
ADDRESS2 8 1 7 87.50 100 1
-----------------------------------------------------------
Summary for Variable ADDRESS
CATEGORY EXPECTED UNCOVERED COVERED PERCENT
Automatically Generated Bins 8 1 7 87.50
Automatically Generated Bins for ADDRESS
Uncovered bins
NAME COUNT AT LEAST NUMBER
[auto[1]] 0 1 1
Covered bins
NAME COUNT AT LEAST
auto[0] 1 1
auto[2] 1 1
auto[3] 2 1
auto[4] 1 1
auto[5] 1 1
auto[6] 2 1
auto[7] 2 1
-----------------------------------------------------------
Summary for Variable ADDRESS2
CATEGORY EXPECTED UNCOVERED COVERED PERCENT
Automatically Generated Bins 8 1 7 87.50
Automatically Generated Bins for ADDRESS2
Uncovered bins
NAME COUNT AT LEAST NUMBER
[auto[2]] 0 1 1
Covered bins
NAME COUNT AT LEAST
auto[0] 2 1
auto[1] 1 1
auto[3] 1 1
auto[4] 2 1
auto[5] 1 1
auto[6] 1 1
auto[7] 2 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Copyright © 1998-2014 |
Deepak Kumar Tala - All rights reserved |
Do you have any Comment? mail me at:deepak@asic-world.com
|
|