uvm_packer

UVMkit » 1800.2-2020

Implementation of uvm_packer, as defined in section 16.5.1 of 1800.2-2020

Summary
uvm_packer
Implementation of uvm_packer, as defined in section 16.5.1 of 1800.2-2020
Methods
pack_object_with_metaPacks obj into the packer data stream, such that it can be unpacked via an associated unpack_object_with_meta call.
unpack_object_with_metaUnpacks an object which was packed into the packer data stream using pack_object_with_meta.

pack_object_with_meta

function void uvm_packer::pack_object_with_meta(
    uvm_object  value
)

Packs obj into the packer data stream, such that it can be unpacked via an associated unpack_object_with_meta call.

Unlike <pack_object>, the pack_object_with_meta method keeps track of what objects have already been packed in this call chain.  The first time an object is passed to pack_object_with_meta after a call to <flush>, the object is assigned a unique id.  Subsequent calls to pack_object_with_meta will only add the unique id to the stream.  This allows structural information to be maintained through pack/unpack operations.

Note: pack_object_with_meta is not compatible with <unpack_object> and <is_null>.  The object can only be unpacked via unpack_object_with_meta.

@uvm-contrib This API is being considered for potential contribution to 1800.2

unpack_object_with_meta

function void uvm_packer::unpack_object_with_meta(
    inout  uvm_object  value
)

Unpacks an object which was packed into the packer data stream using pack_object_with_meta.

Unlike <unpack_object>, the unpack_object_with_meta method keeps track of what objects have already been unpacked in this call chain.  If the packed object was null, then value is set to null.  Otherwise, if this is the first time the object’s unique id has been encountered since a call to <flush>, then unpack_object_with_meta checks value to determine if it is the correct type.  If it is not the correct type, or if value is null, then the packer shall create a new object instance for the unpack operation, using the data provided by pack_object_with_meta.  If value is of the correct type, then it is used as the object instance for the unpack operation.  Subsequent calls to unpack_object_with_meta for this unique id shall simply set value to this object instance.

Note: unpack_object_with_meta is not compatible with <pack_object> or <is_null>.  The object must have been packed via pack_object_with_meta.

@uvm-contrib This API is being considered for potential contribution to 1800.2

function void uvm_packer::pack_object_with_meta(
    uvm_object  value
)
Packs obj into the packer data stream, such that it can be unpacked via an associated unpack_object_with_meta call.
function void uvm_packer::unpack_object_with_meta(
    inout  uvm_object  value
)
Unpacks an object which was packed into the packer data stream using pack_object_with_meta.