Jump to content

Recommended Posts

Posted

I am implementing do_pack() and do_unpack().

How can I know that do_pack() and do_unpack() has successfully happened?

for example,

abc = packer.unpack_field_int($bits(abc));

def = packer.unpack_field_int($bits(def));

where is success/fail bit which I can use for further parsing.

One problem on above one is, if total bits are not enough for abc then I am getting total 2 errors.

If I know that abc is fail because of not enough bits, I could not do def.

Posted

You could call 'packer.enough_bits($bits(abc),"abc")' (which prints the error) and use that to gate calling unpack. In general, unpack is expected to operate on valid packed data rather than potentially invalid data. But you could also implement your own packer which handles such errors differently.

Posted

hi,

if total bits of abc is needs to be a minimum value then you can use an if-statement to check it.

i.e

if ($bits(abc) < 7 )

`uvm_error("ABC", "Error abc has insufficient bits.");

thanks,

adiel.

Posted

You could call 'packer.enough_bits($bits(abc),"abc")' (which prints the error) and use that to gate calling unpack. In general, unpack is expected to operate on valid packed data rather than potentially invalid data. But you could also implement your own packer which handles such errors differently.

Ok, so what I get is UVM default packer can potentially put 1000 errors for 1 packet if packet has 1000 fields?

I thought its smart enough to mask rest of the errors by macro. And there is no way around this.

This is weird.

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...