In reply to prasadaddagarla:
The LRM only defines the behavior of all array manipulation for a single dimension. It even has this example
logic [7:0] m [2][2] = '{ '{5, 10}, '{15, 20} };
int y;
y = m.sum with (item.sum with (item)); // y becomes 50 => 5+10+15+20
Your tool seems to treat the array reduction methods differently inside a constraint versus outside a constraint. Try this code
class A;
rand bit [4:0] a [3][3];
constraint c1 {
a.sum() == 15; // illegal
a.sum() with (item.sum) == 15;
}
endclass
module top;
A h = new;
initial begin
assert (h.randomize);
$display(h.a.sum()); // illegal
$display(h.a.sum() with (item.sum));
end
endmodule