In reply to Balu_15:
If you want an example of adapter’s reg2bus() and bus2reg() methods, there is one for APB bus in UVM user guide. You can take it as reference and get more info from the guide.
//------------------------------------------------------------------------------
// Group: Example
//
// The following example illustrates how to implement a RegModel-BUS adapter class
// for the APB bus protocol.
//
class reg2apb_adapter extends uvm_reg_adapter;
`uvm_object_utils(reg2apb_adapter)
function new(string name="reg2apb_adapter");
super.new(name);
endfunction
virtual function uvm_sequence_item reg2bus(uvm_reg_bus_op rw);
apb_item apb = apb_item::type_id::create("apb_item");
apb.op = (rw.kind == UVM_READ) ? apb::READ : apb::WRITE;
apb.addr = rw.addr;
apb.data = rw.data;
return apb;
endfunction
virtual function void bus2reg(uvm_sequencer_item bus_item,
uvm_reg_bus_op rw);
apb_item apb;
if (!$cast(apb,bus_item)) begin
`uvm_fatal("CONVERT_APB2REG","Bus item is not of type apb_item")
end
rw.kind = apb.op==apb::READ ? UVM_READ : UVM_WRITE;
rw.addr = apb.addr;
rw.data = apb.data;
rw.status = UVM_IS_OK;
endfunction
endclass