User guide
24-81
SystemVerilog Testbench Constructs
A default constraint for a particular variable is deemed applicable if
no other non-default constraints apply to that variable. The solver
satisfy all applicable default constraints for all variables. If the
applicable default constraints cannot be satisfied, the solver
generates a solver failure.
The following example illustrates the specification of default
constraints.
Example 24-1 Default Constraint
default constraint foo{
x > 0;
x < 5;
}
If no other non-default constraints apply to variable x, then the solver
satisfies the specified default constraints.
Properties of Default Constraints.
• All constraint expressions in a default constraint block are
considered default constraints.
• You can specify multiple default constraints, possibly in multiple
constraint blocks, specified for multiple random variables are
solved together.
• You can query the status of a default constraint block using
constraint_mode(), and they can turned ON or OFF.
• You cannot define unnamed constraint blocks (that is,
randomize() with) as default. The compiler generates an error.
• You can define a default constraint block to any variable visible
in the scope where it is declared.