I am trying to write a constraint that will cause a variable to be selected from a set of predefined values. This would only occur when another bit is set to true so I would like to place it within an implication. If valid_transaction is not true then any value can be picked.
I have sketched out the following pseudo-code.
byte set_of_values [6] = {'h3, 'h6, 'h7, 'h9};
rand bit valid_transaction;
rand byte my_value;
constraint valid_c {
valid_transaction → my_value inside {set_of_values};
}
The part that I can’t get to compile is the “my_value inside {set_of_values}”. Is there a valid syntax to cause my_value to take on one of the values in set_of_values? Or do I need to take a slightly different approach?
Thanks.