Jump to content
kam.zamani

Problems creating objects in the "new" phase of a cofig object

Recommended Posts

My env configuration object consists of a bunch of other configuration objects. They all extend from uvm_object. When I try to create the smaller config objects inside the new function of the env config, I get a compile error:

 

formal and actual do not have assignment compatible data types (expecting datatype compatible with 'class uvm_pkg::uvm_component' but found 'class usb_env_cfg_pkg::usb_env_config' instead)

 

But when I move the "create" to another fucntion that is called after creating the env config, it is fine. However, this is forcing me into first creating the env config and then calling a method (e.g. init) in it in order to create all those other config objects inside it.

 

Can anyone shed some light why is this?

 

Thank you,

Kam  

 

 

Share this post


Link to post
Share on other sites

Without seeing the code, I cannot be certain. However, I suspect that in your call to create the lower-level objects, you have provided a this pointer. In other words, I think you're doing this:

my_cfg = my_cfg_c::type_id::create("my_cfg", this);

When you should just be doing this:

my_cfg = my_cfg_c::type_id::create("my_cfg");

Only components get a this pointer.

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

×