-
Notifications
You must be signed in to change notification settings - Fork 3
/
ring_driver.sv
51 lines (43 loc) · 2.05 KB
/
ring_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
class ring_driver extends uvm_driver #(ring_sequence_item);
//----------------------------------------------------------------------------
`uvm_component_utils(ring_driver)
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
function new(string name="ring_driver",uvm_component parent);
super.new(name,parent);
endfunction
//----------------------------------------------------------------------------
//-------------------------- virtual interface handel -----------------------
virtual interface intf vif;
//----------------------------------------------------------------------------
//------------------------- get interface handel from top -------------------
function void build_phase(uvm_phase phase);
super.build_phase(phase);
if(!(uvm_config_db#(virtual intf)::get(this,"","vif",vif))) begin
`uvm_fatal("driver","unable to get interface");
end
endfunction
//----------------------------------------------------------------------------
//---------------------------- run task --------------------------------------
task run_phase(uvm_phase phase);
ring_sequence_item txn=ring_sequence_item::type_id::create("txn");
initilize(); // initilize dut at time 0
forever begin
seq_item_port.get_next_item(txn);
drive_item(txn);
seq_item_port.item_done();
end
endtask
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
task initilize();
vif.rst = 0;
endtask
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
task drive_item(ring_sequence_item txn);
@(vif.cb);
vif.rst <= txn.rst;
endtask
//----------------------------------------------------------------------------
endclass:ring_driver