UVM reg field access via name

In reply to Tudor Timi:

Hi Tudor ,

Is there any way to set those fields by some value. I am using the same foreach loop to get all the registers.But performing some tasks in the fields of those registers.

For example : -

foreach (maps[j])
                   begin 
                       foreach (fields[k]) 
                          begin 
                             if(fields[k].get_n_bits()> 1)
                              begin 
                               for(int n = 0;n < fields[k].get_n_bits();n++)
                                  register_var[regidx].fields[k].set(data[n]);  //setting the desired value 
                              end
                           end
                    end

But this code is not working as the register variable do not have “fields” in them.

Thanks