Skip to content

Commit

Permalink
build/efinix/common: Add EfinixClkInput/Ouptut to use then in RGMII P…
Browse files Browse the repository at this point in the history
…HYs and avoid duplicating block code.
  • Loading branch information
enjoy-digital committed Sep 12, 2023
1 parent 412f0f5 commit bcc7e56
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions litex/build/efinix/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,49 @@ class EfinixAsyncResetSynchronizer:
def lower(dr):
return EfinixAsyncResetSynchronizerImpl(dr.cd, dr.async_reset)

# Efinix Clk Input ---------------------------------------------------------------------------------

class EfinixClkInputImpl(Module):
def __init__(self, platform, i, o):
o_clk = platform.add_iface_io(o) # FIXME.
block = {
"type" : "GPIO",
"size" : 1,
"location" : platform.get_pin_location(i)[0],
"properties" : platform.get_pin_properties(i),
"name" : platform.get_pin_name(o_clk),
"mode" : "INPUT_CLK",
}
platform.toolchain.ifacewriter.blocks.append(block)
platform.toolchain.excluded_ios.append(i)


class EfinixClkInput(Module):
@staticmethod
def lower(dr):
return EfinixClkInputImpl(dr.platform, dr.i, dr.o)

# Efinix Clk Output ---------------------------------------------------------------------------------

class EfinixClkOutputImpl(Module):
def __init__(self, platform, i, o):
block = {
"type" : "GPIO",
"size" : 1,
"location" : platform.get_pin_location(o)[0],
"properties" : platform.get_pin_properties(o),
"name" : i, # FIXME.
"mode" : "OUTPUT_CLK",
}
platform.toolchain.ifacewriter.blocks.append(block)
platform.toolchain.excluded_ios.append(o)


class EfinixClkOutput(Module):
@staticmethod
def lower(dr):
return EfinixClkOutputImpl(dr.platform, dr.i, dr.o)

# Efinix Tristate ----------------------------------------------------------------------------------

class EfinixTristateImpl(Module):
Expand Down Expand Up @@ -179,6 +222,8 @@ def lower(dr):

efinix_special_overrides = {
AsyncResetSynchronizer : EfinixAsyncResetSynchronizer,
ClkInput : EfinixClkInput,
ClkOutput : EfinixClkOutput,
Tristate : EfinixTristate,
SDRTristate : EfinixSDRTristate,
DDROutput : EfinixDDROutput,
Expand Down

0 comments on commit bcc7e56

Please sign in to comment.