-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathframe_driver.sv
61 lines (52 loc) · 1.68 KB
/
frame_driver.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
54
55
56
57
58
59
60
61
`include "cvFunction.svh"
//Input Driver
typedef virtual rgb_if rgb_vif;
class frame_driver extends uvm_driver #(frame_rgb_tr);
`uvm_component_utils(frame_driver)
rgb_vif vif;
frame_rgb_tr tr;
function new(string name = "frame_driver", uvm_component parent = null);
super.new(name, parent);
endfunction
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
assert(uvm_config_db#(rgb_vif)::get(this, "", "vif", vif));
endfunction
virtual task run_phase(uvm_phase phase);
super.run_phase(phase);
fork
reset_signals();
get_and_drive(phase);
join
endtask
virtual protected task reset_signals();
wait (vif.rst === 1);
forever begin
vif.R <= 'x;
vif.G <= 'x;
vif.B <= 'x;
@(posedge vif.rst);
end
endtask
int rows, cols;
string message, message2;
virtual protected task get_and_drive(uvm_phase phase);
wait (vif.rst === 1);
@(negedge vif.rst);
//forever begin
seq_item_port.get(tr);
begin_tr(tr, "frame_driver");
for(rows = 0; rows < `HEIGHT; rows++)begin
for(cols = 0; cols < `WIDTH; cols++)begin
vif.R = getChannel(tr.a, cols, rows, 2);
vif.G = getChannel(tr.a, cols, rows, 1);
vif.B = getChannel(tr.a, cols, rows, 0);
`uvm_info("DRIVER",$sformatf("Sent pixel R=%d G=%d, B=%d", vif.R, vif.G, vif.B), UVM_LOW)
@(posedge vif.clk);
end
end
end_tr(tr);
`uvm_info("DRIVER","ended", UVM_LOW)
//end
endtask
endclass