Regarding function in constraints

In reply to dave_59:

Dave ,
A follow-up question. I was thinking of an example for the quote from Section 13.2 of the LRM :

“A nonvoid function can be used as an operand in an expression; the value of that operand is the value returned by the function.”

As you mentioned : “User defined functions in constraints do not get in-lined.”

So I was thinking of built-in functions eg: $countones


  rand bit[9:0] a;
  constraint ONES { $countones(a) == 4; }

In this case the return type of nonvoid function would be in-lined to the constraint , right ?


  constraint ONES { int'( a[9] + a[8] +  a[7] + a[6] + a[5] + a[4] +  a[3] + a[2] + a[1] + a[0] ) == 4; }

As a result there should be no implicit ordering for random variables using built-in functions.