uvm_packer_defines.svh

UVMkit » 1800.2-2020
Summary
uvm_packer_defines.svh
Packing MacrosThe packing macros assist users who implement the uvm_object::do_pack method.
Packing - With Size Info
`uvm_pack_intNPack an integral variable.
Packing MacrosThe packing macros are implemented as described in section B.2.4 of the 1800.2 specification.
Packing - No Size Info
Unpacking MacrosThe unpacking macros assist users who implement the uvm_object::do_unpack method.
Unpacking - With Size Info
Unpacking - No Size Info

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, which must be compile-time constant value greater than 0.

`uvm_pack_intN

Pack an integral variable.

`uvm_pack_intN(VAR,SIZE)

Packing Macros

The packing macros are implemented as described in section B.2.4 of the 1800.2 specification.

The Accellera implementation adds an additional PACKER argument to these macros with a default value of ‘packer’.  This allows the macros to be used in environments with alternative packer names.

For example, `uvm_pack_intN is defined in the LRM as

`define uvm_pack_intN(VAR,SIZE)

Whereas the implementation is

`define uvm_pack_intN(VAR,SIZE,PACKER=packer)

This allows for usage such as

function void pack_foo( uvm_packer other_packer );
  `uvm_pack_intN(foo, 32, other_packer)
endfunction : pack_foo

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

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, which must be a compile-time constant value greater than 0.

virtual function void do_pack ( uvm_packer  packer )
The do_pack method is the user-definable hook called by the pack methods.
virtual function void do_unpack ( uvm_packer  packer )
The do_unpack method is the user-definable hook called by the unpack method.
The unpacking macros assist users who implement the uvm_object::do_unpack method.
Pack an integral variable.
The packing macros assist users who implement the uvm_object::do_pack method.