Skip to content

Commit

Permalink
soc/integration/soc: add_etherbone: allowing to specify local/remote IP
Browse files Browse the repository at this point in the history
  • Loading branch information
trabucayre committed Jan 24, 2024
1 parent 1be3f02 commit 8b9ff2b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion litex/soc/integration/soc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1726,7 +1726,9 @@ def add_ethernet(self, name="ethmac", phy=None, phy_cd="eth", dynamic_ip=False,
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
Expand Down Expand Up @@ -1764,8 +1766,23 @@ def add_ethernet(self, name="ethmac", phy=None, phy_cd="eth", dynamic_ip=False,

# Dynamic IP (if enabled).
if dynamic_ip:
assert local_ip is None
self.add_constant("ETH_DYNAMIC_IP")

if local_ip is not None:
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")
Expand Down

0 comments on commit 8b9ff2b

Please sign in to comment.