blob: d4b3e01874da2ad6a5766cc65146ca97691a7210 (
plain) (
blame)
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
|
// The monitor has a virtual interface handle with which
// it can monitor the events happening on the interface.
// It sees new transactions and then captures information
// into a packet and sends it to the scoreboard
// using another mailbox.
class monitor extends uvm_monitor;
`uvm_component_utils(monitor)
function new(string name = "monitor", uvm_component parent = null);
super.new(name, parent);
endfunction
uvm_analysis_port #(Item) mon_analysis_port;
virtual des_if vif;
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
if (!uvm_config_db#(virtual des_if)::get(this, "", "des_vif", vif))
`uvm_fatal("MON", "Could not get vif")
mon_analysis_port = new("mon_analysis_port", this);
endfunction
virtual task run_phase(uvm_phase phase);
super.run_phase(phase);
// This task monitors the interface for a complete
// transaction and writes into analysis port when complete
forever begin
@(vif.cb);
if (!vif.reset) begin
Item item = Item::type_id::create("item");
item.inp = vif.inp;
item.outp = vif.cb.outp;
mon_analysis_port.write(item);
`uvm_info("MON", $sformatf("Saw item %s", item.convert2str()), UVM_HIGH)
end
end
endtask
endclass
|