mrforever Posted March 25, 2013 Report Share Posted March 25, 2013 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); end .... -->UVM_FATAL: 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 mrforever Quote Link to comment Share on other sites More sharing options...
apfitch Posted March 26, 2013 Report Share Posted March 26, 2013 Could you use cfg_mon[i] = chpp_config_monitor::type_id::create($sformatf("cfg_mon%0d",i), this); I haven't tested it... Alan Quote Link to comment Share on other sites More sharing options...
mrforever Posted March 28, 2013 Author Report Share Posted March 28, 2013 Could you use cfg_mon[i] = chpp_config_monitor::type_id::create($sformatf("cfg_mon%0d",i), this); I haven't tested it... Alan Yes, I have found it. It works well. Thanks, Alan. Quote Link to comment Share on other sites More sharing options...
vani.priya Posted April 21, 2023 Report Share Posted April 21, 2023 Is it possible to assign particular address to each instance ? Thanks in advance Quote Link to comment Share on other sites More sharing options...
David Black Posted April 21, 2023 Report Share Posted April 21, 2023 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. uvm_config_db#(TYPE).set(this,$sformatf("cfg_mon%0d",i),"address",base+1024*i); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.