-
Notifications
You must be signed in to change notification settings - Fork 7
/
apb_monitor.sv
46 lines (31 loc) · 988 Bytes
/
apb_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
39
40
41
42
43
44
45
`ifndef apb_monitor
`define apb_monitor
`include "uvm_macros.svh"
`include "apb_driver.sv"
import uvm_pkg::*;
class apb_monitor extends uvm_monitor;
virtual apb_intf intf;
uvm_analysis_port#(apb_seq_item) item_collected_port;
apb_seq_item trans_collected;
`uvm_component_utils(apb_monitor)
function new(string name,uvm_component parent);
super.new(name,parent);
trans_collected=new();
item_collected_port=new("item_collected_port",this);
endfunction
function void build_phase(uvm_phase phase);
super.build_phase(phase);
if(!uvm_config_db#(virtual apb_intf)::get(this,"","intf",intf))
`uvm_fatal("No interface",{"virtual interface must be set for: ",get_full_name(),".intf"});
endfunction
virtual task run_phase(uvm_phase phase);
forever begin
@(posedge intf.MONITOR.clk);
trans_collected.sysbus=intf.monitor_cb.sysbus;
@(posedge intf.MONITOR.clk);
trans_collected.prdata=intf.monitor_cb.prdata;
item_collected_port.write(trans_collected);
end
endtask
endclass
`endif