In reply to dave_59:
I tried that too, but now it complaints that
"xmsim: *W,RNDOCS: These constraints contribute to the set of conflicting constraints:
foreach (a[,j]) a.sum() with (int'(a[item.index][j])) == 30; (./testbench.sv,9)
foreach (a[i]) a[i].sum() with (int'(item)) == 30; (./testbench.sv,6)"