Skip to content

Commit

Permalink
phy/efinix: Use new LiteX's ClkInput/Output abstraction to simplify c…
Browse files Browse the repository at this point in the history
…ode/avoid duplications.
  • Loading branch information
enjoy-digital committed Sep 12, 2023
1 parent 618f20b commit a6775fe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 44 deletions.
31 changes: 9 additions & 22 deletions liteeth/phy/titaniumrgmii.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from litex.gen import *

from litex.build.io import DDROutput, DDRInput
from litex.build.io import ClkInput, ClkOutput, DDROutput, DDRInput
from litex.build.generic_platform import *
from litex.soc.cores.clock import *

Expand Down Expand Up @@ -128,30 +128,17 @@ def __init__(self, platform, clock_pads, with_hw_init_reset, hw_reset_cycles=256

# RX Clk.
# -------
eth_rx_clk = platform.add_iface_io(f"auto_eth{n}_rx_clk_in")
block = {
"type" : "GPIO",
"size" : 1,
"location" : platform.get_pin_location(clock_pads.rx)[0],
"properties" : platform.get_pin_properties(clock_pads.rx),
"name" : platform.get_pin_name(eth_rx_clk),
"mode" : "INPUT_CLK"
}
platform.toolchain.ifacewriter.blocks.append(block)
platform.toolchain.excluded_ios.append(clock_pads.rx)
self.specials += ClkInput(
i = clock_pads.rx,
o = f"auto_eth{n}_rx_clk_in", # FIXME: Use Clk Signal.
)

# TX Clk.
# -------
block = {
"type" : "GPIO",
"size" : 1,
"location" : platform.get_pin_location(clock_pads.tx)[0],
"properties" : platform.get_pin_properties(clock_pads.tx),
"name" : f"auto_eth{n}_tx_clk_delayed",
"mode" : "OUTPUT_CLK"
}
platform.toolchain.ifacewriter.blocks.append(block)
platform.toolchain.excluded_ios.append(clock_pads.tx)
self.specials += ClkOutput(
i = f"auto_eth{n}_tx_clk_delayed", # FIXME: Use Clk Signal.
o = clock_pads.tx
)

# TX PLL.
# -------
Expand Down
31 changes: 9 additions & 22 deletions liteeth/phy/trionrgmii.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from litex.gen import *

from litex.build.io import DDROutput, DDRInput
from litex.build.io import ClkInput, ClkOutput, DDROutput, DDRInput
from litex.build.generic_platform import *
from litex.soc.cores.clock import *

Expand Down Expand Up @@ -128,30 +128,17 @@ def __init__(self, platform, clock_pads, with_hw_init_reset, hw_reset_cycles=256

# RX Clk.
# -------
eth_rx_clk = platform.add_iface_io(f"auto_eth{n}_rx_clk_in")
block = {
"type" : "GPIO",
"size" : 1,
"location" : platform.get_pin_location(clock_pads.rx)[0],
"properties" : platform.get_pin_properties(clock_pads.rx),
"name" : platform.get_pin_name(eth_rx_clk),
"mode" : "INPUT_CLK"
}
platform.toolchain.ifacewriter.blocks.append(block)
platform.toolchain.excluded_ios.append(clock_pads.rx)
self.specials += ClkInput(
i = clock_pads.rx,
o = f"auto_eth{n}_rx_clk_in", # FIXME: Use Clk Signal.
)

# TX Clk.
# -------
block = {
"type" : "GPIO",
"size" : 1,
"location" : platform.get_pin_location(clock_pads.tx)[0],
"properties" : platform.get_pin_properties(clock_pads.tx),
"name" : f"auto_eth{n}_tx_clk_delayed",
"mode" : "OUTPUT_CLK"
}
platform.toolchain.ifacewriter.blocks.append(block)
platform.toolchain.excluded_ios.append(clock_pads.tx)
self.specials += ClkOutput(
i = f"auto_eth{n}_tx_clk_delayed", # FIXME: Use Clk Signal.
o = clock_pads.tx
)

# TX PLL.
# -------
Expand Down

0 comments on commit a6775fe

Please sign in to comment.