Re: [sv-ec] handling x's in expressions in constrants

From: Neil Korpusik <neil.korpusik@oracle.com>
Date: Thu Nov 17 2011 - 18:23:47 PST

<forwarding bounced email from Daniel Mlynek>

Date: Thu, 17 Nov 2011 08:03:50 +0100
From: Daniel Mlynek <danielm@aldec.com>
To: "Ryan, Ray" <Ray_Ryan@mentor.com>
CC: Daniel Mlynek <danielm@aldec.com.pl>, "sv-ec@eda.org" <sv-ec@eda.org>
Subject: Re: [sv-ec] handling x's in expressions in constrants

This is my doubt LRM do not precise when x's are forbidden. Both my
questions in fact have common root.
In yours interpretation x's occuring on contraints subexpression level
are ok - I assume that x's on contraints expression level would be
illegal ie:

constraint c1{(a/b==1) }; //b ==0 not rand

DANiel

On 11/17/2011 5:54 AM, Ryan, Ray wrote:
>
> Daniel,
>
> It has been pointed out to me that in the second example I was
> overlooking the "|| (b == 0)".
>
> With 'b' having a constant value of 0, the constraint effectively becomes:
>
> ( (a/0) == 1) || TRUE
>
> This constraint can be reduced to 'TRUE' leaving 'a' unconstrained.
>
> Regards,
>
> Ray
>
> *From:*owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] *On Behalf Of
> *Ryan, Ray
> *Sent:* Wednesday, November 16, 2011 9:04 AM
> *To:* Daniel Mlynek; sv-ec@eda.org
> *Subject:* RE: [sv-ec] handling x's in expressions in constrants
>
> Daniel,
>
> In my opinion,
>
> the constraint:
>
> ( (a/b) == 1) || (b==0)
>
> Is equivalent to:
>
> If (b != 0) { (a/b) == 1; }
>
> The solver should allow solutions with b == 0.
>
> In the second case, you have effectively have the constraint:
>
> (a / 0) == 1;
>
> There isn't explicitly an 'x' -- rather for any value of 'a' the
> result of "a / 0" is 'x'. Since 'x' is not allowed, this implies that
> there is no legal value for 'a'. Thus the randomize result is 0.
>
> Regards,
>
> Ray Ryan
>
> *From:*owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] *On Behalf Of
> *Daniel Mlynek
> *Sent:* Wednesday, November 16, 2011 4:35 AM
> *To:* sv-ec@eda.org
> *Subject:* [sv-ec] handling x's in expressions in constrants
>
> I've doubts on how x's should be handled by solver. LRM say only that
> x's are illegal in constraints but give no more detail on complex expr
> behaviour
>
> Please see examples - my questions are in comments
>
> class C;
> rand reg[1:0] a,b;
> constraint c1{(a/b==1) || (b==0);};
> function void post_randomize;
> $display("%d %d",a,b);
> endfunction
> endclass
>
> module top;
> C c =new;
> initial begin
> repeat (15)//should solver allow b==0 to be randomized or should
> not (bcos of x result in 2nd part of expr - a/b==1)??
> assert(c.randomize) else $display("failure");
> c.b=0;
> repeat (15) //should fail immediately bcos of x's or only x's on
> top level expr should results in runtime failure???
> assert(c.randomize(a)) else $display("failure");
> end
> endmodule
>
>
>
> DANiel
>

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Nov 17 18:24:13 2011

This archive was generated by hypermail 2.1.8 : Thu Nov 17 2011 - 18:24:16 PST