2015-09-07 07:28:02 -04:00
|
|
|
import socket
|
|
|
|
import time
|
2015-11-16 18:16:39 -05:00
|
|
|
from litex.soc.tools.remote.etherbone import *
|
2015-09-07 07:28:02 -04:00
|
|
|
|
|
|
|
SRAM_BASE = 0x02000000
|
|
|
|
|
2015-11-16 18:16:39 -05:00
|
|
|
socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
|
|
|
|
|
|
# test probe
|
|
|
|
packet = EtherbonePacket()
|
|
|
|
packet.pf = 1
|
|
|
|
packet.encode()
|
2016-03-15 10:40:06 -04:00
|
|
|
socket.sendto(bytes(packet), ("192.168.1.50", 20000))
|
2015-11-16 18:16:39 -05:00
|
|
|
time.sleep(0.01)
|
|
|
|
|
|
|
|
# test writes
|
|
|
|
writes_datas = [j for j in range(16)]
|
|
|
|
writes = EtherboneWrites(base_addr=SRAM_BASE, datas=writes_datas)
|
|
|
|
record = EtherboneRecord()
|
|
|
|
record.writes = writes
|
|
|
|
record.wcount = len(writes_datas)
|
|
|
|
|
|
|
|
packet = EtherbonePacket()
|
|
|
|
packet.records = [record]
|
|
|
|
packet.encode()
|
2016-03-15 10:40:06 -04:00
|
|
|
socket.sendto(bytes(packet), ("192.168.1.50", 20000))
|
2015-11-16 18:16:39 -05:00
|
|
|
time.sleep(0.01)
|
|
|
|
|
|
|
|
# test reads
|
|
|
|
reads_addrs = [SRAM_BASE+4*j for j in range(16)]
|
|
|
|
reads = EtherboneReads(base_ret_addr=0x1000, addrs=reads_addrs)
|
|
|
|
record = EtherboneRecord()
|
|
|
|
record.reads = reads
|
|
|
|
record.rcount = len(reads_addrs)
|
|
|
|
|
|
|
|
packet = EtherbonePacket()
|
|
|
|
packet.records = [record]
|
|
|
|
packet.encode()
|
2016-03-15 10:40:06 -04:00
|
|
|
socket.sendto(bytes(packet), ("192.168.1.50", 20000))
|
2015-11-16 18:16:39 -05:00
|
|
|
time.sleep(0.01)
|