The randomize method call failed when using simopts with constraints

Hi All,

am getting following warning when i use simopts with constraints.

code:

rand  int  num;
constraint num_c {
num inside {[1:6]};}

virtual function void build_phase(uvm_phase phase);
      super.build_phase(phase);
      if($value$plusargs("num=%d",num)) begin
        `uvm_info(get_full_name(), $sformatf("num set from cmdline %d",num), UVM_MEDIUM);
      end
      cfg.randomize() with { chn[num] == INPUT;} ;     //randomize the configuration object 
endfunction : build_phase

Warning:
The randomize method call failed. The unique id of the failed randomize call is 25.

Please help me

In reply to amsaveni.c:

Could you provide more details about the surrounding code ? Is the randomize of the wrapper class called ?

In reply to Rsignori92:

Hi… when i try below code i got The randomize method call failed. The unique id of the failed randomize call warning.

rand int num;
constraint num_c {
num inside {[1:6]};}

virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
this.randomize();
endfunction : build_phase