UVM factory机制注册宏一览

Utility and Field Macros for Components and Objects

Summary

Utility and Field Macros for Components and Objects
Utility MacrosThe utils macros define the infrastructure needed to enable the object/component for correct factory operation.
`uvm_field_utils_begin
`uvm_field_utils_end
These macros form a block in which `uvm_field_* macros can be placed.
`uvm_object_utils
`uvm_object_param_utils
`uvm_object_utils_begin
`uvm_object_param_utils_begin
`uvm_object_utils_end
uvm_object-based class declarations may contain one of the above forms of utility macros.
`uvm_component_utils
`uvm_component_param_utils
`uvm_component_utils_begin
`uvm_component_param_utils_begin
`uvm_component_end
uvm_component-based class declarations may contain one of the above forms of utility macros.
`uvm_object_registryRegister a uvm_object-based class with the factory
`uvm_component_registryRegisters a uvm_component-based class with the factory
Field MacrosThe `uvm_field_* macros are invoked inside of the `uvm_*_utils_begin and `uvm_*_utils_end macro blocks to form “automatic” implementations of the core data methods: copy, compare, pack, unpack, record, print, and sprint.
`uvm_field_* macrosMacros that implement data operations for scalar properties.
`uvm_field_intImplements the data operations for any packed integral property.
`uvm_field_objectImplements the data operations for an uvm_object-based property.
`uvm_field_stringImplements the data operations for a string property.
`uvm_field_enumImplements the data operations for an enumerated property.
`uvm_field_realImplements the data operations for any real property.
`uvm_field_eventImplements the data operations for an event property.
`uvm_field_sarray_* macrosMacros that implement data operations for one-dimensional static array properties.
`uvm_field_sarray_intImplements the data operations for a one-dimensional static array of integrals.
`uvm_field_sarray_objectImplements the data operations for a one-dimensional static array of uvm_object-based objects.
`uvm_field_sarray_stringImplements the data operations for a one-dimensional static array of strings.
`uvm_field_sarray_enumImplements the data operations for a one-dimensional static array of enums.
`uvm_field_array_* macrosMacros that implement data operations for one-dimensional dynamic array properties.
`uvm_field_array_intImplements the data operations for a one-dimensional dynamic array of integrals.
`uvm_field_array_objectImplements the data operations for a one-dimensional dynamic array of uvm_object-based objects.
`uvm_field_array_stringImplements the data operations for a one-dimensional dynamic array of strings.
`uvm_field_array_enumImplements the data operations for a one-dimensional dynamic array of enums.
`uvm_field_queue_* macrosMacros that implement data operations for dynamic queues.
`uvm_field_queue_intImplements the data operations for a queue of integrals.
`uvm_field_queue_objectImplements the data operations for a queue of uvm_object-based objects.
`uvm_field_queue_stringImplements the data operations for a queue of strings.
`uvm_field_queue_enumImplements the data operations for a one-dimensional queue of enums.
`uvm_field_aa_*_string macrosMacros that implement data operations for associative arrays indexed by string.
`uvm_field_aa_int_stringImplements the data operations for an associative array of integrals indexed by string.
`uvm_field_aa_object_stringImplements the data operations for an associative array of uvm_object-based objects indexed by string.
`uvm_field_aa_string_stringImplements the data operations for an associative array of strings indexed by string.
`uvm_field_aa_*_int macrosMacros that implement data operations for associative arrays indexed by an integral type.
`uvm_field_aa_object_intImplements the data operations for an associative array of uvm_object-based objects indexed by the int data type.
`uvm_field_aa_int_intImplements the data operations for an associative array of integral types indexed by the int data type.
`uvm_field_aa_int_int_unsignedImplements the data operations for an associative array of integral types indexed by the int unsigned data type.
`uvm_field_aa_int_integerImplements the data operations for an associative array of integral types indexed by the integer data type.
`uvm_field_aa_int_integer_unsignedImplements the data operations for an associative array of integral types indexed by the integer unsigned data type.
`uvm_field_aa_int_byteImplements the data operations for an associative array of integral types indexed by the byte data type.
`uvm_field_aa_int_byte_unsignedImplements the data operations for an associative array of integral types indexed by the byte unsigned data type.
`uvm_field_aa_int_shortintImplements the data operations for an associative array of integral types indexed by the shortint data type.
`uvm_field_aa_int_shortint_unsignedImplements the data operations for an associative array of integral types indexed by the shortint unsigned data type.
`uvm_field_aa_int_longintImplements the data operations for an associative array of integral types indexed by the longint data type.
`uvm_field_aa_int_longint_unsignedImplements the data operations for an associative array of integral types indexed by the longint unsigned data type.
`uvm_field_aa_int_keyImplements the data operations for an associative array of integral types indexed by any integral key data type.
`uvm_field_aa_int_enumkeyImplements the data operations for an associative array of integral types indexed by any enumeration key data type.
Recording MacrosThe recording macros assist users who implement the uvm_object::do_record method.
`uvm_record_attributeVendor-independent macro for recording attributes (fields) to a vendor-specific transaction database.
`uvm_record_fieldMacro for recording name-value pairs into a transaction recording database.
Packing MacrosThe packing macros assist users who implement the uvm_object::do_pack method.
Packing - With Size Info
`uvm_pack_intNPack an integral variable.
`uvm_pack_enumNPack an integral variable.
`uvm_pack_sarrayNPack a static array of integrals.
`uvm_pack_arrayNPack a dynamic array of integrals.
`uvm_pack_queueNPack a queue of integrals.
Packing - No Size Info
`uvm_pack_intPack an integral variable without having to also specify the bit size.
`uvm_pack_enumPack an enumeration value.
`uvm_pack_stringPack a string variable.
`uvm_pack_realPack a variable of type real.
`uvm_pack_sarrayPack a static array without having to also specify the bit size of its elements.
`uvm_pack_arrayPack a dynamic array without having to also specify the bit size of its elements.
`uvm_pack_queuePack a queue without having to also specify the bit size of its elements.
Unpacking MacrosThe unpacking macros assist users who implement the uvm_object::do_unpack method.
Unpacking - With Size Info
`uvm_unpack_intNUnpack into an integral variable.
`uvm_unpack_enumNUnpack enum of type TYPE into VAR.
`uvm_unpack_sarrayNUnpack a static (fixed) array of integrals.
`uvm_unpack_arrayNUnpack into a dynamic array of integrals.
`uvm_unpack_queueNUnpack into a queue of integrals.
Unpacking - No Size Info
`uvm_unpack_intUnpack an integral variable without having to also specify the bit size.
`uvm_unpack_enumUnpack an enumeration value, which requires its type be specified.
`uvm_unpack_stringPack a string variable.
`uvm_unpack_realUnpack a variable of type real.
`uvm_unpack_sarrayUnpack a static array without having to also specify the bit size of its elements.
`uvm_unpack_arrayUnpack a dynamic array without having to also specify the bit size of its elements.
`uvm_unpack_queueUnpack a queue without having to also specify the bit size of its elements.

Utility Macros

The utils macros define the infrastructure needed to enable the object/component for correct factory operation.  See `uvm_object_utils and `uvm_component_utils for details.

utils macro should be used inside every user-defined class that extends uvm_object directly or indirectly, including uvm_sequence_item and uvm_component.

Below is an example usage of the utils macro for a user-defined object.

class mydata extends uvm_object;

   `uvm_object_utils(mydata)

   // declare data properties

  function new(string name="mydata_inst");
    super.new(name);
  endfunction

endclass

Below is an example usage of a utils macro for a user-defined component.

class my_comp extends uvm_component;

   `uvm_component_utils(my_comp)

   // declare data properties

  function new(string name, uvm_component parent=null);
    super.new(name,parent);
  endfunction

endclass

`uvm_field_utils_begin

`uvm_field_utils_end

These macros form a block in which `uvm_field_* macros can be placed.  Used as

`uvm_field_utils_begin(TYPE)
  `uvm_field_* macros here
`uvm_field_utils_end

These macros do not perform factory registration nor implement the get_type_name and create methods.  Use this form when you need custom implementations of these two methods, or when you are setting up field macros for an abstract class (i.e. virtual class).

`uvm_object_utils

`uvm_object_param_utils

`uvm_object_utils_begin

`uvm_object_param_utils_begin

`uvm_object_utils_end

uvm_object-based class declarations may contain one of the above forms of utility macros.

For simple objects with no field macros, use

`uvm_object_utils(TYPE)

For simple objects with field macros, use

`uvm_object_utils_begin(TYPE)
  `uvm_field_* macro invocations here
`uvm_object_utils_end

For parameterized objects with no field macros, use

`uvm_object_param_utils(TYPE)

For parameterized objects, with field macros, use

`uvm_object_param_utils_begin(TYPE)
  `uvm_field_* macro invocations here
`uvm_object_utils_end

Simple (non-parameterized) objects use the uvm_object_utils* versions, which do the following:

  • Implements get_type_name, which returns TYPE as a string
  • Implements create, which allocates an object of type TYPE by calling its constructor with no arguments.  TYPE’s constructor, if defined, must have default values on all it arguments.
  • Registers the TYPE with the factory, using the string TYPE as the factory lookup string for the type.
  • Implements the static get_type() method which returns a factory proxy object for the type.
  • Implements the virtual get_object_type() method which works just like the static get_type() method, but operates on an already allocated object.

Parameterized classes must use the uvm_object_param_utils* versions.  They differ from `uvm_object_utils only in that they do not supply a type name when registering the object with the factory.  As such, name-based lookup with the factory for parameterized classes is not possible.

The macros with _begin suffixes are the same as the non-suffixed versions except that they also start a block in which `uvm_field_* macros can be placed.  The block must be terminated by `uvm_object_utils_end.

Objects deriving from uvm_sequence must use the `uvm_sequence_* macros instead of these macros.  See <`uvm_sequence_utils> for details.

`uvm_component_utils

`uvm_component_param_utils

`uvm_component_utils_begin

`uvm_component_param_utils_begin

`uvm_component_end

uvm_component-based class declarations may contain one of the above forms of utility macros.

For simple components with no field macros, use

`uvm_component_utils(TYPE)

For simple components with field macros, use

`uvm_component_utils_begin(TYPE)
  `uvm_field_* macro invocations here
`uvm_component_utils_end

For parameterized components with no field macros, use

`uvm_component_param_utils(TYPE)

For parameterized components with field macros, use

`uvm_component_param_utils_begin(TYPE)
  `uvm_field_* macro invocations here
`uvm_component_utils_end

Simple (non-parameterized) components must use the uvm_components_utils* versions, which do the following:

  • Implements get_type_name, which returns TYPE as a string.
  • Implements create, which allocates a component of type TYPE using a two argument constructor.  TYPE’s constructor must have a name and a parent argument.
  • Registers the TYPE with the factory, using the string TYPE as the factory lookup string for the type.
  • Implements the static get_type() method which returns a factory proxy object for the type.
  • Implements the virtual get_object_type() method which works just like the static get_type() method, but operates on an already allocated object.

Parameterized classes must use the uvm_object_param_utils* versions.  They differ from `uvm_object_utils only in that they do not supply a type name when registering the object with the factory.  As such, name-based lookup with the factory for parameterized classes is not possible.

The macros with _begin suffixes are the same as the non-suffixed versions except that they also start a block in which `uvm_field_* macros can be placed.  The block must be terminated by `uvm_component_utils_end.

`uvm_object_registry

Register a uvm_object-based class with the factory

`uvm_object_registry(T,S)

Registers a uvm_object-based class T and lookup string S with the factory.  S typically is the name of the class in quotes.  The `uvm_object_utils family of macros uses this macro.

`uvm_component_registry

Registers a uvm_component-based class with the factory

`uvm_component_registry(T,S)

Registers a uvm_component-based class T and lookup string S with the factory.  S typically is the name of the class in quotes.  The `uvm_object_utils family of macros uses this macro.

Field Macros

The `uvm_field_* macros are invoked inside of the `uvm_*_utils_begin and `uvm_*_utils_end macro blocks to form “automatic” implementations of the core data methods: copy, compare, pack, unpack, record, print, and sprint.

By using the macros, you do not have to implement any of the do_* methods inherited from uvm_object.  However, be aware that the field macros expand into general inline code that is not as run-time efficient nor as flexible as direct implementions of the do_* methods.

Below is an example usage of the field macros for a sequence item.

class my_trans extends uvm_sequence_item;

  cmd_t  cmd;
  int    addr;
  int    data[$];
  my_ext ext;
  string str;

  `uvm_object_utils_begin(my_trans)
    `uvm_field_enum     (cmd_t, cmd, UVM_ALL_ON)
    `uvm_field_int      (addr, UVM_ALL_ON)
    `uvm_field_queue_int(data, UVM_ALL_ON)
    `uvm_field_object   (ext,  UVM_ALL_ON)
    `uvm_field_string   (str,  UVM_ALL_ON)
  `uvm_object_utils_end

  function new(string name="mydata_inst");
    super.new(name);
  endfunction

endclass

Below is an example usage of the field macros for a component.

class my_comp extends uvm_component;

  my_comp_cfg  cfg;

  `uvm_component_utils_begin(my_comp)
    `uvm_field_object   (cfg,  UVM_ALL_ON)
  `uvm_object_utils_end

  function new(string name="my_comp_inst", uvm_component parent=null);
    super.new(name);
  endfunction

endclass

Each `uvm_field_* macro is named according to the particular data type it handles: integrals, strings, objects, queues, etc., and each has at least two arguments: ARG and FLAG.

ARGis the instance name of the variable, whose type must be compatible with the macro being invoked.  In the example, class variable addr is an integral type, so we use the `uvm_field_int macro.
FLAGif set to UVM_ALL_ON, as in the example, the ARG variable will be included in all data methods.  If FLAG is set to something other than UVM_ALL_ON or UVM_DEFAULT, it specifies which data method implementations will not include the given variable.  Thus, if FLAG is specified as NO_COMPARE, the ARG variable will not affect comparison operations, but it will be included in everything else.

All possible values for FLAG are listed and described below.  Multiple flag values can be bitwise ORed together (in most cases they may be added together as well, but care must be taken when using the + operator to ensure that the same bit is not added more than once).

UVM_ALL_ONSet all operations on (default).
UVM_DEFAULTUse the default flag settings.
UVM_NOCOPYDo not copy this field.
UVM_NOCOMPAREDo not compare this field.
UVM_NOPRINTDo not print this field.
UVM_NOPACKDo not pack or unpack this field.
UVM_REFERENCEFor object types, operate only on the handle (e.g. no deep copy)
UVM_PHYSICALTreat as a physical field.  Use physical setting in policy class for this field.
UVM_ABSTRACTTreat as an abstract field.  Use the abstract setting in the policy class for this field.
UVM_READONLYDo not allow setting of this field from the set_*_local methods or during <apply_config_settings> operation.

A radix for printing and recording can be specified by OR’ing one of the following constants in the FLAG argument

UVM_BINPrint / record the field in binary (base-2).
UVM_DECPrint / record the field in decimal (base-10).
UVM_UNSIGNEDPrint / record the field in unsigned decimal (base-10).
UVM_OCTPrint / record the field in octal (base-8).
UVM_HEXPrint / record the field in hexidecimal (base-16).
UVM_STRINGPrint / record the field in string format.
UVM_TIMEPrint / record the field in time format.

Radix settings for integral types.  Hex is the default radix if none is specified.

A UVM component should not be specified using the `uvm_field_object macro unless its flag includes UVM_REFERENCE.  Otherwise, the field macro will implement deep copy, which is an illegal operation for uvm_components.  You will get a FATAL error if you tried to copy or clone an object containing a component handle that was registered with a field macro without the UVM_REFERENCE flag.  You will also get duplicate entries when printing component topology, as this functionality is already provided by UVM.

`uvm_field_* macros

Macros that implement data operations for scalar properties.

`uvm_field_int

Implements the data operations for any packed integral property.

`uvm_field_int(ARG,FLAG)

ARG is an integral property of the class, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_object

Implements the data operations for an uvm_object-based property.

`uvm_field_object(ARG,FLAG)

ARG is an object property of the class, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_string

Implements the data operations for a string property.

`uvm_field_string(ARG,FLAG)

ARG is a string property of the class, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_enum

Implements the data operations for an enumerated property.

`uvm_field_enum(T,ARG,FLAG)

T is an enumerated typeARG is an instance of that type, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_real

Implements the data operations for any real property.

`uvm_field_real(ARG,FLAG)

ARG is an real property of the class, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_event

Implements the data operations for an event property.

`uvm_field_event(ARG,FLAG)

ARG is an event property of the class, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_sarray_* macros

Macros that implement data operations for one-dimensional static array properties.

`uvm_field_sarray_int

Implements the data operations for a one-dimensional static array of integrals.

`uvm_field_sarray_int(ARG,FLAG)

ARG is a one-dimensional static array of integrals, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_sarray_object

Implements the data operations for a one-dimensional static array of uvm_object-based objects.

`uvm_field_sarray_object(ARG,FLAG)

ARG is a one-dimensional static array of uvm_object-based objects, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_sarray_string

Implements the data operations for a one-dimensional static array of strings.

`uvm_field_sarray_string(ARG,FLAG)

ARG is a one-dimensional static array of strings, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_sarray_enum

Implements the data operations for a one-dimensional static array of enums.

`uvm_field_sarray_enum(T,ARG,FLAG)

T is a one-dimensional dynamic array of enums typeARG is an instance of that type, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_array_* macros

Macros that implement data operations for one-dimensional dynamic array properties.

Implementation note

lines flagged with empty multi-line comments, /**/, are not needed or need to be different for fixed arrays, which can not be resized.  Fixed arrays do not need to pack/unpack their size either, because their size is known; wouldn’t hurt though if it allowed code consolidation.  Unpacking would necessarily be different.  */

`uvm_field_array_int

Implements the data operations for a one-dimensional dynamic array of integrals.

`uvm_field_array_int(ARG,FLAG)

ARG is a one-dimensional dynamic array of integrals, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_array_object

Implements the data operations for a one-dimensional dynamic array of uvm_object-based objects.

`uvm_field_array_object(ARG,FLAG)

ARG is a one-dimensional dynamic array of uvm_object-based objects, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_array_string

Implements the data operations for a one-dimensional dynamic array of strings.

`uvm_field_array_string(ARG,FLAG)

ARG is a one-dimensional dynamic array of strings, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_array_enum

Implements the data operations for a one-dimensional dynamic array of enums.

`uvm_field_array_enum(T,ARG,FLAG)

T is a one-dimensional dynamic array of enums typeARG is an instance of that type, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_queue_* macros

Macros that implement data operations for dynamic queues.

`uvm_field_queue_int

Implements the data operations for a queue of integrals.

`uvm_field_queue_int(ARG,FLAG)

ARG is a one-dimensional queue of integrals, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_queue_object

Implements the data operations for a queue of uvm_object-based objects.

`uvm_field_queue_object(ARG,FLAG)

ARG is a one-dimensional queue of uvm_object-based objects, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_queue_string

Implements the data operations for a queue of strings.

`uvm_field_queue_string(ARG,FLAG)

ARG is a one-dimensional queue of strings, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_queue_enum

Implements the data operations for a one-dimensional queue of enums.

`uvm_field_queue_enum(T,ARG,FLAG)

T is a queue of enums typeARG is an instance of that type, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_aa_*_string macros

Macros that implement data operations for associative arrays indexed by string.

`uvm_field_aa_int_string

Implements the data operations for an associative array of integrals indexed by string.

`uvm_field_aa_int_string(ARG,FLAG)

ARG is the name of a property that is an associative array of integrals with string key, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_aa_object_string

Implements the data operations for an associative array of uvm_object-based objects indexed by string.

`uvm_field_aa_object_string(ARG,FLAG)

ARG is the name of a property that is an associative array of objects with string key, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_aa_string_string

Implements the data operations for an associative array of strings indexed by string.

`uvm_field_aa_string_string(ARG,FLAG)

ARG is the name of a property that is an associative array of strings with string key, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_aa_*_int macros

Macros that implement data operations for associative arrays indexed by an integral type.

`uvm_field_aa_object_int

Implements the data operations for an associative array of uvm_object-based objects indexed by the int data type.

`uvm_field_aa_object_int(ARG,FLAG)

ARG is the name of a property that is an associative array of objects with int key, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_aa_int_int

Implements the data operations for an associative array of integral types indexed by the int data type.

`uvm_field_aa_int_int(ARG,FLAG)

ARG is the name of a property that is an associative array of integrals with int key, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_aa_int_int_unsigned

Implements the data operations for an associative array of integral types indexed by the int unsigned data type.

`uvm_field_aa_int_int_unsigned(ARG,FLAG)

ARG is the name of a property that is an associative array of integrals with int unsigned key, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_aa_int_integer

Implements the data operations for an associative array of integral types indexed by the integer data type.

`uvm_field_aa_int_integer(ARG,FLAG)

ARG is the name of a property that is an associative array of integrals with integer key, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_aa_int_integer_unsigned

Implements the data operations for an associative array of integral types indexed by the integer unsigned data type.

`uvm_field_aa_int_integer_unsigned(ARG,FLAG)

ARG is the name of a property that is an associative array of integrals with integer unsigned key, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_aa_int_byte

Implements the data operations for an associative array of integral types indexed by the byte data type.

`uvm_field_aa_int_byte(ARG,FLAG)

ARG is the name of a property that is an associative array of integrals with byte key, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_aa_int_byte_unsigned

Implements the data operations for an associative array of integral types indexed by the byte unsigned data type.

`uvm_field_aa_int_byte_unsigned(ARG,FLAG)

ARG is the name of a property that is an associative array of integrals with byte unsigned key, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_aa_int_shortint

Implements the data operations for an associative array of integral types indexed by the shortint data type.

`uvm_field_aa_int_shortint(ARG,FLAG)

ARG is the name of a property that is an associative array of integrals with shortint key, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_aa_int_shortint_unsigned

Implements the data operations for an associative array of integral types indexed by the shortint unsigned data type.

`uvm_field_aa_int_shortint_unsigned(ARG,FLAG)

ARG is the name of a property that is an associative array of integrals with shortint unsigned key, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_aa_int_longint

Implements the data operations for an associative array of integral types indexed by the longint data type.

`uvm_field_aa_int_longint(ARG,FLAG)

ARG is the name of a property that is an associative array of integrals with longint key, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_aa_int_longint_unsigned

Implements the data operations for an associative array of integral types indexed by the longint unsigned data type.

`uvm_field_aa_int_longint_unsigned(ARG,FLAG)

ARG is the name of a property that is an associative array of integrals with longint unsigned key, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_aa_int_key

Implements the data operations for an associative array of integral types indexed by any integral key data type.

`uvm_field_aa_int_key(long unsigned,ARG,FLAG)

KEY is the data type of the integral key, ARG is the name of a property that is an associative array of integrals, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

`uvm_field_aa_int_enumkey

Implements the data operations for an associative array of integral types indexed by any enumeration key data type.

`uvm_field_aa_int_longint_unsigned(ARG,FLAG)

ARG is the name of a property that is an associative array of integrals with longint unsigned key, and FLAG is a bitwise OR of one or more flag settings as described in Field Macros above.

Recording Macros

The recording macros assist users who implement the uvm_object::do_record method.  They help ensure that the fields are recorded using a vendor- independent API.  Unlike the uvm_recorder policy, fields recorded using the `uvm_record_field macro do not lose type information--they are passed directly to the vendor-specific API.  This results in more efficient recording and no artificial limit on bit-widths.  See your simulator vendor’s documentation for more information on its transaction recording capabilities.

`uvm_record_attribute

Vendor-independent macro for recording attributes (fields) to a vendor-specific transaction database.

`uvm_record_field

Macro for recording name-value pairs into a transaction recording database.  Requires a valid transaction handle, as provided by the uvm_transaction::begin_tr and uvm_component::begin_tr methods.

Packing Macros

The packing macros assist users who implement the uvm_object::do_pack method.  They help ensure that the pack operation is the exact inverse of the unpack operation.  See also Unpacking Macros.

virtual function void do_pack(uvm_packer packer);
  `uvm_pack_int(cmd)
  `uvm_pack_int(addr)
  `uvm_pack_array(data)
endfunction

The ‘N’ versions of these macros take a explicit size argument.

Packing - With Size Info

`uvm_pack_intN

Pack an integral variable.

`uvm_pack_intN(VAR,SIZE)

`uvm_pack_enumN

Pack an integral variable.

`uvm_pack_enumN(VAR,SIZE)

`uvm_pack_sarrayN

Pack a static array of integrals.

`uvm_pack_sarray(VAR,SIZE)

`uvm_pack_arrayN

Pack a dynamic array of integrals.

`uvm_pack_arrayN(VAR,SIZE)

`uvm_pack_queueN

Pack a queue of integrals.

`uvm_pack_queueN(VAR,SIZE)

Packing - No Size Info

`uvm_pack_int

Pack an integral variable without having to also specify the bit size.

`uvm_pack_int(VAR)

`uvm_pack_enum

Pack an enumeration value.  Packing does not require its type be specified.

`uvm_pack_enum(VAR)

`uvm_pack_string

Pack a string variable.

`uvm_pack_string(VAR)

`uvm_pack_real

Pack a variable of type real.

`uvm_pack_real(VAR)

`uvm_pack_sarray

Pack a static array without having to also specify the bit size of its elements.

`uvm_pack_sarray(VAR)

`uvm_pack_array

Pack a dynamic array without having to also specify the bit size of its elements.  Array size must be non-zero.

`uvm_pack_array(VAR)

`uvm_pack_queue

Pack a queue without having to also specify the bit size of its elements.  Queue must not be empty.

`uvm_pack_queue(VAR)

Unpacking Macros

The unpacking macros assist users who implement the uvm_object::do_unpack method.  They help ensure that the unpack operation is the exact inverse of the pack operation.  See also Packing Macros.

virtual function void do_unpack(uvm_packer packer);
  `uvm_unpack_enum(cmd,cmd_t)
  `uvm_unpack_int(addr)
  `uvm_unpack_array(data)
endfunction

The ‘N’ versions of these macros take a explicit size argument.

Unpacking - With Size Info

`uvm_unpack_intN

Unpack into an integral variable.

`uvm_unpack_intN(VAR,SIZE)

`uvm_unpack_enumN

Unpack enum of type TYPE into VAR.

`uvm_unpack_enumN(VAR,SIZE,TYPE)

`uvm_unpack_sarrayN

Unpack a static (fixed) array of integrals.

`uvm_unpack_sarrayN(VAR,SIZE)

`uvm_unpack_arrayN

Unpack into a dynamic array of integrals.

`uvm_unpack_arrayN(VAR,SIZE)

`uvm_unpack_queueN

Unpack into a queue of integrals.

`uvm_unpack_queue(VAR,SIZE)

Unpacking - No Size Info

`uvm_unpack_int

Unpack an integral variable without having to also specify the bit size.

`uvm_unpack_int(VAR)

`uvm_unpack_enum

Unpack an enumeration value, which requires its type be specified.

`uvm_unpack_enum(VAR,TYPE)

`uvm_unpack_string

Pack a string variable.

`uvm_unpack_string(VAR)

`uvm_unpack_real

Unpack a variable of type real.

`uvm_unpack_real(VAR)

`uvm_unpack_sarray

Unpack a static array without having to also specify the bit size of its elements.

`uvm_unpack_sarray(VAR)

`uvm_unpack_array

Unpack a dynamic array without having to also specify the bit size of its elements.  Array size must be non-zero.

`uvm_unpack_array(VAR)

`uvm_unpack_queue

Unpack a queue without having to also specify the bit size of its elements.  Queue must not be empty.

`uvm_unpack_queue(VAR)

 

原网页:Utility and Field Macros for Components and Objects

UVM工厂机制是一种用于创建和管理UVM组件和对象的机制。它通过使用UVM工厂类(uvm_factory)来实现。\[1\]该工厂类是一个独特的对象,用于注册和创建UVM组件和对象。在UVM中,组件和对象的注册是通过使用来实现的,分别是uvm_component_utils和`uvm_object_utils。\[2\]这些将组件和对象注册到工厂中,以便在需要时可以通过工厂来创建它们。 使用UVM工厂机制创建组件和对象有两种方法。一种是通过继承uvm_component类或uvm_object类,并在类内重载方法来实现。这种方法本质上是借用工厂对象来创建组件和对象。\[1\]另一种方法是直接使用工厂方法来创建组件和对象。这需要使用全局唯一的uvm_factory类对象factory来调用工厂方法,并使用$cast进行类型转换。\[3\] 总之,UVM工厂机制提供了一种方便的方式来注册和创建UVM组件和对象,使得它们可以在需要时动态地创建和使用。 #### 引用[.reference_title] - *1* *3* [UVMfactory 机制](https://blog.csdn.net/Starry__/article/details/122930959)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [UVM-工厂机制(factory)](https://blog.csdn.net/sinat_41774721/article/details/121763596)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值