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

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now