litex/test/test_udpip.py

45 lines
855 B
Python
Raw Normal View History

from config import *
import time
2015-02-05 12:59:58 -05:00
def convert_ip(s):
ip = 0
for e in s.split("."):
ip = ip << 8
ip += int(e)
return ip
2015-02-05 05:58:40 -05:00
from litescope.host.driver import LiteScopeLADriver
la = LiteScopeLADriver(wb.regs, "la", debug=True)
wb.open()
regs = wb.regs
###
2015-02-05 12:59:58 -05:00
#regs.ethphy_crg_reset.write(1)
#regs.ethphy_crg_reset.write(0)
#time.sleep(5)
regs.bist_generator_src_port.write(0x1234)
regs.bist_generator_dst_port.write(0x5678)
2015-02-05 12:59:58 -05:00
regs.bist_generator_ip_address.write(convert_ip("192.168.1.10"))
regs.bist_generator_length.write(64)
2015-02-05 05:58:40 -05:00
conditions = {}
conditions = {
"udpipsocdevel_mac_tx_cdc_sink_stb" : 1
2015-02-05 05:58:40 -05:00
}
la.configure_term(port=0, cond=conditions)
la.configure_sum("term")
# Run Logic Analyzer
la.run(offset=64, length=1024)
for i in range(64):
regs.bist_generator_start.write(1)
2015-02-05 05:58:40 -05:00
while not la.done():
pass
la.upload()
la.save("dump.vcd")
###
wb.close()