-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCode_13 UVM Config_db Format.sv
56 lines (35 loc) · 1.27 KB
/
Code_13 UVM Config_db Format.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
//So this is how we use an, umv_config_db to share the data between the classes.
`include "uvm_macros.svh"
import uvm_pkg::*;
class env extends uvm_env;
`uvm_component_utils(env)
int data;
function new(string path = "env", uvm_component parent = null);
super.new(path,parent);
endfunction
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
if(uvm_config_db#(int):: get(null, "uvm_test_top", "data", data))
`uvm_info("ENV", $sformatf("Value of data : %0d", data), UVM_NONE)
else
`uvm_error("ENV", "Unable to access the Value");
endfunction
endclass
class base_test extends uvm_test;
`uvm_component_utils(base_test)
env e;
function new(string path = "base_test", uvm_component parent = null);
super.new(path,parent);
endfunction
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
e = env::type_id::create("e",this);
uvm_config_db#(int)::set(null,"uvm_test_top", "data", 12); ////context + instance name + key + value
endfunction
endclass
///////////////////////////
module tb;
initial begin
run_test("base_test");
end
endmodule