Predictor value(mirrored value) not getting updated in uvm reg model

Hi
I am working on default read test in register model but issue is my dut read value and expected value(i.e. from predictor) is mismatched.
In other reg model test cases lets say, write read or read only test cases, however write function is updating the predicted value (or expected value) but in default read test, we do not have write , we just have read or mirrored value due to which the value is not getting updated in the predictor even if dut is giving expected value.

In read_sequence i am having the code as follows:

if(mirror)
regs[i].mirror(reg_status,UVM_CHECK,hdl_path,reg_map[0]);
else
regs[i].read(reg_status,reg_data,hdl_path,reg_map[0]);

I also have set_auto_predict(1) in env and even if i am only writing

regs[i].mirror(reg_status,UVM_CHECK,hdl_path,reg_map[0]); 

but still unable to get dut_read_value and expected to be same.

Can anyone please help me out in resolving this?

Thanks in advance

In reply to M SILPA:

If you’re using directly mirror method for register comparison before doing any write operation then flow will be :

  1. Perform get() on assigned register and store in exp_val variable, which will give predicted value. Here, in directly mirror method, predicted value will be same as reset value configured to register (If and only if ral_model.reset() is invoked initially) else it will have 'h0 value.
  2. Perform read operation on register and update the predicted value, if set_auto_predict is enabled. and afterward it will compare the read value with exp_val.

Kindly check with your configured reset value and read value, if you’re doing direct read before doing any write operation.

Regards,
Mitesh Patel

In reply to mitesh.patel:

What you see is the expected behavior.
The mirror command returns the value of the register in your DUT. And this might differ from the value of the register in your testbench.
The get command returns the value of the register in the testbench.

The read command is ececuting a mirror and a get command and this might show different values.
To snchronize your register model in the TB with registers in the DUT simply execute update.

It worked by only adding reg_model with reset() in reset phase of test case.
But i wanted to know where to execute update to have synchronization between tb and dut.

In reply to M SILPA:

Thanks chr_sue for response.

Hi M SILPA,
Update method is used to perform write operation with desired value if you think that your predicted value and actual design register value may different. It can be used at any point of time in simulation.

Regards,
Mitesh Patel

In reply to mitesh.patel:
OK thanks for the info.

In reply to M SILPA:

It worked by only adding reg_model with reset() in reset phase of test case.
But i wanted to know where to execute update to have synchronization between tb and dut.

The update method has to called on each register. With get_regs() you can store all registers in a queue. In a foreach loop you can the call update like this:

my_reg(i).update();