add convert_ip function

This commit is contained in:
Florent Kermarrec 2015-02-05 13:31:06 +01:00
parent dbca377551
commit 8cf9883143
2 changed files with 8 additions and 1 deletions

View File

@ -142,6 +142,13 @@ def eth_ipv4_user_description(dw):
] ]
return EndpointDescription(layout, packetized=True) return EndpointDescription(layout, packetized=True)
def convert_ip(s):
ip = 0
for e in s.split("."):
ip = ip << 8
ip += int(e)
return ip
def eth_udp_description(dw): def eth_udp_description(dw):
layout = _layout_from_header(udp_header) + [ layout = _layout_from_header(udp_header) + [
("data", dw), ("data", dw),

View File

@ -175,7 +175,7 @@ class UDPIPSoC(GenSoC, AutoCSR):
# Ethernet PHY and UDP/IP # Ethernet PHY and UDP/IP
self.submodules.ethphy = LiteEthPHYGMII(platform.request("eth_clocks"), platform.request("eth")) self.submodules.ethphy = LiteEthPHYGMII(platform.request("eth_clocks"), platform.request("eth"))
self.submodules.udpip_core = LiteEthUDPIPCore(self.ethphy, 0x12345678, 0x10e2d5000000) self.submodules.udpip_core = LiteEthUDPIPCore(self.ethphy, convert_ip("192.168.1.40"), 0x10e2d5000000)
# BIST # BIST
self.submodules.bist_generator = UDPIPBISTGenerator() self.submodules.bist_generator = UDPIPBISTGenerator()