Skip to content

Commit

Permalink
Merge pull request #168 from trabucayre/efinix_rework_primitives
Browse files Browse the repository at this point in the history
Efinix rework primitives
  • Loading branch information
trabucayre authored Sep 10, 2024
2 parents ea07f5c + 9496fd2 commit 74bd085
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
23 changes: 12 additions & 11 deletions liteeth/phy/titaniumrgmii.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, platform, pads, n=0):
i1 = tx_data_h[i],
i2 = tx_data_l[i],
o = pads.tx_data[i],
clk = f"auto_eth{n}_tx_clk", # FIXME: Use Clk Signal.
clk = ClockSignal("eth_tx"),
)

# TX Ctl IOs.
Expand All @@ -47,7 +47,7 @@ def __init__(self, platform, pads, n=0):
i1 = tx_ctl_h,
i2 = tx_ctl_l,
o = pads.tx_ctl,
clk = f"auto_eth{n}_tx_clk", # FIXME: Use Clk Signal.
clk = ClockSignal("eth_tx"),
)

# Logic.
Expand Down Expand Up @@ -80,7 +80,7 @@ def __init__(self, platform, pads, n=0):
i = pads.rx_data[i],
o1 = rx_data_h[i],
o2 = rx_data_l[i],
clk = f"auto_eth{n}_rx_clk", # FIXME: Use Clk Signal.
clk = ClockSignal("eth_rx"),
)

# RX Ctl IOs.
Expand All @@ -91,7 +91,7 @@ def __init__(self, platform, pads, n=0):
i = pads.rx_ctl,
o1 = rx_ctl_h,
o2 = rx_ctl_l,
clk = f"auto_eth{n}_rx_clk", # FIXME: Use Clk Signal.
clk = ClockSignal("eth_rx"),
)

rx_ctl = rx_ctl_h
Expand Down Expand Up @@ -123,8 +123,9 @@ def __init__(self, platform, clock_pads, with_hw_init_reset, hw_reset_cycles=256

# Clk Domains.
# ------------
self.cd_eth_rx = ClockDomain()
self.cd_eth_tx = ClockDomain()
self.cd_eth_rx = ClockDomain()
self.cd_eth_tx = ClockDomain()
self.cd_eth_tx_delayed = ClockDomain(reset_less=True)

# RX Clk.
# -------
Expand All @@ -136,17 +137,17 @@ def __init__(self, platform, clock_pads, with_hw_init_reset, hw_reset_cycles=256
# TX Clk.
# -------
self.specials += ClkOutput(
i = f"auto_eth{n}_tx_clk_delayed", # FIXME: Use Clk Signal.
i = ClockSignal("eth_tx_delayed"),
o = clock_pads.tx
)

# TX PLL.
# -------
self.pll = pll = TITANIUMPLL(platform)
pll.register_clkin(None, freq=125e6, name=f"auto_eth{n}_rx_clk_in0") # FIXME: 0 is to match ClkInput
pll.create_clkout(self.cd_eth_rx, freq=125e6, phase=0, name=f"auto_eth{n}_rx_clk", with_reset=False)
pll.create_clkout(self.cd_eth_tx, freq=125e6, phase=0, name=f"auto_eth{n}_tx_clk", with_reset=False)
pll.create_clkout(None, freq=125e6, phase=90, name=f"auto_eth{n}_tx_clk_delayed")
pll.register_clkin(None, freq=125e6, name=f"auto_eth{n}_rx_clk_in0") # FIXME: 0 is to match ClkInput
pll.create_clkout(self.cd_eth_rx, freq=125e6, phase=0, with_reset=False)
pll.create_clkout(self.cd_eth_tx, freq=125e6, phase=0, with_reset=False)
pll.create_clkout(self.cd_eth_tx_delayed, freq=125e6, phase=90)

# Reset.
# ------
Expand Down
23 changes: 12 additions & 11 deletions liteeth/phy/trionrgmii.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, platform, pads, n=0):
i1 = tx_data_h[i],
i2 = tx_data_l[i],
o = pads.tx_data[i],
clk = f"auto_eth{n}_tx_clk", # FIXME: Use Clk Signal.
clk = ClockSignal("eth_tx")
)

# TX Ctl IOs.
Expand All @@ -47,7 +47,7 @@ def __init__(self, platform, pads, n=0):
i1 = tx_ctl_h,
i2 = tx_ctl_l,
o = pads.tx_ctl,
clk = f"auto_eth{n}_tx_clk", # FIXME: Use Clk Signal.
clk = ClockSignal("eth_tx")
)

# Logic.
Expand Down Expand Up @@ -80,7 +80,7 @@ def __init__(self, platform, pads, n=0):
i = pads.rx_data[i],
o1 = rx_data_h[i],
o2 = rx_data_l[i],
clk = f"auto_eth{n}_rx_clk", # FIXME: Use Clk Signal.
clk = ClockSignal("eth_rx")
)

# RX Ctl IOs.
Expand All @@ -91,7 +91,7 @@ def __init__(self, platform, pads, n=0):
i = pads.rx_ctl,
o1 = rx_ctl_h,
o2 = rx_ctl_l,
clk = f"auto_eth{n}_rx_clk", # FIXME: Use Clk Signal.
clk = ClockSignal("eth_rx")
)

rx_ctl = rx_ctl_h
Expand Down Expand Up @@ -123,8 +123,9 @@ def __init__(self, platform, clock_pads, with_hw_init_reset, hw_reset_cycles=256

# Clk Domains.
# ------------
self.cd_eth_rx = ClockDomain()
self.cd_eth_tx = ClockDomain()
self.cd_eth_rx = ClockDomain()
self.cd_eth_tx = ClockDomain()
self.cd_eth_tx_delayed = ClockDomain(reset_less=True)

# RX Clk.
# -------
Expand All @@ -136,17 +137,17 @@ def __init__(self, platform, clock_pads, with_hw_init_reset, hw_reset_cycles=256
# TX Clk.
# -------
self.specials += ClkOutput(
i = f"auto_eth{n}_tx_clk_delayed", # FIXME: Use Clk Signal.
i = ClockSignal("eth_tx_delayed"),
o = clock_pads.tx
)

# TX PLL.
# -------
self.pll = pll = TRIONPLL(platform)
pll.register_clkin(None, freq=125e6, name=f"auto_eth{n}_rx_clk_in0") # FIXME: 0 is to match ClkInput
pll.create_clkout(self.cd_eth_rx, freq=125e6, phase=0, name=f"auto_eth{n}_rx_clk", with_reset=False, is_feedback=True)
pll.create_clkout(self.cd_eth_tx, freq=125e6, phase=0, name=f"auto_eth{n}_tx_clk", with_reset=False)
pll.create_clkout(None, freq=125e6, phase=45, name=f"auto_eth{n}_tx_clk_delayed")
pll.register_clkin(None, freq=125e6, name=f"auto_eth{n}_rx_clk_in0") # FIXME: 0 is to match ClkInput
pll.create_clkout(self.cd_eth_rx, freq=125e6, phase=0, with_reset=False, is_feedback=True)
pll.create_clkout(self.cd_eth_tx, freq=125e6, phase=0, with_reset=False)
pll.create_clkout(self.cd_eth_tx_delayed, freq=125e6, phase=45)

# Reset.
# ------
Expand Down

0 comments on commit 74bd085

Please sign in to comment.