Jump to content

Recommended Posts

Posted

Hello,

 

The learning curve of UVM is pretty steep... Maybe you can help me climb a little bit faster... ;-)

 

I have a working environment instantiating an agent. Now, I am trying to add a configuration class in my environment. I added a class derived from uvm_object, say:

class a_config extends uvm_object;
   int   buswidth;
   extern function int get_buswidth();
endclass

In the environment, I try to create this configuration:

class my_env extends uvm_env;

  a_config m_config;

  // ...

endclass;

In the build_phase, I try to create it (then I will set it so that the agent in the env can get it):

function void my_env::build_phase(uvm_phase phase);

// ...

if(m_config == null)
  m_config = a_config::type_id::create("m_config",this);

// ...

endfunction;

The compile complains about type_id being not found in the specified scope. If I define a member function in the a_config class, it can be accessed.

Why is the compiler not finding the type_id ?

 

Thank you,

Jean-Luc

 

Posted

You forgot to register your a_config class with the factory:

class a_config extends uvm_object;
  `uvm_object_utils(a_config)
  
  int   buswidth;
  extern function int get_buswidth();
endclass

The `uvm_object_utils macro declares the type_id field (along with some others).

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.

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