Unique value generation

Hi,
I have 6 queues in which element of same index in other queues should be different. All the 6 queues have same random size.
example:
constraint UNIQUE
{
que0_q.size() == random_num;
que1_q.size() == random_num;
que2_q.size() == random_num;
que3_q.size() == random_num;
que4_q.size() == random_num;
que5_q.size() == random_num;

foreach (que0_q[i])
{
que0_q[i] != que1_q[i];
que0_q[i] != que2_q[i];
que0_q[i] != que3_q[i];
que0_q[i] != que4_q[i];
que0_q[i] != que5_q[i];

follow same for other 5 queues
};
}
As of now i am following as mentioned above, but it contains lot of code in the constraint so is there any other alternatives for generating unique values for the mentioned queues?

Please let me know if any extra clarification is needed…

Thank you in advance…

In reply to chaitanyajaladi:

Nice challenge! How about this:

  1. Generate a single Q of unique random numbers (SV 2012 has unique constraints)
  2. Shuffle Q contents to all other queues. i.e. q2 = q1.shuffle()

Didn’t try it, but conceptually should work?

Srini
www.verifworks.com

In reply to Srini @ CVCblr.com:

Hi Srini,
Thanks for the reply, but my requirement is different, I will explain you with example:

que1_q[0] = a1; que1_q[1] = a1;
que2_q[0] = a2; que1_q[1] = a3;
que3_q[0] = a3; que1_q[1] = a4;
like a1, a2 and a3 should be unique and the other indexes elements may take the values what it generated in zeroth index but the elements in all the queues for particular index should be unique.

What it means is the zeroth index elements in all the queues should be unique but not the elements of any queue.

In reply to chaitanyajaladi:

Not sure why my solution won’t satisfy this, did you try?

In reply to Srini @ CVCblr.com:

Hi Srini,
The solution you gave is dependant on SV-2012 but i have SV-2008 and that too along with the above uniqueness i have some other requirements also…if you have any solution which has no dependancy then please let me know…
Once again thanks for your reply…
Thank you,

In reply to chaitanyajaladi:

try this test… it should meet your requirements without using ‘unique’ constraints…
change the class parameters ‘No_Of_Queues’ and ‘QueSize’ as per your requirements…

program tb;
class cls #(No_of_Queues = 6, QueSize = 10);
rand bit [7:0] que[No_of_Queues-1:0][$];

    constraint cons {
        foreach (que[i,]) {
            que[i].size == QueSize;
        }

        foreach (que[i,j]) {
            if (i < No_of_Queues-1) {
                que[i][j] != que[i+1][j];
            }

            if (j < QueSize-1) {
                que[i][j] != que[i][j+1];
            }
        }
    }

    function void print;
        foreach (que[i])  begin  
            $write("que[%0d] = ",i);

            foreach (que[i][j])
                $write(" %5d ", que[i][j]);

            $display("");
        end
    endfunction  
endclass

initial begin
    cls obj = new;
    obj.randomize;
    obj.print();
end  

endprogram

###################################################################################
que[5] = 23 12 86 147 121 233 167 135 17 248
que[4] = 191 111 104 216 233 242 158 36 231 59
que[3] = 211 242 184 135 13 21 49 75 190 222
que[2] = 87 174 219 45 210 114 50 71 99 187
que[1] = 213 242 124 60 98 192 254 245 47 18
que[0] = 201 205 253 36 117 204 227 182 17 48
###################################################################################