Hi,
I am getting randomization fail, I don’t know why?
In testcase, I am randomizing config object class.
class my_test extends extends base_test;
...............
if(!hci_cfg.randomize() with {
error_pkt[8] == 1;
}
..............
enclass;
In hci_config the variable is declared as follows.
class hci_config extends uvm_object;
.....................
rand bit [31:0] error_pkt;
randc bit [63:0] error_field;
constraint ERROR_PKT_ONE_HOT{
$countones(error_pkt[11:0]) == 1;
error_pkt[21:12] > 0;
}
constraint ERROR_PKT_FIELD {
if(error_pkt[0]) {
error_filed[13] == 1;
}
}
.....................
endclass
But in test if I give inline constraint like below, randomization will pass.
class my_test extends extends base_test;
...............
if(!hci_cfg.randomize() with {
error_pkt[8] == 1;
error_pkt[7:0] == 1;
error_pkt[11:9] == 1;
}
..............
enclass;
I am using questasim simulator.
Can anyone please explain why constraint is not applying properly?
Thanks in advance