-
Notifications
You must be signed in to change notification settings - Fork 3
/
Scoreboard.sv
78 lines (53 loc) · 2.13 KB
/
Scoreboard.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
///////////////////////////////////////////////
//
// Scoreboard.v
//
///////////////////////////////////////////////
package pkg_arbiter_scoreboard;
import pkg_arbiter_transaction::*;
import pkg_arbiter_virtualArbiter::*;
import pkg_arbiter_types::*;
class Scoreboard;
mailbox driver_mailbox, receiver_mailbox;
int err_num;
extern function new(mailbox driver_mailbox, mailbox receiver_mailbox);
extern function bilan();
extern virtual task start();
Transaction transaction = new();
logic [NUMUNITS-1 : 0] grant_response;
VirtualArbiter virtualArbiter = new();
logic [NUMUNITS-1 : 0] virtualArbiterGrant;
covergroup TransactionCoverGroup;
roundORpriority : coverpoint transaction.payload_roundORpriority;
request : coverpoint transaction.payload_request;
//priorit : coverpoint transaction.payload_priority;
endgroup
endclass
function Scoreboard::new(mailbox driver_mailbox, mailbox receiver_mailbox);
this.driver_mailbox = driver_mailbox;
this.receiver_mailbox = receiver_mailbox;
this.err_num = 0;
TransactionCoverGroup = new;
endfunction
task Scoreboard::start();
forever begin
logic [NUMUNITS-1 : 0] grant_response;
//Since those calls are blocking, it should work without the need to add a 2 cycles wait for the receiver
driver_mailbox.get(transaction);
if($get_coverage() > 80)
break;
receiver_mailbox.get(grant_response);
virtualArbiterGrant = virtualArbiter.getArbiterResponse(transaction);
TransactionCoverGroup.sample();
assert(virtualArbiterGrant==grant_response)
$display("PASSED Treating request : %b, received %b, virtualGrant %b, mode (0 = rr) %b", transaction.payload_request, grant_response, virtualArbiterGrant, transaction.payload_roundORpriority);
else begin
$display("ERROR Treating request : %b, received %b, virtualGrant %b, mode (0 = rr) %b", transaction.payload_request, grant_response, virtualArbiterGrant, transaction.payload_roundORpriority);
err_num +=1;
end
end // forever
endtask
function Scoreboard::bilan();
$display("Nombre d'erreurs : %d",err_num);
endfunction
endpackage : pkg_arbiter_scoreboard