Memory Bundle
Memory bundles can be used to speed up consecutive read/write accesses, for example when reading/writing multiple memory-mapped registers. The speedup depends on the size of the individual memory accesses. Larger block accesses will result in no speedup compared to the normal read/write accesses.
Create Memory Bundle
First a bundle needs to be created and read, write and/or read-write operation added to it:
>>> bundle = pyrcl.MemoryAccessBundle()
>>> bundle.add_write(addr, data)
>>> bundle.add_read(addr, length=length)
>>> bundle.add_readwrite(addr, data, mask)
Read-write operations will first read the value, and then write value = (read_value & ~mask) | (write_value & mask)
Execute Memory Bundle
Memory bundles can be executed using dbg.memory.execute_bundle(bundle).
>>> try:
>>> results = dbg.memory.execute_bundle(bundle)
>>> except pyrcl.MemoryAccessError as e:
>>> print(f"{type(e).__name__}: {e}")
A list of pyrcl.MemoryAccessResult for each access added to the bundle is returned.
>>> for i, result in enumerate(results):
>>> print(i, type(result), result.error, result.data)
Each result must checked for result.error, the data can be accessed by result.data.