Jump to content
Sign in to follow this  
maulik_suthar

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×