Вы можете поместить if-else в ограничение
rand bit value;
bit x;
constraint c {
if(x)
value dist {1 := 3, 0 := 1};
else
value dist {1 := 1, 0 := 3};
}
Ваши веса также могут быть переменными
int weight0, weight1;
constraint c {
value dist {1 := weight1, 0 := weight0};
// set before calling randomize
if (x) begin
weight1 = 3; weight0 =1;
end else begin
weight1 = 1; weight0 =3;
end
Или выражениями
constraint c {
value dist {1 := x?3:1, 0 := x?1:3};