Description
Currently the machine module offers mem8, mem16 and mem32 objects for accessing memory of those widths, but it does not provide a mem64 even on machines whose native memory size is 64 bit.
With the increasing availability and use of controller chips such as the PIC64, the (misleadingly named) STM32MP2, and TI C29 series, 64 bit memory is now first class on some "micro"-controllers. The MicroPython struct and uctypes libraries already support 64 bit operations (q and Q types). In the event that the device has 64-bit wide IO registers (for example fast, high-resolution counters) being able to read all 64 bits in one operations is valuable. Zephyr has 64-bit targets and the MicroPython unix port also runs on many platforms with natively 64-bit wide memory.
For all these reasons I suggest that we add mem64 support into machine.
I propose that this is gated on a new configuration macro MICROPY_PY_MACHINE_MEM64 and that this defaults to on for machines that have 64 bit pointer types and long int support, and defaults off elsewhere.
Code Size
The implementation looks to be about 50 lines of C and it will likely add a couple of hundred bytes of code and static class definition. Since this would be off by default for machines without 64-bit memory busses this will have no impact on historically memory-constrained machines.
Implementation
I intend to implement this feature and would submit a Pull Request if desirable
Code of Conduct
Yes, I agree
Description
Currently the
machinemodule offersmem8,mem16andmem32objects for accessing memory of those widths, but it does not provide amem64even on machines whose native memory size is 64 bit.With the increasing availability and use of controller chips such as the PIC64, the (misleadingly named) STM32MP2, and TI C29 series, 64 bit memory is now first class on some "micro"-controllers. The MicroPython
structanductypeslibraries already support 64 bit operations (qandQtypes). In the event that the device has 64-bit wide IO registers (for example fast, high-resolution counters) being able to read all 64 bits in one operations is valuable. Zephyr has 64-bit targets and the MicroPythonunixport also runs on many platforms with natively 64-bit wide memory.For all these reasons I suggest that we add
mem64support intomachine.I propose that this is gated on a new configuration macro
MICROPY_PY_MACHINE_MEM64and that this defaults to on for machines that have 64 bit pointer types and long int support, and defaults off elsewhere.Code Size
The implementation looks to be about 50 lines of C and it will likely add a couple of hundred bytes of code and static class definition. Since this would be off by default for machines without 64-bit memory busses this will have no impact on historically memory-constrained machines.
Implementation
I intend to implement this feature and would submit a Pull Request if desirable
Code of Conduct
Yes, I agree