Hello,

I've written this following constraint.

//--------------------------------------------------------
class array ;
rand int unsigned len[];
constraint c_len {
foreach (len[i])
len[i] inside {[1:255]} ;
len.sum < 1024 ;
len.size() inside {[1:8]} ;
}
endclass
//--------------------------------------------------------

How constraint solver works? or How does the statements inside constraint gets execute and in which sequence? or How constraint solver solves the inter-dependency of variables inside constraint?

for eg. in above constraint size of the array should be randomize before the assignment of values using foreach loop.

but i've written len.size after assignment then also it's working.

I mean how does it randomizes all the three things and in which order and can you please explain me w.r.t. timing?

//--------------------------------------------------------
class one;
rand int a, b, c, d;
constraint c_one {
b < a ;
a > 34 ;
d < c ;
c >= 23 ;
}
endclass
//--------------------------------------------------------

In this class one, variable b is dependent on variable a and the same case for variable d and c, respectively.

So, how the constraint solver will solve this inter-dependency of variables?