soc/add_ethernet: soc/add_etherbone: Add data_width parameter and allow 8-bit/32-bit core data_width.

This commit is contained in:
Florent Kermarrec 2022-04-25 18:44:52 +02:00
parent bdbb6c0b3f
commit 63cda6c7b9

View file

@ -1520,6 +1520,7 @@ class LiteXSoC(SoC):
# Add Ethernet --------------------------------------------------------------------------------- # Add Ethernet ---------------------------------------------------------------------------------
def add_ethernet(self, name="ethmac", phy=None, phy_cd="eth", dynamic_ip=False, software_debug=False, def add_ethernet(self, name="ethmac", phy=None, phy_cd="eth", dynamic_ip=False, software_debug=False,
data_width = 8,
nrxslots = 2, nrxslots = 2,
ntxslots = 2, ntxslots = 2,
with_timestamp = False, with_timestamp = False,
@ -1529,6 +1530,8 @@ class LiteXSoC(SoC):
from liteeth.phy.model import LiteEthPHYModel from liteeth.phy.model import LiteEthPHYModel
# MAC. # MAC.
assert data_width in [8, 32]
with_sys_datapath = (data_width == 32)
self.check_if_exists(name) self.check_if_exists(name)
if with_timestamp: if with_timestamp:
self.timer0.add_uptime() self.timer0.add_uptime()
@ -1540,7 +1543,9 @@ class LiteXSoC(SoC):
nrxslots = nrxslots, nrxslots = nrxslots,
ntxslots = ntxslots, ntxslots = ntxslots,
timestamp = None if not with_timestamp else self.timer0.uptime_cycles, timestamp = None if not with_timestamp else self.timer0.uptime_cycles,
with_preamble_crc = not software_debug) with_preamble_crc = not software_debug,
with_sys_datapath = with_sys_datapath)
if not with_sys_datapath:
# Use PHY's eth_tx/eth_rx clock domains. # Use PHY's eth_tx/eth_rx clock domains.
ethmac = ClockDomainsRenamer({ ethmac = ClockDomainsRenamer({
"eth_tx": phy_cd + "_tx", "eth_tx": phy_cd + "_tx",