I am working on UVM register model, where I have registers with various size from 1 to 512 bits. Interface is AHB 32 bits and with HSEL signal I access to 8bits, 16bits and 32 bits. How can I impact using callbacks on the number of accesses without modifying driver? For example, when I have 53 bits register or when I have 24 bits register, I would like to have 1 access of 16 bits and 1 access of 8 bits, instead of having 32bits access for 24bits register.
Another example are registers modeled like this:
*0x03 | 0x02 | 0x01 | 0x00* |
------------- ------- -------
| reg2_1 | reg1 | reg0 |
------------- ------- -------
*0x07 | 0x06 | 0x05 | 0x04 |*
------------- ------- -------
| reg3 | reg2_2 |
------------- ------- -------
size(reg0) = 8 bits on addr: 0x00
size(reg1) = 1 bits on addr: 0x01
size(reg2) = 24 bits on addr: 0x02, 0x03, 0x04
size(reg3) = 24 bits on addr: 0x05, 0x06, 0x07
I receive uvm_error when I try to write to reg2.
Is there a way using for example pre_write() callback to modify n_bits even before reaching the adapter, and to cut data item n_bits in smaller desired pieces?
Thank you in advance!
Kristina