Passing Adress to Register block

Hi,

I am new to UVM Register Layer.
I want to use the same inside an existing UVM env.
I have register read and write functions already implemented in the sequence
which has the following Implementation:-

function reg_write(bit [31:0] adress, bit [31:0] data);
`ovm_do_on (APB_READ_SEQ, APB_SEQR);
endfunction

function reg_write(bit [31:0] adress, output bit [31:0] data);
`ovm_do_on (APB_WRITE_SEQ, APB_SEQR);
endfunction

How can I map this function to the RAL read and write?

Can we use the address of register directly inside write function?

Thanks in advance.

Try:

Previous defined:
<your_reg_model> rm;

function void reg_write(bit [31:0] adress, bit[31:0] data);
uvm_reg rg;
uvm_status_e status;
uvm_reg_data_t wdata;

rg = rm.get_reg_by_offset(adress); // Look up the register in the register model by its address
rg.write(status, wdata’(data), .parent(this);
endfunction: reg_write

And something similar for the read.

Note that this all rather defeats the purpose of using the register model, but should get you going for legacy code that is dealing in addresses etc.

In reply to mperyer:

Thanks mperyer,

I will try this.