maulik_suthar Posted July 25, 2013 Report Share 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 Quote Link to comment Share on other sites More sharing options...
uwes Posted July 25, 2013 Report Share 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 Quote Link to comment Share on other sites More sharing options...
fcunha Posted July 25, 2013 Report Share 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.