If Change the size of A I am not getting the expected value can anyone help me why I am getting unexpected values
class C;
rand bit [7:0] A[] ; //if my bit value is 7:0 is getting expected value
constraint c1 { A.size == 5; }
constraint c2 { A.sum() with (int'(item)) < 1000; }
endclass
module top;
C A[10];
initial
begin
foreach(A[i])
begin
A[i] = new();
assert(A[i].randomize());
$display(" %p", A[i].A);
end
end
endmodule
run -all
'{52, 116, 27, 117, 9}
'{234, 128, 109, 243, 251}
'{103, 191, 223, 56, 62}
'{1, 143, 120, 157, 215}
'{130, 119, 51, 54, 248}
'{171, 55, 70, 59, 18}
'{134, 194, 18, 241, 91}
'{94, 212, 232, 79, 11}
'{20, 120, 110, 206, 223}
'{227, 253, 171, 58, 124}
exit
class C;
rand bit [31:0] A[] ;
constraint c1 { A.size == 5; }
constraint c2 { A.sum() with (int'(item)) < 1000; }
endclass
module top;
C A[10];
initial
begin
foreach(A[i])
begin
A[i] = new();
assert(A[i].randomize());
$display(" %p", A[i].A);
end
end
endmodule
run -all