integration/soc/add_ethernet/etherbone: Add with_timing_constraints parameter to allow disabling constraints.

Some boards require specific constraints, so disable them in this case and put constraints in the target file.
This commit is contained in:
Florent Kermarrec 2021-09-13 19:32:50 +02:00
parent cb7b0f44cf
commit 694878a35a
1 changed files with 25 additions and 21 deletions

View File

@ -1399,7 +1399,8 @@ class LiteXSoC(SoC):
def add_ethernet(self, name="ethmac", phy=None, phy_cd="eth", dynamic_ip=False, software_debug=False,
nrxslots = 2,
ntxslots = 2,
with_timestamp = False):
with_timestamp = False,
with_timing_constraints = True):
# Imports
from liteeth.mac import LiteEthMAC
from liteeth.phy.model import LiteEthPHYModel
@ -1430,14 +1431,6 @@ class LiteXSoC(SoC):
if self.irq.enabled:
self.irq.add(name, use_loc_if_exists=True)
# Timing constraints
eth_rx_clk = getattr(phy, "crg", phy).cd_eth_rx.clk
eth_tx_clk = getattr(phy, "crg", phy).cd_eth_tx.clk
if not isinstance(phy, LiteEthPHYModel):
self.platform.add_period_constraint(eth_rx_clk, 1e9/phy.rx_clk_freq)
self.platform.add_period_constraint(eth_tx_clk, 1e9/phy.tx_clk_freq)
self.platform.add_false_path_constraints(self.crg.cd_sys.clk, eth_rx_clk, eth_tx_clk)
# Dynamic IP (if enabled).
if dynamic_ip:
self.add_constant("ETH_DYNAMIC_IP")
@ -1447,12 +1440,22 @@ class LiteXSoC(SoC):
self.add_constant("ETH_UDP_TX_DEBUG")
self.add_constant("ETH_UDP_RX_DEBUG")
# Timing constraints
if with_timing_constraints:
eth_rx_clk = getattr(phy, "crg", phy).cd_eth_rx.clk
eth_tx_clk = getattr(phy, "crg", phy).cd_eth_tx.clk
if not isinstance(phy, LiteEthPHYModel):
self.platform.add_period_constraint(eth_rx_clk, 1e9/phy.rx_clk_freq)
self.platform.add_period_constraint(eth_tx_clk, 1e9/phy.tx_clk_freq)
self.platform.add_false_path_constraints(self.crg.cd_sys.clk, eth_rx_clk, eth_tx_clk)
# Add Etherbone --------------------------------------------------------------------------------
def add_etherbone(self, name="etherbone", phy=None, phy_cd="eth",
mac_address = 0x10e2d5000000,
ip_address = "192.168.1.50",
udp_port = 1234,
buffer_depth = 4):
buffer_depth = 4,
with_timing_constraints = True):
# Imports
from liteeth.core import LiteEthUDPIPCore
from liteeth.frontend.etherbone import LiteEthEtherbone
@ -1483,6 +1486,7 @@ class LiteXSoC(SoC):
self.add_wb_master(etherbone.wishbone.bus)
# Timing constraints
if with_timing_constraints:
eth_rx_clk = getattr(phy, "crg", phy).cd_eth_rx.clk
eth_tx_clk = getattr(phy, "crg", phy).cd_eth_tx.clk
if not isinstance(phy, LiteEthPHYModel):