add convert_ip function
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Thu, 5 Feb 2015 12:31:06 +0000 (13:31 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Thu, 5 Feb 2015 12:31:06 +0000 (13:31 +0100)
liteeth/common.py
targets/udpip.py

index 3507764e9e93a0a0e23d7a7c756cae2bfe86fa44..b95c5a0b6e9026f2af12ec59f6210dd752f7fbcb 100644 (file)
@@ -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),
index e584c90fce3adac768bca0e1f1b5b672b3edccb8..a9c59e102f29672404c5cfe30c3faf5e29d64e72 100644 (file)
@@ -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()