-
Notifications
You must be signed in to change notification settings - Fork 1
/
driver_host.sv
59 lines (46 loc) · 1.22 KB
/
driver_host.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
// Created by Guy Arad on 02/09/2021.
class driver_host extends uvm_driver#(transaction);
`uvm_component_utils(driver_host)
virtual if_host vinf;
transaction trans;
function new(string name, uvm_component parent);
super.new(name, parent);
endfunction
function void build_phase(uvm_phase phase);
super.build_phase(phase);
uvm_config_db#(virtual if_host)::get(this , "" , "if_host", vinf);
endfunction
task run_phase(uvm_phase phase);
drive();
endtask
virtual task drive();
forever begin
seq_item_port.get_next_item(trans);
@(negedge vinf.clk);
push_transaction_to_dut();
print();
//Wait for ack
if(trans.rd | trans.wr) begin
wait(vinf.ack[0]==1);
@(negedge vinf.clk);
release_bus();
end
seq_item_port.item_done();
end
endtask
virtual function void push_transaction_to_dut();
vinf.addr = trans.addr;
vinf.rd = trans.rd;
vinf.wr = trans.wr;
vinf.be = trans.be;
vinf.dwr = trans.dwr;
endfunction
virtual function void release_bus();
vinf.rd = 0;
vinf.wr = 0;
endfunction
//Print transaction
virtual function void print();
`uvm_info("driver_host", trans.sprint(), UVM_MEDIUM)
endfunction
endclass