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
| class counter_sb;
mailbox #(counter_trans) rm2sb, rdmon2sb;
event DONE;
int count_transaction, data_verified;
counter_trans cov_h, rcvd_h;
covergroup counter_cov;
option.per_instance = 1;
RST: coverpoint cov_h.rst {bins r[] = {0,1};}
LD: coverpoint cov_h.load {bins l[] = {0,1};}
UD: coverpoint cov_h.updown {bins ud[] = {0,1};}
DATA: coverpoint cov_h.data {bins d[] = {[0:15]};}
DOUT: coverpoint cov_h.data_out {bins dout[] = {[0:15]};}
LDxDATA: cross LD, DATA;
UDxDOUT: cross UD, DOUT;
RSTxLDxDATA: cross RST, LD, DATA;
RSTxLDxUD: cross RST, LD, UD;
endgroup
function new(mailbox #(counter_trans) rm2sb, mailbox #(counter_trans) rdmon2sb);
this.rm2sb = rm2sb;
this.rdmon2sb = rdmon2sb;
counter_cov = new();
endfunction
task start;
fork
forever
begin
rm2sb.get(rcvd_h);
cov_h = rcvd_h;
counter_cov.sample();
//--------------------//
rdmon2sb.get(cov_h);
check(rcvd_h);
end
join_none
endtask
task check(counter_trans rcvd_h);
count_transaction++;
if(cov_h.compare(rcvd_h))
begin
counter_cov.sample();
data_verified++;
end
if(count_transaction >= no_of_transaction)
->DONE;
endtask
function void report;
$display("--------------SCOREBOARD REPORT----------------");
$display("Number of transactions received : %0d", count_transaction);
$display("Number of transactions verified : %0d", data_verified);
$display("-----------------------------------------------");
endfunction
endclass :counter_sb
|