-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathring_coverage.sv
More file actions
56 lines (45 loc) · 2.08 KB
/
ring_coverage.sv
File metadata and controls
56 lines (45 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
class ring_coverage extends uvm_subscriber #(ring_sequence_item);
//----------------------------------------------------------------------------
`uvm_component_utils(ring_coverage)
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
function new(string name="",uvm_component parent);
super.new(name,parent);
dut_cov=new();
endfunction
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
ring_sequence_item txn;
real cov;
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
covergroup dut_cov;
option.per_instance= 1;
option.comment = "dut_cov";
option.name = "dut_cov";
option.auto_bin_max= 2;
RST:coverpoint txn.rst {
bins rst_low ={0};
bins rst_high={1};
}
endgroup:dut_cov;
//----------------------------------------------------------------------------
//--------------------- write method ----------------------------------------
function void write(ring_sequence_item t);
txn=t;
dut_cov.sample();
endfunction
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
function void extract_phase(uvm_phase phase);
super.extract_phase(phase);
cov=dut_cov.get_coverage();
endfunction
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
function void report_phase(uvm_phase phase);
super.report_phase(phase);
`uvm_info(get_type_name(),$sformatf("Coverage is %f",cov),UVM_MEDIUM)
endfunction
//----------------------------------------------------------------------------
endclass:ring_coverage