-
Notifications
You must be signed in to change notification settings - Fork 3
/
Generator.sv
84 lines (61 loc) · 1.86 KB
/
Generator.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
///////////////////////////////////////////////
//
// Generator.v
//
///////////////////////////////////////////////
package pkg_arbiter_generator;
import pkg_arbiter_transaction::*;
import pkg_arbiter_types::*;
class Generator;
mailbox driver_mailbox;
extern function new(mailbox driver_mailbox);
extern virtual task start();
Transaction transaction;
endclass
function Generator::new(mailbox driver_mailbox);
this.driver_mailbox = driver_mailbox;
this.transaction = new;
endfunction
task Generator::start();
int packets_sent = 0;
int numberOfOnes = 0;
Transaction dummy = new;
$display ($time, " Generator Started");
forever
begin
transaction.randomize();
transaction.transactionID = packets_sent++;
//$display ("Treating transaction %d", i);
//nombre de 1 dans la requete :
numberOfOnes = 0;
for(int k = 0; k < NUMUNITS; k=k+1)
begin
if(transaction.payload_request[k] == 1)
numberOfOnes = numberOfOnes + 1;
end
//On rejoue la requete le nombre de 1 de fois : c'est pour s'assurer qu'en RR, tous les demandeurs seront servis
for(int j = 0; j < numberOfOnes; j=j+1)
begin
//transaction.print();
driver_mailbox.put(transaction);
end
//Send ending transaction to the scoreboard
// dummy.payload_request = 8'b11101010;
// dummy.transactionID = 0;
// foreach(dummy.payload_priority[i]) begin
// dummy.payload_priority[i] = 2;
// end
// dummy.payload_roundORpriority = 1;
// dummy.payload_priority[1] = 1;
// driver_mailbox.put(dummy);
// dummy.payload_request = 8'b01000000;
// dummy.transactionID = 1;
// foreach(dummy.payload_priority[i]) begin
// dummy.payload_priority[i] = 2;
// end
// dummy.payload_roundORpriority = 1;
// dummy.payload_priority[6] = 1;
// driver_mailbox.put(dummy);
end //forever
endtask
endpackage : pkg_arbiter_generator