SeanChou Posted April 6, 2012 Report Share Posted April 6, 2012 Hi UVM Exports, As title, there is no problem to packing thie kind of packet when Tx. but when Rx, the only way I could do now is to write my packet parser to reconstruct it to an object, is there any suggestion or hint that I could leverage the unpack feature UVM provided? thanks so much in advanced! class pkt extends uvm_object; rand bit [7:0] aa_size; rand bit [7:0] aa[]; constraint c {aa.size() == aa_size; } `uvm_object_utils_begin(pkt) `uvm_field_int (aa_size, UVM_ALL_ON) `uvm_field_array_int (aa, UVM_ALL_ON) `uvm_object_utils_end function new(string name="pkt", uvm_component parent=null); super.new(name); endfunction: new endclass Quote Link to comment Share on other sites More sharing options...
jadec Posted April 10, 2012 Report Share Posted April 10, 2012 You'll need to create a custom do_unpack and do_pack function (and set the UVM_NO_PACK in the field macros). In your custom function, you can call the packer.unpack in the same order as you do for the pack (which will be customized to the order you need). After retrieving each field, you can do other things (allocating the array after reading the size, for example) or conditionally creating a child object or conditionally packing/unpacking fields. Look at the methods in the uvm_packer class for some details on how to do this. Quote Link to comment Share on other sites More sharing options...
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.