In reply to rag123:
module tb;
class my_item;
rand bit a[9][9];
constraint c{a.sum() with ($countones(item)) ==10;}
endclass
initial begin
my_item m1;
m1=new();
assert(m1.randomize());
$display ("%p",m1.a);
end
endmodule
this is throwing error :
Unsupported operator 'sum over upper dimension of multi-dimensional array' in this constraint expression.
assert(m1.randomize());