forked from usfkotb/UVM-Sublime-Snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuvm_driver.sublime-snippet
45 lines (36 loc) · 1.27 KB
/
uvm_driver.sublime-snippet
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
<snippet>
<name>UVM driver</name>
<content><![CDATA[class ${1:${TM_FILENAME/(.+)\..+|.*/$1/:name}} extends uvm_driver #(${2:uvm_sequence_item}, ${3:REQ});
virtual ${4:xx_if} $5;
m_cfg;
$0
`uvm_component_utils(${1})
function new(string name = "${1}", uvm_component parent=null);
super.new(name, parent);
endfunction : new
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
endfunction : build_phase
virtual function void end_of_elaboration_phase(uvm_phase phase);
super.end_of_elaboration_phase(phase);
if($5 == null) begin
$5 = m_cfg.$5;
$5.proxy = this;
end
endfunction : end_of_elaboration_phase
virtual task run_phase(uvm_phase phase);
super.run_phase(phase);
// BFM forever tasks
fork
$5.
join_none
// Handling sequence items
seq_item_port.get_next_item(req);
`uvm_info(get_type_name(), "Received a new sequence item", UVM_LOW)
// Do something with the item
seq_item_port.item_done();
endtask : run_phase
endclass : ${1}]]></content>
<tabTrigger>uvm_driver</tabTrigger>
<scope>source.systemverilog</scope>
</snippet>