-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathframe_monitor_out.sv
53 lines (45 loc) · 1.9 KB
/
frame_monitor_out.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
46
47
48
49
50
51
52
53
`include "cvFunction.svh"
class frame_monitor_out extends uvm_monitor;
ycbcr_vif vif;
frame_ycbcr_tr tr;
uvm_analysis_port #(frame_ycbcr_tr) item_collected_port;
`uvm_component_utils(frame_monitor_out)
function new(string name, uvm_component parent);
super.new(name, parent);
item_collected_port = new ("item_collected_port", this);
`uvm_info("MONITOR OUT CREATED","new",UVM_MEDIUM)
endfunction
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
assert(uvm_config_db#(ycbcr_vif)::get(this, "", "vif", vif));
tr = frame_ycbcr_tr::type_id::create("tr", this);
endfunction
virtual task run_phase(uvm_phase phase);
phase.raise_objection(this);
`uvm_info("Monitor ycbcr ","started run_phase",UVM_MEDIUM)
wait (vif.rst === 1);
@(negedge vif.rst);
@(posedge vif.clk);
//forever begin
tr.a = allocateFrame();
@(posedge vif.clk);
begin_tr(tr, "frame_monitor_out");
for(int i = 0; i < `HEIGHT; i++)begin
for(int j = 0; j < `WIDTH; j++)begin
setPixel(tr.a, i, j, vif.Y, vif.Cb, vif.Cr);
`uvm_info("Monitor ycbcr",$sformatf("Received pixel i=%d j=%d Y=%d Cb=%d, Cr=%d", i, j, vif.Y, vif.Cb, vif.Cr), UVM_LOW)
`uvm_info("Monitor ycbcr",$sformatf("loop i=%d j=%d before clk", i, j), UVM_LOW)
@(posedge vif.clk);
`uvm_info("Monitor ycbcr",$sformatf("loop i=%d j=%d ended", i, j), UVM_LOW)
end
end
`uvm_info("Monitor ycbcr ", "Received frame", UVM_LOW)
item_collected_port.write(tr);
`uvm_info("Monitor ycbcr ", "Wrote frame to port", UVM_LOW)
end_tr(tr);
//end
@(posedge vif.clk);
`uvm_info("Monitor ycrcb", "Stopping the test", UVM_LOW);
phase.drop_objection(this);
endtask
endclass