maulik_suthar 0 Report post Posted July 25, 2013 Hello, i am new in UVM and Sv, i wanted to knw the UVM do_copy function in detail 1.the need of $cast(rhs,rhs_) 2.need to call super.do_copy. plz explain in detail. Thank u Share this post Link to post Share on other sites
uwes 17 Report post Posted July 25, 2013 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
fcunha 1 Report post Posted July 25, 2013 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