-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapb_base_test.sv
More file actions
61 lines (54 loc) · 2.06 KB
/
Copy pathapb_base_test.sv
File metadata and controls
61 lines (54 loc) · 2.06 KB
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
class apb_base_test extends uvm_test;
//======================
// Factory registeration
//======================
`uvm_component_utils(apb_base_test)
//======================
// Constructor
//======================
function new(string name = "apb_base_test" , uvm_component parent);
super.new(name , parent);
endfunction
//======================
// Component handles
//======================
apb_env env; // environment
apb_config apb_cfg; // configration class for vip
virtual apb_interface apb_vif; // virtual interface for apb
//======================
// Build phase
//======================
function void build_phase(uvm_phase phase);
super.build_phase(phase);
`uvm_info(get_type_name() , "_________Starting Build Phase_________" , UVM_MEDIUM)
// creating apb vip environment
env = apb_env::type_id::create("env" , this);
// creating configuration class
apb_cfg = apb_config::type_id::create("apb_cfg" , this);
apb_cfg.randomize();
uvm_config_db#(apb_config)::set(null , "*" , "apb_cfg" , apb_cfg); // setting configuration in config_db
//getting virtual axi interface
if(!uvm_config_db#(virtual apb_interface)::get(this , "" , "apb_vif" , apb_vif)) begin
`uvm_fatal(get_type_name() , "Failed to recieve virtual apb_interface")
end
else begin
`uvm_info(get_type_name() , "Virtual apb_interface successfully received" , UVM_HIGH);
end
`uvm_info(get_type_name() , "_________Ending Build Phase_________" , UVM_MEDIUM)
endfunction
//======================
// Reset phase
//======================
virtual task reset_phase(uvm_phase phase);
phase.raise_objection(this);
`uvm_info(get_type_name() , "Starting reset phase" , UVM_MEDIUM);
apb_vif.PADDR = '0;
apb_vif.PSELx = '0;
apb_vif.PENABLE = '0;
apb_vif.PWRITE = '0;
apb_vif.PWDATA = '0;
apb_vif.PSTRB = '0;
`uvm_info(get_type_name() , "Ending reset phase" , UVM_MEDIUM);
phase.drop_objection(this);
endtask
endclass