From 8cf98831437b358a0633083e024748daa3399968 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 5 Feb 2015 13:31:06 +0100 Subject: [PATCH] add convert_ip function --- liteeth/common.py | 7 +++++++ targets/udpip.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/liteeth/common.py b/liteeth/common.py index 3507764e..b95c5a0b 100644 --- a/liteeth/common.py +++ b/liteeth/common.py @@ -142,6 +142,13 @@ def eth_ipv4_user_description(dw): ] 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): layout = _layout_from_header(udp_header) + [ ("data", dw), diff --git a/targets/udpip.py b/targets/udpip.py index e584c90f..a9c59e10 100644 --- a/targets/udpip.py +++ b/targets/udpip.py @@ -175,7 +175,7 @@ class UDPIPSoC(GenSoC, AutoCSR): # Ethernet PHY and UDP/IP 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 self.submodules.bist_generator = UDPIPBISTGenerator() -- 2.30.2