Jump to content

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);
  `uvm_object_utils(A_seq)
  `uvm_declare_p_sequencer(tx_sequencer)
 
 bit [7:0] data_byte[`MAX_DATA:0] ;
 
 
  function new(string name="A_seq");
    super.new(name);
  endfunction
 
  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
                      })
                          
 endtask
 
endclass
 
 
 

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

Share this post


Link to post
Share on other sites

Try to use:

   foreach(tx_data_byte) tx_data_byte    == data_byte;

instead :

  tx_data_byte    == data_byte;

 

I think that operation on whole arrays in constraints is illegal at least when we strictly stick to SV LRM text

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×