// Implementation as per Section 16.1 UVM Policy//------------------------------------------------------------------------------// @uvm-ieee 1800.2-2020 auto 16.1.1virtualclassuvm_policyextendsuvm_object;typedefenum{NEVER,STARTED,FINISHED}recursion_state_e;localuvm_objectm_extensions[uvm_object_wrapper];localuvm_objectm_policy_stack[$];
// ~rhs.get_type_name()~).// @uvm-ieee 1800.2-2020 auto 16.6.4.1virtualfunctionvoidcopy_object(uvm_objectlhs,uvm_objectrhs);uvm_field_opfield_op;if(get_recursion_policy()==UVM_REFERENCE)begin`uvm_error("UVM_COPY_POLICY","Attempting to make a copy of a object which is a reference")return;endif(rhs==null||lhs==null)begin`uvm_error("UVM_COPY_NULL_OBJ","Attempting to make a copy of a object with null src/target")return;endpush_active_object(lhs);
endfunction// @uvm-ieee 1800.2-2020 auto 16.6.3virtualfunctionvoidset_recursion_policy(uvm_recursion_policy_enumpolicy);this.policy=policy;endfunction// @uvm-ieee 1800.2-2020 auto 16.6.3virtualfunctionuvm_recursion_policy_enumget_recursion_policy();returnpolicy;endfunction// Function: get_num_copies//// Returns the number of times the ~rhs~ has been copied to a unique ~lhs~ //// @uvm-contrib This API is being considered for potential contribution to 1800.2functionintunsignedget_num_copies(uvm_objectrhs);if(m_recur_states.exists(rhs))
//------------------------------------------------------------------------------// @uvm-ieee 1800.2-2020 auto 5.7.1classuvm_field_opextendsuvm_object;`uvm_object_utils(uvm_field_op)localuvm_policym_policy;localbitm_user_hook;localuvm_objectm_object;// Bit m_is_set is set when the set() method is called and acts // like a state variable. It is cleared when flush is called.localbitm_is_set;localuvm_field_flag_tm_op_type;// Function -- new // // Creates a policy with the specified instance name. If name is not provided, then the policy instance is
// @uvm-ieee 1800.2-2020 auto 5.7.2.2virtualfunctionvoidset(uvm_field_flag_top_type,uvm_policypolicy=null,uvm_objectrhs=null);stringmatching_ops[$];if(op_type&UVM_COPY)matching_ops.push_back("UVM_COPY");if(op_type&UVM_COMPARE)matching_ops.push_back("UVM_COMPARE");if(op_type&UVM_PRINT)matching_ops.push_back("UVM_PRINT");if(op_type&UVM_RECORD)matching_ops.push_back("UVM_RECORD");if(op_type&UVM_PACK)matching_ops.push_back("UVM_PACK");if(op_type&UVM_UNPACK)matching_ops.push_back("UVM_UNPACK");if(op_type&UVM_SET)matching_ops.push_back("UVM_SET");
inputuvm_packerpacker=null);// @uvm-ieee 1800.2-2020 auto 5.3.10.1externfunctionintpack_longints(reflongintunsignedlongintstream[],inputuvm_packerpacker=null);// Function -- NODOCS -- do_pack//// The ~do_pack~ method is the user-definable hook called by the <pack> methods.// A derived class should override this method to include its fields in a pack// operation.//// The ~packer~ argument is the policy object for packing. The policy object// should be used to pack objects. //// A typical example of an object packing itself is as follows////| class mysubtype extends mysupertype;
inputuvm_packerpacker=null);// @uvm-ieee 1800.2-2020 auto 5.3.11.1externfunctionintunpack_longints(reflongintunsignedlongintstream[],inputuvm_packerpacker=null);// Function -- NODOCS -- do_unpack//// The ~do_unpack~ method is the user-definable hook called by the <unpack>// method. A derived class should override this method to include its fields// in an unpack operation.//// The ~packer~ argument is the policy object for both packing and unpacking.// It must be the same packer used to pack the object into bits. Also,// do_unpack must unpack fields in the same order in which they were packed.// See <uvm_packer> for more information.//
externvirtualfunctionvoiddo_unpack(uvm_packerpacker);// @uvm-ieee 1800.2-2020 auto 5.3.13externvirtualfunctionvoiddo_execute_op(uvm_field_opop);// Group -- NODOCS -- Configuration// @uvm-ieee 1800.2-2020 auto 5.3.12externvirtualfunctionvoidset_local(uvm_resource_basersrc);//---------------------------------------------------------------------------// **** Internal Methods and Properties ***// Do not use directly//---------------------------------------------------------------------------externlocalfunctionvoidm_pack(inoutuvm_packerpacker);externlocalfunctionvoidm_unpack_pre(inoutuvm_packerpacker);externlocalfunctionintm_unpack_post(uvm_packerpacker);externvirtualfunctionvoidm_unsupported_set_local(uvm_resource_basersrc);// The print_matches bit causes an informative message to be printed// when a field is set using one of the set methods.localstringm_leaf_name;
bitprint_enabled=1;// @uvm-ieee 1800.2-2020 auto 13.1.2.3externvirtualfunctionvoiddo_execute_op(uvm_field_opop);// Type: config_mode_t// Value type for storing config_mode_e values//// | typedef bit [1:0] config_mode_t;//// @uvm-contribtypedefbit[1:0]config_mode_t;// Type: config_mode_e// Enumeration for controlling component config settings.//// CONFIG_STRICT - Strictly adhere to the LRM// CONFIG_HIGHEST_PRECEDENCE - Only apply resources with highest precedence for each // field name / type handle pair