-
Notifications
You must be signed in to change notification settings - Fork 12
/
rcc_in_coverage.sv
executable file
·102 lines (75 loc) · 3.22 KB
/
rcc_in_coverage.sv
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
class rcc_in_coverage extends uvm_component;
`uvm_component_utils(rcc_in_coverage)
virtual rcc_if vif;
uvm_analysis_export #(rcc_transaction) cov_din;
uvm_analysis_export #(rcc_transaction) cov_addr;
uvm_tlm_analysis_fifo #(rcc_transaction) cov_din_fifo;
uvm_tlm_analysis_fifo #(rcc_transaction) cov_addr_fifo;
rcc_transaction seq_din;
rcc_transaction seq_addr;
rcc_transaction seq_in;
rcc_transaction seq_ad;
covergroup din_rtl; // @(posedge vif.clk);
cover_point_din_rtl: coverpoint seq_in.g_din {option.auto_bin_max = 65535;}
endgroup
covergroup addr_rtl; //@(posedge vif.rcc_clk);
cover_point_addr_rtl: coverpoint seq_ad.g_address{ bins addrs_0 = {0};
bins addrs_1 = {1};
bins addrs_2 = {2};
bins addrs_3 = {3};
bins addrs_4 = {4};
bins addrs_5 = {5};
bins addrs_6 = {6};
bins addrs_7 = {7};
ignore_bins ig = {[8:15]};
}
endgroup
function new(string name = "", uvm_component parent);
super.new(name, parent);
din_rtl = new();
addr_rtl = new();
endfunction
function void build_phase(uvm_phase phase);
super.build_phase(phase);
if(!uvm_config_db#(virtual rcc_if)::get(this, "", "vif", vif))
`uvm_fatal("No Vif", {"virtual interface must be set for: ", get_full_name(), ".vif"});
seq_in = rcc_transaction::type_id::create("seq_in", this);
seq_ad = rcc_transaction::type_id::create("seq_ad", this);
cov_din = new("cov_din", this);
cov_addr = new("cov_addr", this);
cov_din_fifo = new("cov_din_fifo", this);
cov_addr_fifo = new("cov_addr_fifo", this);
seq_din = rcc_transaction::type_id::create("seq_din", this);
seq_addr = rcc_transaction::type_id::create("seq_addr", this);
endfunction
function void connect_phase(uvm_phase phase);
cov_din.connect(cov_din_fifo.analysis_export);
cov_addr.connect(cov_addr_fifo.analysis_export);
endfunction
task run_phase(uvm_phase phase);
fork
din_coverage();
addr_coverage();
join_none
endtask
task din_coverage;
forever begin
@(posedge vif.clk)
cov_din_fifo.get(seq_din);
seq_in.g_din = seq_din.g_din;
//$display("cov input : %h\n", seq_in.g_din);
din_rtl.sample();
// $display("input cov: %f\n", din_rtl.get_coverage());
end
endtask
task addr_coverage;
forever begin
@(posedge vif.rcc_clk)
cov_addr_fifo.get(seq_addr);
seq_ad.g_address = seq_addr.g_address;
//$display("cov input : %h\n", seq_ad.g_address);
addr_rtl.sample();
// $display("input address cov: %f\n", addr_rtl.get_coverage());
end
endtask
endclass