Skip to content

Commit

Permalink
liteeth_gen: Add refclk_freq parameter for SGMII/1000BaseX.
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-digital committed Jun 23, 2023
1 parent eab6b46 commit 65ef193
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
13 changes: 7 additions & 6 deletions examples/udp_usp_gth_sgmii.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
# SPDX-License-Identifier: BSD-2-Clause

# PHY ----------------------------------------------------------------------
phy: USP_GTH_1000BASEX
vendor: xilinx
toolchain: vivado
phy : USP_GTH_1000BASEX
vendor : xilinx
toolchain : vivado

# Core ---------------------------------------------------------------------
clk_freq: 125e6
core: udp
data_width: 32
refclk_freq : 156.25e6
clk_freq : 25e6
core : udp
data_width : 32

# UDP Ports --------------------------------------------------------------------
udp_ports: {
Expand Down
7 changes: 4 additions & 3 deletions liteeth/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@

# SGMII PHY Pads
("sgmii", 0,
Subsignal("refclk200", Pins(1)),
Subsignal("refclk", Pins(1)),
Subsignal("txp", Pins(1)),
Subsignal("txn", Pins(1)),
Subsignal("rxp", Pins(1)),
Expand Down Expand Up @@ -241,9 +241,10 @@ def __init__(self, platform, core_config):
]:
ethphy_pads = platform.request("sgmii")
ethphy = phy(
refclk_or_clk_pads = ethphy_pads.refclk200,
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.
Expand Down Expand Up @@ -438,7 +439,7 @@ def main():
core_config[k] = replaces[r]
if k == "phy":
core_config[k] = getattr(liteeth_phys, core_config[k])
if k in ["clk_freq"]:
if k in ["refclk_freq", "clk_freq"]:
core_config[k] = int(float(core_config[k]))
if k in ["phy_tx_delay", "phy_rx_delay"]:
core_config[k] = float(core_config[k])
Expand Down

0 comments on commit 65ef193

Please sign in to comment.