Jump to content

Array Assignment in Sequences


Recommended Posts

Hi All,


I am seeing following error when I try to assign array values using inline constraints 

Array size's and dimensions are same and array slicing is not there ,but still I see below error.

Can somebody please through light on this error? Also suggest best practices 



class A_seq  extends uvm_sequence #(id_nfc_tx_transfer);
 bit [7:0] data_byte[`MAX_DATA:0] ;
  function new(string name="A_seq");
  virtual task body();
   ///Array Initialization
     for (int i=0;i<=5;i++)
         data_byte= 'hAB;
   `uvm_do_with(req,{ tx_bit_rate_sel ==212;
                                   tx_num_of_bytes == 5;
                                    tx_data_byte    == data_byte

Error :Randomization constraint has this error, which will cause the randomize function to return 0 and no new rand values will be set:

Slices of unpacked arrays are not currently supported in this context
Link to comment
Share on other sites

  • 4 weeks later...

Is tx_data_byte a fixed-size array?  If you are just trying to randomize the elements, just declare it as rand in the transaction, and remove data_byte, and the constraints, etc.


If its a dynamic array, then use tx_data_byte.size()==tx_num_of_bytes (inside of the transaction class), then you don't have even add it in everytime you randomize the transaction.  Did that make sense?

Link to comment
Share on other sites

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.

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