// classes. To copy the fields of a derived class, that class should override// the <do_copy> method.externfunctionvoidcopy(uvm_objectrhs);// Function: do_copy//// The ~do_copy~ method is the user-definable hook called by the <copy> method.// A derived class should override this method to include its fields in a <copy>// operation.//// A typical implementation is as follows:////| class mytype extends uvm_object;//| ...//| int f1;//| function void do_copy (uvm_object rhs);//| mytype rhs_;
// copy// ----functionvoiduvm_object::copy(uvm_objectrhs);//For cycle checking`ifdefUVM_VCS_FGPthread_specific_objecttobj;staticuvm_fgp_thread_object#(thread_specific_object)fgp_thread_obj=new;tobj=fgp_thread_obj.get_wrapper();`defineUVM_GLOBAL_COPY_MAPtobj.uvm_global_copy_map`defineUVM_VCS_DEPTHtobj.depth`elsestaticintdepth;`defineUVM_GLOBAL_COPY_MAPuvm_global_copy_map`defineUVM_VCS_DEPTHdepth`endifif((rhs!=null)&&`UVM_GLOBAL_COPY_MAP.exists(rhs))beginreturn;endif(rhs==null)beginuvm_report_warning("NULLCP","A null object was supplied to copy; copy is ignored",UVM_NONE);return;end`UVM_GLOBAL_COPY_MAP[rhs]=this;++`UVM_VCS_DEPTH;__m_uvm_field_automation(rhs,UVM_COPY,"");do_copy(rhs);--`UVM_VCS_DEPTH;if(`UVM_VCS_DEPTH==0)begin`UVM_GLOBAL_COPY_MAP.delete();endendfunction
// the <do_copy> method.// @uvm-ieee 1800.2-2020 auto 5.3.8.1externfunctionvoidcopy(uvm_objectrhs,uvm_copiercopier=null);// Function -- NODOCS -- do_copy//// The ~do_copy~ method is the user-definable hook called by the <copy> method.// A derived class should override this method to include its fields in a <copy>// operation.//// A typical implementation is as follows:////| class mytype extends uvm_object;//| ...//| int f1;//| function void do_copy (uvm_object rhs);//| mytype rhs_;
// copy// ----functionvoiduvm_object::copy(uvm_objectrhs,uvm_copiercopier=null);uvm_coreservice_tcoreservice;uvm_copierm_copier;if(rhs==null)begin`uvm_error("OBJ/COPY","Passing a null object to be copied")return;endif(copier==null)begincoreservice=uvm_coreservice_t::get();m_copier=coreservice.get_default_copier();endelsem_copier=copier;// Copier is available. check depth as and flush it. Sec 5.3.8.1if(m_copier.get_active_object_depth()==0)m_copier.flush();m_copier.copy_object(this,rhs);endfunction// do_copy// -------