Randomization failed

HI ,

can anyone help me to write constraint for following formulae

rand real depth;
rand logic [14:0] inc;
rand logic [12:0] mod;
rand logic [5:0] var1;
rand bit a;

depth= (mod*inc*5*100)/((2**15-1)*var1)

if a=0 depth should between 0.25 to 2 
if a=1 depth should between 0.5 to 4.0

when i wrote constraint like this inside seq item 
constraint c_a { (a==1'b0)-> depth inside { [0.25:2]};
                   (a==1'b1)-> depth inside { [0.5:4.0]};}

 constraint c_depth { depth==(inc*(mod*100.0*5.0))/( (2**15-1)*var1);}
 constraint c_solve_before { solve depth before a;}

showing error like
“The randomize method call failed. The unique id of the failed randomize call is 0.”

                                Thanks in advance

regards
venkat

In reply to kathula venkatesh:

At a high-level the LRM does not allow randomization of real-number variables. You can get around this by declaring the variable, in your case depth, as

rand longint depth;

and then using $bitstoreal(depth) in the constraint.

In reply to sbellock:

HI, thanks for reply
i am getting error like if am using $bitstoreal(depth) in the constraint.
“A ‘system task/function call’ cannot be used within a constraint expression.”

In reply to kathula venkatesh:

Some tools allow randomization of real random variables with a limited set of constraints. Please contact your tool vendor directly for support.

Absent of that, declare depth as an integral type and scale up all the constraints. Then in post_randomize, scale depth back down to a real number.