liteeth_gen: Add specific A7_1000BASEX support and example configuration.

Adapted from known working targets but untested on hardware.
This commit is contained in:
Florent Kermarrec 2024-01-18 13:27:32 +01:00
parent 1ea28bd93a
commit c05de191e2
2 changed files with 56 additions and 9 deletions

View File

@ -0,0 +1,26 @@
#
# This file is part of LiteEth.
#
# Copyright (c) 2020-2024 Florent Kermarrec <florent@enjoy-digital.fr>
# SPDX-License-Identifier: BSD-2-Clause
# PHY ----------------------------------------------------------------------
phy : A7_1000BASEX
vendor : xilinx
toolchain : vivado
# Core ---------------------------------------------------------------------
refclk_freq : 200e6
clk_freq : 25e6
core : udp
data_width : 32
dhcp : True
# UDP Ports --------------------------------------------------------------------
udp_ports: {
"udp0": {
"data_width" : 32,
"tx_fifo_depth" : 1024,
"rx_fifo_depth" : 1024,
},
}

View File

@ -284,15 +284,36 @@ class PHYCore(SoCMini):
liteeth_phys.USP_GTY_1000BASEX, liteeth_phys.USP_GTY_1000BASEX,
]: ]:
ethphy_pads = platform.request("sgmii") ethphy_pads = platform.request("sgmii")
ethphy = phy( # Artix7.
refclk_or_clk_pads = ethphy_pads.refclk, if phy in [liteeth_phys.A7_1000BASEX]:
data_pads = ethphy_pads, assert core_config.get("refclk_freq", 0) == 200e6
sys_clk_freq = self.clk_freq, from liteeth.phy.a7_gtp import QPLLSettings, QPLL
refclk_freq = core_config.get("refclk_freq", 200e6), qpll_settings = QPLLSettings(
with_csr = False, refclksel = 0b001,
rx_polarity = 0, # Add support to liteeth_gen if useful. fbdiv = 4,
tx_polarity = 0, # Add support to liteeth_gen if useful. fbdiv_45 = 5,
) refclk_div = 1
)
qpll = QPLL(ethphy_pads.refclk, qpll_settings)
ethphy = phy(
qpll_channel = qpll.channels[0],
data_pads = ethphy_pads,
sys_clk_freq = self.clk_freq,
with_csr = False,
rx_polarity = 0, # Add support to liteeth_gen if useful.
tx_polarity = 0, # Add support to liteeth_gen if useful.
)
# Other 7-Series/Ultrascale(+).
else:
ethphy = phy(
refclk_or_clk_pads = ethphy_pads.refclk,
data_pads = ethphy_pads,
sys_clk_freq = self.clk_freq,
refclk_freq = core_config.get("refclk_freq", 200e6),
with_csr = False,
rx_polarity = 0, # Add support to liteeth_gen if useful.
tx_polarity = 0, # Add support to liteeth_gen if useful.
)
self.comb += [ self.comb += [
ethphy.reset.eq(ethphy_pads.rst), ethphy.reset.eq(ethphy_pads.rst),
ethphy_pads.link_up.eq(ethphy.link_up), ethphy_pads.link_up.eq(ethphy.link_up),