Jump to content

Recommended Posts

Posted

I am unable to retrieve associative array from config database. Here is what I tried.

class sample extends uvm_object;

int a;

endclass

class ex_sample extends uvm_component;

typedef bit[3:0] addr;

sample s_obj[addr];

function build_phase(uvm_phase phase);

super.new(phase);

uvm_config_db#(sample)::set(this,"*","s_obj",s_obj);

endfunction

endclass

ERROR:: "formal and actual do not have assignment compatible data types"

Posted

s_obj is an associative array of sample handles, yet your config_db is parametrized by only a single sample handle. Try using a typedef

typedef bit[3:0] addr_t;

typedef sample s_obj_aa_t[addr_t];

s_obj_aa_t s_obj_aa;

function build_phase(uvm_phase phase);

super.new(phase);

uvm_config_db#(s_obj_aa_t)::set(this,"*","s_obj_aa",s_obj_aa);

Posted

Thanks Dave for the response. I wrap my associative array inside one class and they put into uvm_config_db. That is working. Still, I will change to the solution you have provided.

I have one more question. I believe uvm_config_db#(type)::set(this,"*","handle",handle) will be visible to all the components down to the hierarchy from current level(this to "*"). Is it possible to get this handle on upper layer. Will uvm_root::get as "cntxt" will solve the issue?

Posted

You are better off performance-wise wrapping many variables in one config class than setting/getting many individual variables.

Yes, if you can get a handle to that component from an upper layer, you can replace 'this; with than handle.

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...