From d2eb870445fa372ea49cfe7897189a2a76e734e6 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 7 Nov 2019 13:23:10 +0100 Subject: [PATCH] core: allow passing ip_address as str --- liteeth/core/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/liteeth/core/__init__.py b/liteeth/core/__init__.py index 5c1509f..722dc43 100644 --- a/liteeth/core/__init__.py +++ b/liteeth/core/__init__.py @@ -7,6 +7,8 @@ from liteeth.core.icmp import LiteEthICMP class LiteEthIPCore(Module, AutoCSR): def __init__(self, phy, mac_address, ip_address, clk_freq, with_icmp=True): + if isinstance(ip_address, str): + ip_address = convert_ip(ip_address) self.submodules.mac = LiteEthMAC(phy, 8, interface="crossbar", with_preamble_crc=True) self.submodules.arp = LiteEthARP(self.mac, mac_address, ip_address, clk_freq) self.submodules.ip = LiteEthIP(self.mac, mac_address, ip_address, self.arp.table) @@ -16,5 +18,7 @@ class LiteEthIPCore(Module, AutoCSR): class LiteEthUDPIPCore(LiteEthIPCore): def __init__(self, phy, mac_address, ip_address, clk_freq, with_icmp=True): + if isinstance(ip_address, str): + ip_address = convert_ip(ip_address) LiteEthIPCore.__init__(self, phy, mac_address, ip_address, clk_freq, with_icmp) self.submodules.udp = LiteEthUDP(self.ip, ip_address)