Skip to content

Commit

Permalink
build: efinix: EfinixClkOutput: allow inverting
Browse files Browse the repository at this point in the history
allow inverting of EfinixClkOutput.

Signed-off-by: Fin Maaß <[email protected]>
  • Loading branch information
maass-hamburg committed Sep 30, 2024
1 parent 09893fe commit 0d0bfeb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions litex/build/efinix/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def lower(dr):
# Efinix Clk Output --------------------------------------------------------------------------------

class EfinixClkOutputImpl(LiteXModule):
def __init__(self, i, o):
def __init__(self, i, o, out_clk_inv=False):
assert_is_signal_or_clocksignal(i)
platform = LiteXContext.platform
block = {
Expand All @@ -119,14 +119,15 @@ def __init__(self, i, o):
"properties" : platform.get_pin_properties(o),
"name" : i,
"mode" : "OUTPUT_CLK",
"out_clk_inv": 1 if out_clk_inv else 0,
}
platform.toolchain.ifacewriter.blocks.append(block)
platform.toolchain.excluded_ios.append(o)

class EfinixClkOutput(LiteXModule):
@staticmethod
def lower(dr):
return EfinixClkOutputImpl(dr.i, dr.o)
return EfinixClkOutputImpl(dr.i, dr.o, **dr.kwargs)

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

Expand Down
2 changes: 2 additions & 0 deletions litex/build/efinix/ifacewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ def generate_gpio(self, block, verbose=True):
cmd += 'design.create_clockout_gpio("{}")\n'.format(name)
cmd += 'design.set_property("{}","OUT_CLK_PIN","{}")\n'.format(name, name)
cmd += 'design.assign_pkg_pin("{}","{}")\n\n'.format(name, block["location"])
if "out_clk_inv" in block:
cmd += f'design.set_property("{name}","IS_OUTCLK_INVERTED","{block["out_clk_inv"]}")\n'
if prop:
for p, val in prop:
cmd += 'design.set_property("{}","{}","{}")\n'.format(name, p, val)
Expand Down

0 comments on commit 0d0bfeb

Please sign in to comment.