From bcde71b051b7c13289e85f01c69dd54a6dc77df5 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Wed, 24 Jan 2024 14:59:45 +0100 Subject: [PATCH] soc/integration/soc: add_etherbone: allowing to specify local/remote IP --- litex/soc/integration/soc.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/litex/soc/integration/soc.py b/litex/soc/integration/soc.py index dbce3a988..f637f6c6f 100644 --- a/litex/soc/integration/soc.py +++ b/litex/soc/integration/soc.py @@ -1726,7 +1726,9 @@ class LiteXSoC(SoC): nrxslots = 2, rxslots_read_only = True, ntxslots = 2, txslots_write_only = False, with_timestamp = False, - with_timing_constraints = True): + with_timing_constraints = True, + local_ip = None, + remote_ip = None): # Imports from liteeth.mac import LiteEthMAC from liteeth.phy.model import LiteEthPHYModel @@ -1764,8 +1766,23 @@ class LiteXSoC(SoC): # Dynamic IP (if enabled). if dynamic_ip: + assert local_ip is None self.add_constant("ETH_DYNAMIC_IP") + if local_ip: + local_ip = local_ip.split(".") + self.add_constant("LOCALIP1", int(local_ip[0])) + self.add_constant("LOCALIP2", int(local_ip[1])) + self.add_constant("LOCALIP3", int(local_ip[2])) + self.add_constant("LOCALIP4", int(local_ip[3])) + + if remote_ip: + remote_ip = remote_ip.split(".") + self.add_constant("REMOTEIP1", int(remote_ip[0])) + self.add_constant("REMOTEIP2", int(remote_ip[1])) + self.add_constant("REMOTEIP3", int(remote_ip[2])) + self.add_constant("REMOTEIP4", int(remote_ip[3])) + # Software Debug if software_debug: self.add_constant("ETH_UDP_TX_DEBUG")