What are the advantages on implementing do_pack and do_unpack on my sequence item?

I want to know exactly what are the advantages of using the do_pack and do_unpack functions on my uvm_sequence_item, instead of creating custom made pack and unpack functions inside the item class (ignoring the uvm_packer class tool).

The items I’m working with today contains several dynamic fields (like extensible bit vectors and queues for example) and interdependencies between fields.

I have been reading about how to implement those methods correctly, but it seems to me that its more complicated than to simply create new userdefined functions that pack/unpack all the fields to/from a bit string.

Should I make an effort to study and use the predefined methods? What are the advantages over an independent user defined implementation?

In reply to laydnerf:

Well if you implement it well than you can skip the default do_pack/unpack functions.
As far as I know do_pack/unpack methods provides some policy classes, which adds some checks in pack/unpack.

Also using do_pack/unpack would allow you to use standard way of UVM coding, which is always recommended whereas using custom way.

I do not think it is much complicated to implement do_pack, unpack using predefined methods. May be your could share your questions here.

Thanks

In reply to haykp:

Thanks for the reply haykp.

How you suggest I could implement the unpacking of eight-bit Extensible bit vectors(EBV-8) using the uvm_packer functions?

An extensible bit vector (EBV) is a data structure with an extensible data range.
An EBV is an array of blocks. Each block contains a single extension bit followed by a specific number of data bits. If B represents the total number of bits in one block, then a block contains B – 1 data bits. This protocol I’m working with shall use blocks of length 8 bits (EBV-8). The data value represented by an EBV is simply the bit string formed by the data bits as read from left-to-right, ignoring the extension bits. See image:

EBV-8

The field in the item is an integer, but it has to pack/unpack to/from an array/queue with this specifications. I already have functions to get an EBV-8 array from an integer and vice-versa (get the integer from an array passed by reference, so I can have the resulting array also, after poping the EBV part). Any clues on how to solve this using the do_pack/do_unpack methods?