Jump to content

No error when uvm_component is created using create method

Recommended Posts

When uvm_component is created using create method of uvm_factory its does not throw an error inspite of the following code in header "uvm_component.svh":-

// create

// ------

function uvm_object uvm_component::create (string name ="");


"create cannot be called on a uvm_component. Use create_component instead.")

return null;


Following is the code which I am using:-

class my_env extends uvm_env;


//implementation of my_env


class my_tb extends uvm_component;

//implementation of testbench

my_env env_local;

function void build_phase(uvm_phase phase);


env_local = my_env::type_id::create("env_local", this);

endfunction : build_phase


Am I interpreting anything wrong here?Can we use create method to create a uvm_component?

Link to comment
Share on other sites

  • 2 weeks later...

Your example is correct.

I think you're confusing the component's own "create" method with the factory "create_object_by_type" method. The "create" method of a component is defined by `uvm_component_utils and uses the factory

"create_component_by_type" method like it is supposed to.

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