// convertion from resource value to string.////------------------------------------------------------------------------------classm_uvm_resource_converter#(typeT=int);// Function- convert2string// Convert a value of type ~T~ to a string that can be displayed.//// By default, returns the name of the type//virtualfunctionstringconvert2string(Tval);return{"(",`uvm_typename(val),") ?"};endfunctionendclass//----------------------------------------------------------------------//// CLASS- uvm_resource_default_converter// Define a default resource value converter using '%p'.
// Can't be rand since things like rand strings are not legal.protectedTval;`ifdefUVM_USE_RESOURCE_CONVERTER// Singleton used to convert this resource to a stringlocalstaticm_uvm_resource_converter#(T)m_r2s;// Function- m_get_converter// Get the conversion policy class that specifies how to convert the value// of a resource of this type to a string//staticfunctionm_uvm_resource_converter#(T)m_get_converter();if(m_r2s==null)m_r2s=new();returnm_r2s;endfunction// Function- m_set_converter// Specify how to convert the value of a resource of this type to a string//// If not specified (or set to ~null~),// a default converter that display the name of the resource type is used.// Default conversion policies are specified for the built-in type.//staticfunctionvoidm_set_converter(m_uvm_resource_converter#(T)r2s);m_r2s=r2s;endfunction
`ifdefVCS// `ifndef UVM_DISABLE_RESOURCE_CONVERTER//UVM_USE_RESOURCE_CONVERTER enables UVM-1.1d to print resources output to match uvm-1.1c. VCS2014.03 or later does not need resource_converter object.// As per agreement in Committee at time of UVM-1.1d, from UVM-1.2 onwards the default is to disable resource converter and allow simulators to deal with %p natively. If a user wishes to enable resource converter then they need to compile using +define+UVM_USE_RESOURCE_CONVERTER. The resource converter was never officially sanctioned by Accellera and is placed in the deprecated directory which may be removed in future version. // `define UVM_USE_RESOURCE_CONVERTER// `endif`ifndefUVM_VCS_NO_DTL`define UVM_VCS_DTL`endif`ifndefUVM_VCS_NO_FGP`define UVM_VCS_FGP`endif`else`define UVM_VCS_GLOBAL_DECLARATIONS`define UVM_VCS_DECLARATIONS`define UVM_VCS_CHECK(if_expr) if_expr`define UVM_VCS_CLP_TF