I have a following constraint,
typedef enum {
none_dist,
low_dist ,
medium_dist,
high_dist,
on_dist
} test_dist_t;
rand test_dist_t b;
bit c;
constraint cst{
a dist { 0:= 25, 1:= 75 };
b dist {low_dist := 60, medium_dist := 35, high_dist := 5};
c -> {
d dist { 0 := 25, 1 := 75 };
}
//Problematic constraint condition - Not working
$onehot({a, (b != none_dist), d});
}
With the above version of constraint, variable d never goes HIGH in any one the tests. But if $onehot function is replaced as below
constraint cst{
a dist { 0:= 25, 1:= 75 };
b dist {low_dist := 60, medium_dist := 35, high_dist := 5};
c -> {
d dist { 0 := 25, 1 := 75 };
}
/Working constraint condition
a ^ (b != none_dist) ^ d;
}
Able to see d variable going HIGH on some tests. Only difference between above mentioned constraints are use of $onehot and not using $onehot.
Note: bit c is set externally.
Not able to understand the problem with the constraint that uses $onehot function because of which d never happens. Please help me debugging the constraint.