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<http://www.mailscanner.info/>, and is believed to be clean. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Wed Nov 16 09:04:33 2011
This archive was generated by hypermail 2.1.8 : Wed Nov 16 2011 - 09:04:37 PST