Jump to content
Sign in to follow this  
Kinjal

uvm_packer status

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×