Hi Dave,
How would you initialize (in SV) a two dimensional array (4x3) to all numbers from 1 to 12 in a unique manner? This is how I wrote it, but I am sure there are more efficient ways, besides, I am not even sure if what I wrote below would work! Thanks in advance!
rand byte my_array[4][3];
int my_q[$] = {1,2,3,4,5,6,7,8,9,10,11,12};
int max_idx =11;
int idx = $urandom_range(11,0);
for (int i=0; i<4; i++)
for (int j=0; j<3; j++) begin
my_array[i][j] = my_q[idx];
my_q.delete(idx);
max_idx--;
idx = $urandom_range (max_idx,0);
end
end
Vahid