Constraint solver issue, while this constraint sometimes results in errors?

In reply to Yesire-Lincoln:

The issue with your initial approach is related to the fact that SystemVerilog’s constraint solver is not always able to find a valid solution for certain constraints. The constraints you provided are complex, and the solver has difficulty finding a solution that satisfies all of them simultaneously. This is a common challenge in random testing and constraint-based randomization.

In the modified approach, you’ve simplified the constraints, and the solver can now find a solution more easily. This simplification makes the problem more tractable for the solver.

Here are some observations and suggestions:

Complexity of Constraints: The complexity of constraints, including dependencies and relationships between variables, can impact the solver’s ability to find a solution. Simplifying constraints or breaking them down into smaller, more manageable parts can improve solver performance.

Randomization Priority: You’ve used the soft constraint to set priorities (aa and bb). Setting priorities can guide the solver to focus on certain constraints before others. This can be helpful when dealing with conflicting constraints.

Partitioning Constraints: Your modified approach includes a foreach loop to iterate over the elements of bcrdt[0].credit_num. This helps in partitioning the constraints and simplifying the solving process.

Alternative Approaches: If you encounter difficulty in solving constraints, you might consider alternative approaches such as using multiple randomize calls with different constraints or breaking down complex constraints into simpler ones.

Remember that constraint solving is a complex task, and the effectiveness of the solver can depend on the specific constraints, their interdependencies, and the characteristics of the random variables involved. If a solution cannot be found, simplification of constraints and exploring alternative approaches are reasonable strategies.


Rahulvala@gmail.com
Verificaion engineer