manta/examples/nexys_a7/block_mem_uart/api_example.py

19 lines
441 B
Python

from manta import Manta
from time import sleep
from random import randint
m = Manta('manta.yaml')
for addr in range(1024):
number = randint(0,65535)
m.my_block_memory.write(addr, number)
readback = m.my_block_memory.read(addr)
if readback == number:
print(f"Success! Wrote and read back {number} from {addr}")
else:
print(f"Failure! Wrote {number} to {addr}, but received {readback}")
exit()