Semadar
Semadar

Reputation: 105

How can I solve endless backtracks in IntelliGen

I wrote the following code:

struct packet {
    x:int;
    y:int;

    x >= 0 => y==1;
    x < 0 => y==2;
};

While it solved very fast in Specman, for some seeds the Gen Debugger shows that the generator tries to assign y to values different than 1 and 2 and even “y: set of rollbacks”. What I am doing wrong ?

Upvotes: 0

Views: 67

Answers (4)

Assaf
Assaf

Reputation: 79

Since the generation engine doesn't know the valid space of y's values, it may try to solve it by assigning a random value for y in [MIN_INT..MAX_INT] and only then for x which leads for endless loop. You can solve it by to options:

  1. Add

    keep y in [1,2]

  2. Replace the constraints with

    keep y == (x >= 0) ? 1 : 0

Upvotes: 3

ronyguti
ronyguti

Reputation: 31

You can help the generator by reducing the state space for the solution according to your intent. It can be done in two ways 1. keep y in [1..2]; 2. Consolidate the constraints keep y == (x>0) ? 1 : 2;

Upvotes: 0

user3625400
user3625400

Reputation: 1

In this case generation engine needs to infer information about y from 2 different constraints, which is expensive. Try to consolidate the constraints in single one and/or add information you already know to help it.

Upvotes: 0

Lior A
Lior A

Reputation: 51

Using the trinary construct in this case, the generator can easily solve the constraint.

Upvotes: 0

Related Questions