Kinjal Posted July 14, 2011 Report Posted July 14, 2011 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. Quote
jadec Posted July 15, 2011 Report Posted July 15, 2011 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. Quote
adielkhan Posted July 15, 2011 Report Posted July 15, 2011 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. Quote
jadec Posted July 15, 2011 Report Posted July 15, 2011 Adiel, The "enough_bits" function checks the current packed data stream to see if it contains enough bits to unpacked the next field(s). Quote
Kinjal Posted July 15, 2011 Author Report Posted July 15, 2011 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. Quote
Recommended Posts
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.