How to read/write a uvm_reg_field?

Hi, all

Is it possible to read/write some specific field in a uvm_reg?

I’ve defined register in my_top_reg.my_block as follows:


class my_reg extends uvm_reg;

  rand uvm_reg_field my_field;
  rand uvm_reg_field my_filed1;
	...

  virtual function void build();
    my_field = uvm_reg_field::type_id::create("my_field");
    my_field.configure(this, 8, 0, "RW", 0, 64'h00000000>>0, 1, 1, 1);
		...
    uvm_pkg::uvm_resource_db#(bit)::set({"REG::",get_full_name()}, "RW", 1);
  endfunction

  `uvm_register_cb(my_reg, uvm_reg_cbs) 
  `uvm_set_super_type(my_reg, uvm_reg)
  `uvm_object_utils(my_reg)
  function new(input string name);
    super.new(name, 32, UVM_NO_COVERAGE);
  endfunction : new
endclass : my_reg

Is it possible to write only the field - my_filed, and do nothing to other fields? if yes, How?

I’ve tried my_top_reg.my_block.my_reg.get_filed_by_name(‘my_filed’) to get the handle of my_filed – loc_field, and use loc_filed.write(status, write_data) to write to this field, but failed in UVM_WARNING:
Target bus does not support byte enabling, and the field ‘my_top_reg.my_block.my_reg.my_field’ is not the only field within the entire bus width. Individual field access will not be available. Accessing complete register instead.

In reply to EnRoute_zt:

Does your uvm_reg_adapter have supports_byte_enable set? And does your field the sole field within that byte address?