How UVM config DB is created through system Verilog ??

System Verilog, UVM 0 Comments

UVM config DB

The configuration database provide access to a centralized database where type specific information can be stored and received. config_db can contain scalar objects, class handles, queues, lists, or even virtual interfaces.

The database has both a name table and a type table and each resource is entered into both. Resources are stored in a database so that each resource can be retrieved by name or by type, and database is globally accessible.

//Class definition

// This is not exact type of UVM or OVM config data base class definition

// This is just to show UVM , OVM config base can be written written

// This class is generated using static method and use of associative array !

uvm_config_db::set and uvm_config_db::get methods are used to store and retrive the information from database respectively.

class uvm_type_of_config_db #( type T =int)

static T db[string]; // static associative array

static function void set(input string name, input T value)

db[name]= value;

endfunction

static function void get(input string name , ref T value);

value= db[name];

endfunction

static function void print();

$display(“Configuration databse %s”, $typename(T));

foreach(db[i])

$diaplay(“db[%s} =%p”,i,db[i]);

endfunction

endclass

We will see example here , how do we use above class

class Dv_testing;

int i,j;

endclass

int i=2;

int val;

real pi=3.14;

Dv_testing dv;

initial begin

//calling set method

uvm_type_of_config_db#(int)::set(“i”,i);

uvm_type_of_config_db#(real)::set(“pi,pi);

dv=new()

dv.i=8;

dv.j=6;

uvm_type_of_config_db#(Dv_testing)::set(“dv”,dv);

//calling get method

uvm_type_of_config_db#(int)::get(“i”,val);

$display(“Value get return of i is %0d”,k); // val value is 2

uvm_type_of_config_db#(int)::print();

uvm_type_of_config_db#(real)::print();

uvm_type_of_config_db#(Dv_testing)::print();

end

 

 

Leave a Reply