Hello everybody,
Just wanted to ask a few questions regarding uvm_config_db method on get and set.
I understand that there are 4 parameters in regards to using the uvm_config_db method on get and set.
Below is a portion of my code.
class comp1 extends uvm_component;
`uvm_component_utils(comp1)
int comp1_data = 0;
function new(input string path = "comp1", 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", comp1_data))
`uvm_error("comp1", "Unable to share data");
endfunction
virtual task run_phase(uvm_phase phase);
phase.raise_objection(this);
`uvm_info("comp1", $sformatf("Data rcvd comp1 : %0d", comp1_data), UVM_NONE);
phase.drop_objection(this);
endtask
endclass
class comp2 extends uvm_component;
`uvm_component_utils(comp2)
int comp2_data = 0;
function new(input string path = "comp2", 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(this, "", "data", comp2_data))
`uvm_error("comp2", "Unable to share data");
endfunction
virtual task run_phase(uvm_phase phase);
phase.raise_objection(this);
`uvm_info("comp2", $sformatf("Data rcvd comp2 : %0d", comp2_data), UVM_NONE);
phase.drop_objection(this);
endtask
endclass
// top level
module tb (
);
int data = 256;
initial begin
uvm_config_db #(int)::set(null, "uvm_test_top", "data", data);
run_test("the_test");
end
endmodule
I just want to know if I am understanding right - so the use of the parameters is to make sure only variables of certain classes would be updated? I know that because my data variable in comp2 does not have the same parameters as the tb module, the compiler results in an error. So I think my question is
- First, are the parameters in set and get method provide some sort of a path in order to provide some sort of identification?
- Second, how would I be able to set a different value to comp2? Do I need to create another get-set method to do this?
Also much appreciated if I can get some explanation on the purpose and usage of the parameters in get and set method in uvm_db_config
Thank you!
Sangwoo