Jump to content

UVM do_copy function


Recommended Posts

hi,

 

especially as a new user you should be using the uvm_field macros which implement lots of boilerplate code for you. then you dont need the do_* functions at all then. you really only need the do_* functions for special customized/super optimized code.

 

 i assume you refer to:

 

  //|  class mytype extends uvm_object;
  //|    ...
  //|    int f1;
  //|    function void do_copy (uvm_object rhs);
  //|      mytype rhs_;
  //|      super.do_copy(rhs);
  //|      $cast(rhs_,rhs);
  //|      field_1 = rhs_.field_1;
  //|    endfunction
 

 

the super.do_copy() is required to perform do_copy on base class fields and the cast is required to access the actual fields of the class (and not just those of the uvm_object base class)

 

/uwe

Link to comment
Share on other sites

Hi,

 

According to UVM/Guidelines 3.3 (05.Jan.2013), "Mentor Graphics does recommend writing your own do_copy(), do_compare(), do_print(), do_pack() and do_unpack() methods.... For example, when writing your own do_compare() function, two function calls will be executed to compare the data members in our class. When using the macros, 45 function calls are executed to do the same comparison."

 

Thanks,

Fabio

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