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 post
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 post
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...