Jump to content

uvm_resource_db class usage


Recommended Posts

HI,

I want to know the usage of "uvm_resource_db" class and also in its different methods there is one argument like scope in which in their example they have provided "*", i am not getting why they have provided it.

If possible please provide me some useful scenario of it !!

Thanks.

Link to comment
Share on other sites

HI,

I want to know the usage of "uvm_resource_db" class and also in its different methods there is one argument like scope in which in their example they have provided "*", i am not getting why they have provided it.

If possible please provide me some useful scenario of it !!

Thanks.

Please provide the use of uvm_config_db() also !!

Link to comment
Share on other sites

HI,

I want to know the usage of "uvm_resource_db" class and also in its different methods there is one argument like scope in which in their example they have provided "*", i am not getting why they have provided it.

If possible please provide me some useful scenario of it !!

Thanks.

Hi Sankey,

To build highly configurable , reusable testbenches. UVM provides a facility called 'resources' that provides the configuration infrastructure and API.

The resource facility is comprised of polymorphic resource containers, a database for storing those resource containers and a means for locating resources in the database.

We use the resources to supply configuration infomation to a component. the component retrieves a value from the resource pool and uses it to control its topology or behavior.

For example:

following will create a new resource , populates it and inserts it into the resource pool.

uvm_resource_db#(int)::set("roman","top\.aa\..*",2011,this);

we create a new resource whose name is "roman", is visible in the scopes identified by "top\.aa\..*", and has the value of 2011.

The component that retrieves this resource would read the value from the database.

if(!uvm_resource_db#(int)::read_by_name("roman",get_full_name(),value,this))

`uvm_error("WRONG","resource not found in this scope ");

read_by_name() returns a bit that indicates whether or not the lookup succeeded.

The class uvm_resource_db#(T)is a convenience layer on top of the low-level database access classes and methods. it's not instantiated. but contains a collection of static functions that operate resources and resource pool.

Hope to help you.

Link to comment
Share on other sites

Please provide the use of uvm_config_db() also !!

The uvm_config_db#(T) class provides a convenience interface on top of the uvm_resource_db to simplify the basic interface that is used for reading and writing into the resource database.

Configuration parameters should be accesed by calling uvm_config_db #(T)::get explicitly from the build_phase method and copying their values to local variables.

class producer extends uvm_component;

...

producer_config config_h;

// Configuration parameters

bit param1 = 0;

int param2 = 0;

string param3;

...

function void build_phase(uvm_phase phase);

super.build_phase(phase);

my_port = new("my_port", this);

begin

if ( uvm_config_db #(producer_config)::get(this, "", "config", config_h) )

begin

param1 = config_h.param1; // Local parameters copied from configuration object

param2 = config_h.param2;

param3 = config_h.param3;

end

end

endfunction

...

endclass

set the values of the configuration parameters from elsewhere, which could be from higher-level components in the test bench, or could be from a specific test. Do do so, a UVM component calls set_config_object from the build method prior to creating the relevant lower-level components:

/////////////////////////////////////

class R_test extends uvm_test;

...

function void build_phase(uvm_phase phase);

super.build_phase(phase);

begin

producer_config config_h = new;

config_h.param1 = 1; // Set test-specific values for configuration parameters

config_h.param2 = 2;

config_h.param3 = 3;

uvm_config_db #(my_agent_config)::set(this, "*.*producer*", "config", config_h);

end

top_h = top::type_id::create("top_h", this);

endfunction

endclass

Link to comment
Share on other sites

Hi give me example of uvm_config_db how to used it and how to pass parameter and which file a want to need to make basic testcase... and also i have tried out above example but its not working i got syntex error at uvm_config_db ...

Link to comment
Share on other sites

Hi give me example of uvm_config_db how to used it and how to pass parameter and which file a want to need to make basic testcase... and also i have tried out above example but its not working i got syntex error at uvm_config_db ...

Hi Sankey,

I think the example i post above had given the usage for uvm_config_db , but this is just a usage not full codes example.

Pls paste your syntex error and your implementation codes, we could take a look.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...