Hi everyone,
I’ve encountered the following failure:
Solver failed when solving following set of constraints
bit[31:0] id = 32’h0;
rand packet_direction_vt my_variable= TRANSMIT; // rand_mode = OFF
constraint my_variable_c // (from this) (constraint_mode = ON)
{
((id % 2) == 0) → my_variable== RECEIVE;
}
Here is a representation of my code:
typedef enum {
RECEIVE = 0,
TRANSMIT = 1
} packet_direction_vt;
class base_class extends uvm_object;
rand packet_direction_vt my_variable;
int id;
constraint my_variable_c {((id % 2) == 0) -> my_variable== RECEIVE;}
endclass : base_class
class extended_class extends base_class; // Overriding the base_class in my test, using UVM factory
function void pre_randomize();
super.pre_randomize();
my_variable.rand_mode(0);
my_variable = TRANSMIT;
endfunction : pre_randomize
endclass : extended_class
class my_env extends uvm_component;
function create_class();
base_class my_base_class_object;
my_base_class_object.randomize(); // Fail on this line !
endfunction : create_class
endclass : my_env
Please note that the base_class is overriden with the extended_class using UVM factory.
Could someone explain me why I am failing on a constraint solver issue, despite the fact that my variable is set as rand_mode(0) ?
Thanks in advance