-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonitor.sv
More file actions
58 lines (36 loc) · 1.29 KB
/
monitor.sv
File metadata and controls
58 lines (36 loc) · 1.29 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
57
58
class monitor;
transaction tr;
mailbox #(bit [7:0]) mbx;
bit [7:0] srx; //////send
bit [7:0] rrx; ///// recv
virtual uart_if vif;
function new(mailbox #(bit [7:0]) mbx);
this.mbx = mbx;
endfunction
task run();
forever begin
@(posedge vif.uclktx);
if ( (vif.newd== 1'b1) && (vif.rx == 1'b1) )
begin
@(posedge vif.uclktx); ////start collecting tx data from next clock tick
for(int i = 0; i<= 7; i++)
begin
@(posedge vif.uclktx);
srx[i] = vif.tx;
end
$display("[MON] : DATA SEND on UART TX %0d", srx);
//////////wait for done tx before proceeding next transaction
@(posedge vif.uclktx); //
mbx.put(srx);
end
else if ((vif.rx == 1'b0) && (vif.newd == 1'b0) )
begin
wait(vif.donerx == 1);
rrx = vif.doutrx;
$display("[MON] : DATA RCVD RX %0d", rrx);
@(posedge vif.uclktx);
mbx.put(rrx);
end
end
endtask
endclass