In reply to dave_59:
Hi Dave,
Could you help me understand what is going wrong here?
module test();
class temp;
rand int box[][];
constraint c {
box.sum() with (item.sum() with (item));
box.size == 10;
foreach(box[i,j]) {
box[i][j] <= 5;
}
}
endclass
initial
begin
temp t = new();
t.randomize();
$display("var is %0d", t.box.size);
end
endmodule
ncsim> run
box.sum() with (item.sum() with (item));
|
ncsim: *E,RNDCNSTE (./testbench.sv,7|10): Randomization constraint has this error, which will cause the randomize function to return 0 and no new rand values will be set:
Unsupported operator 'sum over upper dimension of multi-dimensional array' in this constraint expression.