From 412f0f59b943c6bca7ce2c65adde3eff868556db Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 12 Sep 2023 09:29:45 +0200 Subject: [PATCH] build/io: Add ClkInput/Ouptut to be able to abstract Clk Input/Output primitives. --- litex/build/io.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/litex/build/io.py b/litex/build/io.py index 28a965415..8a5445450 100644 --- a/litex/build/io.py +++ b/litex/build/io.py @@ -43,6 +43,37 @@ class DifferentialOutput(Special): def lower(dr): raise NotImplementedError("Attempted to use a Differential Output, but platform does not support them") +# Clk Input/Output --------------------------------------------------------------------------------- + +class ClkInput(Special): + def __init__(self, i, o): + Special.__init__(self) + self.i = wrap(i) + self.o = o if isinstance(o, str) else wrap(o) + + def iter_expressions(self): + yield self, "i", SPECIAL_INPUT + yield self, "o", SPECIAL_OUTPUT + + @staticmethod + def lower(dr): + raise NotImplementedError("Attempted to use a Clk Input, but platform does not support them") + + +class ClkOutput(Special): + def __init__(self, i, o): + Special.__init__(self) + self.i = i if isinstance(i, str) else wrap(i) + self.o = wrap(o) + + def iter_expressions(self): + yield self, "i", SPECIAL_INPUT + yield self, "o", SPECIAL_OUTPUT + + @staticmethod + def lower(dr): + raise NotImplementedError("Attempted to use a Clk Output, but platform does not support them") + # SDR Input/Output --------------------------------------------------------------------------------- class InferedSDRIO(Module):