Merge pull request #1877 from trabucayre/ethernet_local_remote_ip

soc/integration/soc: add_etherbone: allowing to specify local/remote IP
This commit is contained in:
enjoy-digital 2024-01-24 15:15:31 +01:00 committed by GitHub
commit 115e87ff4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 1 deletions

View File

@ -1726,7 +1726,9 @@ class LiteXSoC(SoC):
nrxslots = 2, rxslots_read_only = True, nrxslots = 2, rxslots_read_only = True,
ntxslots = 2, txslots_write_only = False, ntxslots = 2, txslots_write_only = False,
with_timestamp = False, with_timestamp = False,
with_timing_constraints = True): with_timing_constraints = True,
local_ip = None,
remote_ip = None):
# Imports # Imports
from liteeth.mac import LiteEthMAC from liteeth.mac import LiteEthMAC
from liteeth.phy.model import LiteEthPHYModel from liteeth.phy.model import LiteEthPHYModel
@ -1764,8 +1766,23 @@ class LiteXSoC(SoC):
# Dynamic IP (if enabled). # Dynamic IP (if enabled).
if dynamic_ip: if dynamic_ip:
assert local_ip is None
self.add_constant("ETH_DYNAMIC_IP") 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 # Software Debug
if software_debug: if software_debug:
self.add_constant("ETH_UDP_TX_DEBUG") self.add_constant("ETH_UDP_TX_DEBUG")