How to read/write address 0x0, 0x2, 0x4 instead of word-alignment access?

Hi, dear elites,

I’m working on a design which the memory-mapped interface supports word and half-word length. For example, when CPU programs to the configuration memory of the module, CPU needs to write to the address with ending in 0x0,0x2,0x4,0x6,0x8,0xA, etc since it’s 16-bits register in design.

However, after checking the PYNQ doc., it doesn’t mention how to write the python code for the half-word access. Would you please guide me on how to write the python test code for the half-word access on PYNQ ?

Thanks
All the best,

A straight forward way is to use the read-modify-write process. Basically you still work on 32-bit words - you read a word address, modify only the bit / byte location you are interested, and write back the 32-bit word.

1 Like