Jump to content

how to check the set_type_overide is right


dmq0420

Recommended Posts

I had created 2 classes like following:

class a;

class b extends a;

I'm using

a::type_id::set_type_override(b::get_type());

to do the type override.

However, I found it didn't work. I added the post_randomize and some display information in the class b. But it never display anything.

----------------------------

I use the factory.print(), it show the following:

Type Overrides:

Requested Type Override Type

----------------------- ------------------------------------------

a b

Does anyone know this problem?

Link to comment
Share on other sites

This is just a guess, so I haven't checked it...

Firstly both a and b must be registered with the factory for the factory t be able to print it, and secondly the field which is to be overidden must also be registered with the factory.

So say you wanted to override component a with component b in the enviromnent env.

component a must include : `uvm_component_<param>_utils (a)

component b must include : `uvm_component_<param>_utils (B)

Environment must include :

`uvm_component_utils_begin(env)

...

`uvm_field_object(inst_a, UVM_DEFAULT)

...

`uvm_component_utils_end

I think this will work.

Edited by calvapete
incomplete
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.

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