Skip to content

Commit

Permalink
build/efinix/common: Directly pass ClockSignal/Signal to blocks and l…
Browse files Browse the repository at this point in the history
…et the build resolve names.
  • Loading branch information
enjoy-digital committed Sep 26, 2024
1 parent fde9d2e commit a3a55fc
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions litex/build/efinix/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@
r"\g<0>" + colorama.Style.RESET_ALL),
]

# Helpers ------------------------------------------------------------------------------------------

def _to_signal(obj):
if isinstance(obj, str):
return ClockSignal(obj)
elif isinstance(obj, Signal):
return obj
else:
raise ValueError

# Efinix AsyncResetSynchronizer --------------------------------------------------------------------

class EfinixAsyncResetSynchronizerImpl(Module):
Expand Down Expand Up @@ -109,7 +119,7 @@ def __init__(self, platform, i, o):
"size" : 1,
"location" : platform.get_pin_location(o)[0],
"properties" : platform.get_pin_properties(o),
"name" : i.name_override, # FIXME
"name" : _to_signal(i),
"mode" : "OUTPUT_CLK",
}
platform.toolchain.ifacewriter.blocks.append(block)
Expand Down Expand Up @@ -290,9 +300,9 @@ def __init__(self, platform, io, o1, o2, oe1, oe2, i1, i2, clk):
"properties" : io_prop,
"size" : 1,
"in_reg" : "DDIO_RESYNC",
"in_clk_pin" : clk.name_override, # FIXME.
"in_clk_pin" : _to_signal(clk),
"out_reg" : "DDIO_RESYNC",
"out_clk_pin" : clk.name_override, # FIXME.
"out_clk_pin" : _to_signal(clk),
"oe_reg" : "REG",
"is_inclk_inverted" : False,
"drive_strength" : io_prop_dict.get("DRIVE_STRENGTH", "4")
Expand Down Expand Up @@ -327,9 +337,9 @@ def __init__(self, platform, io, o, oe, i, clk):
"properties" : io_prop,
"size" : 1,
"in_reg" : "REG",
"in_clk_pin" : clk.name_override, # FIXME.
"in_clk_pin" : _to_signal(clk),
"out_reg" : "REG",
"out_clk_pin" : clk.name_override, # FIXME.
"out_clk_pin" : _to_signal(clk),
"oe_reg" : "REG",
"is_inclk_inverted" : False,
"drive_strength" : io_prop_dict.get("DRIVE_STRENGTH", "4")
Expand Down Expand Up @@ -361,7 +371,7 @@ def __init__(self, platform, i, o, clk):
"properties" : io_prop,
"size" : 1,
"out_reg" : "REG",
"out_clk_pin" : clk.name_override, # FIXME.
"out_clk_pin" : _to_signal(clk),
"is_inclk_inverted" : False,
"drive_strength" : io_prop_dict.get("DRIVE_STRENGTH", "4")
}
Expand Down Expand Up @@ -395,7 +405,7 @@ def __init__(self, platform, i1, i2, o, clk):
"properties" : io_prop,
"size" : 1,
"out_reg" : "DDIO_RESYNC",
"out_clk_pin" : clk.name_override, # FIXME.
"out_clk_pin" : _to_signal(clk),
"is_inclk_inverted" : False,
"drive_strength" : io_prop_dict.get("DRIVE_STRENGTH", "4")
}
Expand Down Expand Up @@ -426,7 +436,7 @@ def __init__(self, platform, i, o1, o2, clk):
"properties" : io_prop,
"size" : 1,
"in_reg" : "DDIO_RESYNC",
"in_clk_pin" : clk.name_override, # FIXME.
"in_clk_pin" : _to_signal(clk),
"is_inclk_inverted" : False
}
platform.toolchain.ifacewriter.blocks.append(block)
Expand Down

0 comments on commit a3a55fc

Please sign in to comment.