UVM RAL adapter for APB transaction

I guess your confusion comes from the fact that your APB items contains both a pwdata and a prdata field. Ideally it should have only contained a single pdata field that would contain the value to be written to pwdata for a write transaction or the value read from prdata for a read transaction.

When calling reg2bus(…) you are constructing the transaction that will be executed on the bus. The key here is that the transaction wasn’t executed yet, so for a read, you have no idea what it will return. After the transaction is finished, the driver should update the prdata field with the value actually read from the DUT. The register layer will then call bus2reg(…) on this item which will update the data field of the register item.

Long story short, for reads, reg2bus(…) does nothing, for writes bus2reg(…) does nothing.