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;
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…
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.
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,
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