Jump to content

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,




Link to comment
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.

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