In SystemVerilog, you can used functions within a constraint block to help create more complex and reusable constraints. That function should be defined outside of constraint block.
Like static variables,a static constraint is shared among all instances of a class. Any change to a static constraint affects all instances.
In SystemVerilog, a soft constraint is a type of constraint that can be overridden by other constraints or explicitly specified values. Soft constraints are useful when you want to provide a default behavior that can be easily overridden if necessary.
The soft keyword is used to declare a constraint as soft.
Constraints in SystemVerilog are solved together, not in isolation or sequentially. It means the constraint solver considers all constraints at once to find a solution that satisfies all of them. If no such solution exists, the randomization will fail.
To solve the above issue, we can use the "solve ... before" feature. It will force the constraint solver to solve constraints in the defined orders. This feature can NOT be used with "randc" variablble.
Output: