-
Notifications
You must be signed in to change notification settings - Fork 2
/
monitor.sv
executable file
·38 lines (35 loc) · 1.07 KB
/
monitor.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
`include "Transaction.sv"
`define MONITOR_IF fifo_intf.MONITOR.monitor_cb
class monitor;
virtual fifo_intf vif_fifo;
mailbox mon2scb;
function new(virtual fifo_intf vif_fifo,mailbox mon2scb);
this.vif_fifo = vif_fifo;
this.mon2scb = mon2scb;
endfunction
task main;
forever begin
transaction trans;
trans = new();
@(posedge `MONITOR_IF.clk);
wait(`MONITOR_IF.wr_en||`MONITOR_IF.rd_en);
if(`MONITOR_IF.wr_en)begin
trans.wr_en = `MONITOR_IF.wr_en ;
trans.data_in = `MONITOR_IF.data_in;
trans.full = `MONITOR_IF.full;
trans.empty = `MONITOR_IF.empty;
$display("\t ADDR= %0h \t DATA IN = %0h",trans.wr_en,trans.data_in);
end
@(posedge `MONITOR_IF.clk);
if(`MONITOR_IF.rd_en)begin
trans.rd_en = `MONITOR_IF.rd_en ;
@(posedge `MONITOR_IF.clk);
trans.data_op = `MONITOR_IF.data_op;
trans.full = `MONITOR_IF.full;
trans.empty = `MONITOR_IF.empty;
$display("\t ADDR= %0h \t DATA IN = %0h",trans.wr_en,trans.data_in);
end
mon2scb.put(trans);
end
endtask
endclass