Poke and peek method(Register model)

How to I use poke/peek method when I want to forcefully write into a read only register? Is there any other method where I can write a value to a RO register?

In reply to NehaD:

Using poke is the most elegant way to write a RO register like this:

<reg_name>.poke(status, data, .parent(this));

where data is the value you wan to write.
Another way is to force the reister variable and update afterwards the value in the register model of yoour testbench.
But this is expensive compaed to the poke.

In reply to chr_sue:

In reply to NehaD:
Using poke is the most elegant way to write a RO register like this:

<reg_name>.poke(status, data, .parent(this));

where data is the value you wan to write.
Another way is to force the reister variable and update afterwards the value in the register model of yoour testbench.
But this is expensive compaed to the poke.

Thank you for the response.
Do I have to write hdl path/reg model path for the register at <reg_name> ?

You need to specify the path using the add_hdl_path method of uvm_reg_block class to specify the path to RTL registers.

function void add_hdl_path (string path , string kind = “RTL”)

In reply to Neha_D:

In reply to chr_sue:
Thank you for the response.
Do I have to write hdl path/reg model path for the register at <reg_name> ?

Yes you have to specify/set the actual hdl path using add_hdl_path and add_hdl_path_slice.