Re: [sv-ec] FW: Question: Duplicate values in set membership


Subject: Re: [sv-ec] FW: Question: Duplicate values in set membership
From: Arturo Salz (Arturo.Salz@synopsys.com)
Date: Mon Jun 16 2003 - 16:53:05 PDT


Ryan,

My answers are interspersed below in blue.

    Arturo

--------------------------------------------------------------------------------

In looking at the Set Membership (12.4.3) for Random Constraints I have a
couple questions.

1) Are the following constraints equivalent?

     rand x,y;

     constraint c1 {x inside {1:2,2,2,2:3}; }
     constraint c2 {(x==1)||(x==2)||(x==2)||(x==2)||(x==2)||(x==3); }
     constraint c3 {(x==1)||(x==2)||(x==3); }
     constraint c4 (x inside {1:3}; }

   I would expect that there is no constraint semantic associated
   with a value being repeated in a membership set. That is, the
   probability of x==2 is the same for each of the above constraints.
   Is this right?

Your assumption is correct. All four constraints above are equivalent,
including the distribution, that is, in all four cases, the value 2 has the
same probabilty as 1 and 3, which is 1/3. For this simple case where
you have a single variable as the left operand to the inside operator,
the inside operator is simply a shorthand to the equality operator.

   Section 12.4.3 contains the text,
   "Absent any other constraints, all values (either single values
    or value ranges), have an equal probability of being chosen by
    the inside operator."

   To me, it is not clear what it means for a single value or value
   range to have equal probability.

As I understand it, there are value constraints and distribution
constraints. Value constraints define the set of legal values and
legal combinations of values for random variables. Distribution
constraints control the probability of occurance for legal value
combinations. The 'dist' and 'solve-before' constraints are
distribution constraints, the others (including 'inside') are value
constraints. Is this right?

You are right. The 'inside' operator specifies membership only.
The 'dist' and 'solve-before' specify biasing and thus modify the
distribution. What is not clear from the LRM statement? Perhaps
we can ammend the wording to clarify?

2) Are the following legal constraints (I expect they are)?

    rand x,y,z;

    constraint c1 { 2 inside { x, y, z }; }
    constraint c2 { 3 inside { x:y }; }
    constraint c3 { z inside { x:y }; }

    The LRM quote above also seems unclear when applied to these
    constraints - i.e. In c1, do x,y,x have equal probability of
    being chosen by the inside operator?

These constraints are all legal. I assume you meant x,y,z above, right?
All variables have the same probability of being "chosen" by the solver
of the inside operator. However, these constraints specify slightly
different solution spaces. I explain these in the attached word document.

Thanks,
Ray

Ray Ryan
Staff Engineer
Mentor Graphics
(408)487-7240
ray_ryan@mentorg.com




This archive was generated by hypermail 2b28 : Mon Jun 16 2003 - 16:55:11 PDT