Jump to content

Recommended Posts

Posted

I am mis-understanding unpack_object in some way. It does not unpack the object as I expect but does if I call unpack_field_int on each member of the instantiated class.

Thanks for any clarification.

class BIG extends uvm_sequence_item;

bit[7:0] b;

SMALL sm;

function void do_unpack(uvm_packer);

super.do_unpack(packer);

b = packer.unpack_field_int($bits(B));

packer.unpack_object(sm); //does NOT give correct value to sm members

// sm.a=packer.unpack_field_int($bits(sm.a)); //this gives correct value

endfunction

endclass

class SMALL extends uvm_sequence_item;

bit[3:0] a;

function void do_unpack(uvm_packer);

super.do_unpack(packer);

this.a=packer.unpack_field_int($bits(a));

endfunction

endclass

  • 3 weeks later...
Posted

If packer.use_metadata is 0 then these should match, if use_metadata is 1 then there's an extra field (4 bytes) that indicates whether the object is null used by unpack_object.

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