program sum_catch;
class sum_c;
rand int size;
rand bit [7:0]a[];
constraint c{
a.sum <1024;
foreach (a[i]) a[i] inside {[0:255]}; // this is imporatnt remove tghis line and se the results
a.size() inside {[1:8]};
};
endclass
sum_c obj;
initial begin
obj = new;
repeat (3) begin
obj.randomize();
$display("%g", obj.a);
end
end
endprogram
Result is
-125 30 49
-113 12 -31 28 -15 105 -58
15
Why am i seeing negative results ? please help me