Constraint question

In reply to Verif Engg:

You can use randc qualifier for mem_id, You’ll get all 8 values before repeating
previous values.

randc bit[2:0] mem_id;

Or,

class my_descriptor;
  rand bit [63:0] data;
  rand bit[2:0] mem_id;

  bit [2:0] prev_mem_id[$:5];  //Limit queue size

  constraint c1{
    foreach(prev_mem_id[i]){
      mem_id != prev_mem_id[i];
    }
  }

  function void post_randomize();
    prev_mem_id.push_back(mem_id);
    //prev_mem_id.push_front(mem_id);
  endfunction
endclass