Jump to content

Packer on pack/unpack operation


Recommended Posts

Hi All,

I am developing a UVM bench right now, but got a little problem with the use of packer when I do pack/unpack operation. Let me explain my problem below:

For a scenario where there is subclass inside a class, during pack/unpack I notice that the packer of the parent class is shared with the subclass.

As a result the parent class packer information will be overwritten by subclass.

For example, see pseudo code below:

      parent.unpack_bytes begin (bytestream1, packer)

           subclass.unpack_bytes (bytestream2, packer) begin

                         ……….. 

           end

           ….....(continue with parent other operation which uses packer information i.e: m_packed_size)

      end


In this case, I notice the value of m_packed_size of parent packer is overwritten by subclass m_packed_size. Is there any way not to change the value of m_packed_size? so that I can use the original value of m_packed_size (before it is edited by subclass.unpacked_bytes) at the end of parent class?

Really appreciate your helps.

Thanks,

Budi

Edited by budisantoso
Link to comment
Share on other sites

Hi Janick,

Thanks for you reply. Using the method that you recommended, the packer properties will not be modified. However, if i use that method, I can not pass the bytestream to be unpack.

So in my case, I am still using obj.unpack_bytes(bytestream, packer) but before i call that function, I keep the old properties of packer (ex:m_packed_size) as temp and set it back at the end.

Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...