APB Slave rdata is always X

I have a APB Slave which i am validating with UVM TB. I see the write’s are going through, but the read always return’s X. I have tried couple of ways but nothing helps. Can anyone help to see why the rdata is always X?

In reply to rag123:

You are reading from addresses you do not write before and your protocol in the monitor is wrong wrt to RD.
Additionally your convert2string prints only pwdata.

In reply to chr_sue:

Hi Chris,
I dont see anything wrong in the code. In the waves i dont the address actually changing for read and write. I added conver2string print for rdata. which part of the monitor code is wrong?

In reply to rag123:

See the modified example here:

Only your monitor code is wrong for the RD. When you are providing the address you’ll see the RD data 1 clock cycle later.
And you test is useless. You are writing to certain addresses and you are reading from other addresses. This results in the RD vale ‘=’.

In reply to chr_sue:

I see you have removed the 1 clock cycle delay in the monitor for prdata. I still dont see in the waves the prdata has a valid value. It is still X. what did you fix?

In reply to rag123:

No, I was adding another clock cycle in the monitor.
See the log-file here:

UVM_INFO @ 20: uvm_test_top.env.agt.drv [APB_DRIVER ] Got Transaction kind=WRITE addr=57 data=66

UVM_INFO @ 50: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction kind=WRITE addr=57 data=66

UVM_INFO @ 50: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction after waiting

UVM_INFO @ 60: uvm_test_top.env.agt.drv [APB_DRIVER ] Got Transaction kind=READ addr=85 data=d2

UVM_INFO @ 90: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction kind=READ addr=85 data=0

UVM_INFO @ 90: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction after waiting

UVM_INFO @ 110: uvm_test_top.env.agt.drv [APB_DRIVER ] Got Transaction kind=READ addr=ea data=95

UVM_INFO @ 140: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction kind=READ addr=ea data=0

UVM_INFO @ 140: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction after waiting

UVM_INFO @ 160: uvm_test_top.env.agt.drv [APB_DRIVER ] Got Transaction kind=WRITE addr=34 data=78

UVM_INFO @ 190: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction kind=WRITE addr=34 data=78

UVM_INFO @ 190: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction after waiting

UVM_INFO @ 200: uvm_test_top.env.agt.drv [APB_DRIVER ] Got Transaction kind=READ addr=fb data=bb

UVM_INFO @ 230: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction kind=READ addr=fb data=0

UVM_INFO @ 230: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction after waiting

UVM_INFO @ 250: uvm_test_top.env.agt.drv [APB_DRIVER ] Got Transaction kind=WRITE addr=e data=ee

UVM_INFO @ 280: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction kind=WRITE addr=e data=ee

UVM_INFO @ 280: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction after waiting

UVM_INFO @ 290: uvm_test_top.env.agt.drv [APB_DRIVER ] Got Transaction kind=WRITE addr=c6 data=f6

UVM_INFO @ 320: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction kind=WRITE addr=c6 data=f6

UVM_INFO @ 320: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction after waiting

UVM_INFO @ 330: uvm_test_top.env.agt.drv [APB_DRIVER ] Got Transaction kind=WRITE addr=46 data=c4

UVM_INFO @ 360: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction kind=WRITE addr=46 data=c4

UVM_INFO @ 360: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction after waiting

UVM_INFO @ 370: uvm_test_top.env.agt.drv [APB_DRIVER ] Got Transaction kind=WRITE addr=89 data=dd

UVM_INFO @ 400: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction kind=WRITE addr=89 data=dd

UVM_INFO @ 400: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction after waiting

UVM_INFO @ 410: uvm_test_top.env.agt.drv [APB_DRIVER ] Got Transaction kind=READ addr=92 data=5d

UVM_INFO @ 440: uvm_test_top.env.agt.mon [APB_MONITOR] Got Transaction kind=READ addr=92 data=0

The UVM_INFO from the driver is wrong in case of the RD, because the convert2string returns only the write data.

In reply to rag123:

In reply to chr_sue:
I see you have removed the 1 clock cycle delay in the monitor for prdata. I still dont see in the waves the prdata has a valid value. It is still X. what did you fix?

Your DUT is not working. Data are not stored in the mem.

In reply to chr_sue:

Please find your fixed example here:

In reply to chr_sue:

Thanks Chris :)