UVM reg field access via name

In reply to mayurverf:

The brute force approach is to loop over all registers and collect all of them that have the field:


uvm_reg regs[$];
uvm_reg regs_with_field[$];
reg_map.get_registers(regs);

foreach (regs*)
  if (regs[i].get_field_by_name(field_name) != null)
    regs_with_field.push_back(regs[i]);

There’s a [i]get_fields(…)* function in uvm_reg_map that returns all fields in all regs. You could alternatively loop over those to find the fields with the same name and get their parents.