mea1201 Posted June 3, 2013 Report Posted June 3, 2013 I'm stuck on a problem I encountered with a use of the streaming operator to unpack into a dynamic array. Rather than write procedural code, I thought I could use it actually with some amount of success. Here is what the code more or less looks like: uvm_pack_bitstream_t bit_vector; bit bit_array[]; ... bit_vector = packer.get_packed_bits(); {<<{bit_array with [0 +: packer.count]}} = bit_vector; myfunc(bit_array); Yes, I'm trying to use "unadvertised" features of the UVM packer here. This has worked in many cases, but there is one case that led to the following: # ** Fatal: Width do not match. Stream larger than variable. I thought maybe the packer count was too large compared to the bits returned from the packer, but similar scenarios had executed previously in the simulation without error. BTW, this is the only thing reported in the error, which is followed by the file and line number where it occurred (i.e. the streaming operator above). So, any ideas or insight as to what is going on here? TIA Quote
dave_59 Posted June 4, 2013 Report Posted June 4, 2013 I think you have the streaming operator on the wrong side of the assignment. You want a limited part of bit_vector to fill bit_array, not all of bit_vector (which is 32K bits) to fill a limited part of bit_array. bit_array = {<<{bit_vector with [0+:packer.count()]}}; Quote
mea1201 Posted June 5, 2013 Author Report Posted June 5, 2013 Thanks, Dave. Actually, the with range needed to match the declared range of bit_vector: bit_array = {<<{bit_vector with [packer.count-1:0]}}; The fatal was resolved; I overlooked something, and it had nothing to do with the streaming assignment after all. 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.