Jump to content

How create mutiple uvm_component instances of uvm_component array?

Recommended Posts

Hi, experts


Now there is one class config_monitor extends from uvm_component. The env has the array which stores config_monitor type. Now I want to create all the element instances in the array, when I do it as follows, the VCS reported one UVM_FATAL.


-->The codes:


config_monitor cfg_mon[PORT_NUM];


// new cfg_mon

    foreach(cfg_mon) begin
       cfg_mon = config_monitor::type_id::create("cfg_mon", this);
UVM_FATAL /EDA_Tools/synopsys/vcs1209/etc/uvm-1.1/uvm-1.1c/src/base/uvm_component.svh(1750) @ 0: cfg_mon [CLDEXT] Cannot set 'cfg_mon' as a child of 'uvm_test_top.env.cfg_agt', which already has a child by that name.
The UVM_FATAL means that the elements of cfg_mon array cann't have the same name when 
they are created. How can I create all the intances of cfg_mon array? By the way, I don't want to create all the instances each by each manually as follows:
   cfg_mon[0] = config_monitor::type_id::create("cfg_mon0", this);
   cfg_mon[1] = config_monitor::type_id::create("cfg_mon1", this);
   cfg_mon[2] = config_monitor::type_id::create("cfg_mon2", this);
Thanks in advance!
Best regards
Link to comment
Share on other sites

  • 10 years later...

What do you mean by assigning an address to each instance? If you are saying that your config_monitor class has an address attribute to be initialized there are several approaches.

1. Using the same loop for creation, you could on the next line put something like: 

cfg_mon[i].address = base+1024*i;

2. Or if more appropriate, you could place config objects into the uvm_config_db indexed by the unique instance name.



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.

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