-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfifo_monitor.sv
More file actions
106 lines (96 loc) · 4.12 KB
/
fifo_monitor.sv
File metadata and controls
106 lines (96 loc) · 4.12 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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//MONITOR
class fifo_monitor extends uvm_monitor;
virtual fifo_if vif;
fifo_seq_item trans;
uvm_analysis_port#(fifo_seq_item) item_got_port;
`uvm_component_utils(fifo_monitor)
//------------------------ analysis port -------------------------------------
// uvm_analysis_port#(fifo_seq_item) ap_mon;
function new(string name = "fifo_monitor", uvm_component parent);
super.new(name, parent);
item_got_port = new("item_got_port", this);
endfunction
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
trans = fifo_seq_item::type_id::create("trans");
if(!uvm_config_db#(virtual fifo_if)::get(this, "", "vif", vif))
`uvm_fatal("Monitor: ", "No vif is found!")
// ap_mon=new("ap_mon",this);
endfunction
virtual task run_phase(uvm_phase phase);
forever begin
@(posedge vif.m_mp.m_cb)
// if(vif.m_mp.m_cb.i_wren == 1 && vif.m_mp.m_cb.i_rden == 1)begin
// $display("\n write enable and read enable are high", $time);
// tr.i_wrdata = vif.m_mp.m_cb.i_wrdata;
// tr.i_wren = 'b1;
// tr.i_rden = 'b1;
// tr.o_full = vif.m_mp.m_cb.o_full;
// tr.o_alm_full = vif.m_mp.m_cb.o_alm_full;
// tr.o_empty = vif.m_mp.m_cb.o_empty;
// tr.o_alm_empty = vif.m_mp.m_cb.o_alm_empty;
// item_got_port.write(tr);
// end
// if(vif.m_mp.m_cb.i_wren == 1 && vif.m_mp.m_cb.i_rden == 0)begin
// @(posedge vif.m_mp.m_cb)
// $display("\n time = %0t, write enable is high and read enable is low",$time);
// tr.o_rddata = vif.m_mp.m_cb.o_rddata;
// tr.i_wren = 'b1;
// tr.i_rden = 'b0;
// tr.o_full = vif.m_mp.m_cb.o_full;
// tr.o_alm_full = vif.m_mp.m_cb.o_alm_full;
// tr.o_empty = vif.m_mp.m_cb.o_empty;
// tr.o_alm_empty = vif.m_mp.m_cb.o_alm_empty;
// item_got_port.write(tr);
// end
// if(vif.m_mp.m_cb.i_wren == 0 && vif.m_mp.m_cb.i_rden == 1)begin
// @(posedge vif.m_mp.m_cb)
// $display("\n time = %0t,write enable is low and read enable is high", $time);
// tr.o_rddata = vif.m_mp.m_cb.o_rddata;
// tr.i_wren = 'b0;
// tr.i_rden = 'b1;
// tr.o_full = vif.m_mp.m_cb.o_full;
// tr.o_alm_full = vif.m_mp.m_cb.o_alm_full;
// tr.o_empty = vif.m_mp.m_cb.o_empty;
// tr.o_alm_empty = vif.m_mp.m_cb.o_alm_empty;
// item_got_port.write(tr);
// end
// if(vif.m_mp.m_cb.i_wren == 0 && vif.m_mp.m_cb.i_rden == 0)begin
// @(posedge vif.m_mp.m_cb)
// $display("\n time = %0t, write enable is low and read enable is low",$time);
// tr.o_rddata = vif.m_mp.m_cb.o_rddata;
// tr.i_wren = 'b0;
// tr.i_rden = 'b0;
// tr.o_full = vif.m_mp.m_cb.o_full;
// tr.o_alm_full = vif.m_mp.m_cb.o_alm_full;
// tr.o_empty = vif.m_mp.m_cb.o_empty;
// tr.o_alm_empty = vif.m_mp.m_cb.o_alm_empty;
// item_got_port.write(tr);
// end
//***************************************************
if(vif.m_mp.m_cb.i_wren == 1 )begin
$display("\n time = %0t, write enable is high and read enable is low",$time);
trans.i_wrdata = vif.m_mp.m_cb.i_wrdata;
trans.i_wren = 'b1;
trans.i_rden = 'b0;
// $display("monitor -> i_wrdata = %0h", trans.i_wrdata);
trans.o_full = vif.m_mp.m_cb.o_full;
trans.o_alm_full = vif.m_mp.m_cb.o_alm_full;
item_got_port.write(trans);
// item_got_port.write(trans);
end
if( vif.m_mp.m_cb.i_rden == 1)begin
// @(posedge vif.m_mp.m_cb)
$display("\n time = %0t, write enable is low and read enable is high", $time);
trans.o_rddata = vif.m_mp.m_cb.o_rddata;
trans.i_wren = 'b0;
trans.i_rden = 'b1;
$display("\n time = %0t, monitor -> readdata virtual = %0h \n read data = %0h", $time, vif.m_mp.m_cb.o_rddata,trans.o_rddata);
trans.o_empty = vif.m_mp.m_cb.o_empty;
trans.o_alm_empty = vif.m_mp.m_cb.o_alm_empty;
item_got_port.write(trans);
// item_got_port.write(trans);
end
end
endtask
endclass