Hello,
I have a case where say an array[3][3] (9 elements) needs to be randomized such that sum of rows and columns is the same and all elements are unique.
While the sum of rows can be ensured using array.sum() == value how can I apply that to the column elements ?
parameter SIZE =3;
class ABC;
rand bit[4:0] md_array [][];
constraint c_md_array {
md_array.size() == SIZE;
foreach(md_array[k]) {
md_array[k].size() == SIZE;
}
foreach(md_array[i]){
md_array[i].sum() with (7'(item)) == 'd21;
unique {md_array[i]};
}
}
endclass