I'm working on a UVM environment and facing a issue related to compilation (vlogan) to different libraries. It's a bigger environment, here i managed to explain same issue with a short example.
file1: tb1.sv (will set a string in config_db)
module tb1;
import uvm_pkg::*;
string str;
initial begin
str = "CONFIG DB CHECKER STRING \n";
uvm_config_db #(string)::set(null,"*","str",str);
end
endmodule
file2: tb2.sv (will get the string from config db)
[code]module tb2;
import uvm_pkg::*;
class test extends uvm_test;
`uvm_component_utils(test)
string g_str;
function new(string name = "", uvm_component parent);
super.new(name,parent);
assert(uvm_config_db #(string)::get(this,"","str",g_str)) $display("String retrived from DB %s",g_str);
else $display("-Error- : Cannot get string\n");
endfunction
endclass
initial begin
run_test("test");
end
endmodule[/code][code][code][code][code][code][verilog][/verilog][/code][/code][/code][/code][/code]
when i try to compile above two files in single library its working fine. (below is the command)
vcs -sverilog +incdir+${home}/uvm/src/ $home/uvm/src/uvm_pkg.sv tb1.sv tb2.sv
followed by ./simv
But the issue is when i try to compile those two files into two different libraries (below three commands).
vlogan -sverilog +incdir+${home}/uvm/src/ $home/uvm/src/uvm_pkg.sv tb1.sv -work TB1_WORK
vlogan -sverilog +incdir+${home}/uvm/src/ $home/uvm/src/uvm_pkg.sv tb2.sv -work TB2_WORK
vcs tb2
and when i run "simv" executable the get from config_db fails in tb2.sv below error.
"tb2.sv", 9: tb2.\test::new .unnamed$$_0: started at 0s failed at 0s
Offending 'uvm_config_db#(string)::get(this, "\000", "str", this.g_str)'
-Error- : Cannot get string
I kinda feel like the uvm_pkg is different for two libraries and hence the config_db database is also different.
Can you please let me know a way to use a common package across different libraries.