Section 13.10 describe the behavior of in-line variable control as: "This mechanism controls the set of active random variables for the duration of the call to randomize, which is conceptually equivalent to making a set of calls to the rand_mode() method to disable or enable the corresponding random variables." The LRM does NOT make any mention of changing the set of active constraints. When a class is randomized, the randomization includes all the active constraints in the class. So a contraint on state variables that is not met will cause the randomization to fail. Consider the following: module top; class example; rand int xval, yval; int aval, bval; constraint c1 { aval < bval; }; constraint c2 { aval < xval; }; endclass example E1 = new; initial begin E1.aval = 10; E1.bval = 10; assert ( E1.randomize() ); // fails constraint c1 E1.aval = 9; assert ( E1.randomize() ); // succeeds E1.xval = E1.aval; E1.xval.rand_mode(0); assert ( E1.randomize() ); // fails constraint c2 E1.xval.rand_mode(1); assert ( E1.randomize(yval) ); // fails constraint c2 end endmodule The first randomize fails due to constraint c1. The values of the state variables (aval, bval) do not meet the constraint. The second randomize succeeds because the state variable now have good values. The third randomize fails because 'xval' is now a state variable. The values of state variables (xval, aval) cause constraint c2 to fail. The fourth randomize is similar to the third. The constraint 'c2' will fail because the values of state variable (xval, aval). - Ray ________________________________ From: owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org] On Behalf Of Symons, Tom H Sent: Friday, April 14, 2006 9:33 AM To: sv-ec@server.eda.org Subject: [sv-ec] In-line random variable control When calling randomize with arguments, should the constraint solver fail if random variables not specified as arguments do not satisfy their constraints at the time of the call? Or should the solver just focus on the random variables given as arguments, and only consider constraints that directly or indirectly involve them? The two simulators we are working with have come to opposite conclusions on this issue. I would think in-line random variable control would be much more useful if only related constraints were involved. Thanks Tom SymonsReceived on Fri Apr 14 10:32:02 2006
This archive was generated by hypermail 2.1.8 : Fri Apr 14 2006 - 10:32:06 PDT