Hi,

I tried to generate the bath-tub curve distribution using the constraint posted on this verification academy page but got run-time error from the constraint used in it.

Here is the constraint used in the page

int a[5] = '{1, 11, 21, 31, 41}; int b[5] = '{10, 20, 30, 40, 50}; int c[5] = '{30, 15, 10, 15, 30}; constraint c_value { foreach (a[i]) value dist { [a[i]:b[i]] :/ c[i] }; }

And during runtime, I got the following errors.

"

Solver failed when solving following set of constraints

integer a[2] = 21;

integer b[2] = 30;

integer c[2] = 10;

integer a[3] = 31;

integer b[3] = 40;

integer c[3] = 15;

rand integer value; // rand_mode = ON

constraint c_value // (from this) (constraint_mode = ON) (testbench.sv:10)

{

(value dist {[a[2]:b[2]] :/ c[2]});

(value dist {[a[3]:b[3]] :/ c[3]});

}

=======================================================

"

Then I manually unrolled the foreach distribution and it worked as expected.

constraint c_value{ value dist{ [1:11]:/30, [11:20]:/15, [21:30]:/10, [31:40]:/15, [41:50]:/30 }; }

Thus I wonder why the first distribution constraints that use "foreach" will cause the solver to fail?

Thanks in advance for your help!