[sv-ec] Functions in constraints

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Tue Jun 16 2009 - 05:40:09 PDT
Hi,

Chris Spear pointed out that the text in 18.5.11 on functions in constraints is unclear.

The text says,

"- Functions shall be called before constraints are solved, and their return values shall be treated as state variables.

- Random variables used as function arguments shall establish an implicit variable ordering or priority. Constraints that include only variables with higher priority are solved before other, lower priority constraints. Random variables solved as part of a higher priority set of constraints become
state variables to the remaining set of constraints. For example:

class B;
rand int x, y;
constraint C { x <= F(y); }
constraint D { y inside { 2, 4, 8 } ; }
endclass

forces y to be solved before x. Thus, constraint D is solved separately before constraint C, which uses the values of y and F(y) as state variables. In SystemVerilog, the behavior for variable ordering implied by function arguments differs from the behavior for ordering specified using the "solve...before..." constraint; function argument variable ordering subdivides the solution space thereby changing it. Because constraints on higher priority variables are solved without considering lower priority constraints at all, this subdivision can cause the overall constraints to fail. Within each prioritized set of constraints, cyclical (randc) variables are solved first."

These two dashed items seem contradictory. The first says that functions are called before constraints are solved, but the example shows constraint D being solved before the call to F(y).

Apparently a simple, and at first glance reasonable, interpretation of the first dashed item, that ALL functions in constraints are solved before ANY constraints are solved, is not the correct interpretation.

What is the correct interpretation?

Is the second dashed item to be considered a continuation of the first, denoting an exception to the general rule, and saying that only those constraints needed to be solved to order to evaluate the function calls are solved before the functions?

Or is the first dashed item to be interpreted as saying that functions in a certain constraint are called before that particular constraint is solved, but there is no necessary order between a function in one constraint and another, unrelated constraint?

Is there a difference between these two interpretations?

If a function reads the value of a random variable which has no constraint on it, I assume it is simply randomly assigned a value?

Also, the last sentence mentions randc variables. Is the interpretation that first function calls are evaluated, then randc variables are solved for, then rand variables?

Thanks,
Shalom

Shalom Bresticker
Intel LAD DA
Jerusalem, Israel
+972  2 589 6582 (office)
+972 54 721 1033 (cell)


---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Jun 16 05:54:26 2009

This archive was generated by hypermail 2.1.8 : Tue Jun 16 2009 - 05:55:21 PDT