Convert hello_interp.c:times_table to µPython

Not useful for efficient calculation of times-tables (it is not) but a nice
way to show accessing hardware registers in the rp2040 from µPython
pull/58/head
Graeme Winter 2023-01-06 14:01:06 +00:00
rodzic c82971b6e0
commit 642c203698
1 zmienionych plików z 12 dodań i 0 usunięć

12
interp/interp.py 100644
Wyświetl plik

@ -0,0 +1,12 @@
from machine import mem32
# initialise lane 0 on interp: set that we are using all 32 bits
mem32[0xD0000000 | 0xAC] = 0x1F << 10
# set up 9 x table example - write to accum[0] and base[0] registers
mem32[0xD0000000 | 0x80] = 0
mem32[0xD0000000 | 0x88] = 9
# read pop register 10 times
for j in range(10):
print(mem32[0xD0000000 | 0x94])