soc/cores/clock: create specific S7IDELAYCTRL module
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 24 Sep 2018 21:22:59 +0000 (23:22 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 24 Sep 2018 21:22:59 +0000 (23:22 +0200)
litex/boards/targets/arty.py
litex/soc/cores/clock.py

index 4f1dec58121f58c01a9c7986290ad6599d25c045..8056109076af947ef60866726d91ff6b43509a9e 100755 (executable)
@@ -32,7 +32,8 @@ class _CRG(Module):
         pll.create_clkout(self.cd_sys4x, 4*sys_clk_freq)
         pll.create_clkout(self.cd_sys4x_dqs, 4*sys_clk_freq, phase=90)
         pll.create_clkout(self.cd_clk200, 200e6)
-        pll.add_idelayctrl(self.cd_clk200)
+
+        self.submodules.idelayctrl = S7IDELAYCTRL(self.cd_clk200)
 
         eth_clk = Signal()
         self.specials += [
index 6fe04d2543cf117de7777ed90ab2b9086558ef04..766dd6f202461cf9dc029c1e3fdd1232cecb9cb6 100644 (file)
@@ -83,18 +83,6 @@ class S7Clocking(Module):
                 return config
         raise ValueError("No PLL config found")
 
-    def add_idelayctrl(self, cd):
-        reset_counter = Signal(4, reset=15)
-        ic_reset = Signal(reset=1)
-        sync = getattr(self.sync, cd.name)
-        sync += \
-            If(reset_counter != 0,
-                reset_counter.eq(reset_counter - 1)
-            ).Else(
-                ic_reset.eq(0)
-            )
-        self.specials += Instance("IDELAYCTRL", i_REFCLK=cd.clk, i_RST=ic_reset)
-
     def do_finalize(self):
         assert hasattr(self, "clkin")
 
@@ -144,3 +132,17 @@ class S7MMCM(S7Clocking):
             mmcm_params["p_CLKOUT{}_PHASE".format(n)] = config["clkout{}_phase".format(n)]
             mmcm_params["o_CLKOUT{}".format(n)] = clk
         self.specials += Instance("MMCME2_BASE", **mmcm_params)
+
+
+class S7IDELAYCTRL(Module):
+    def __init__(self, cd):
+        reset_counter = Signal(4, reset=15)
+        ic_reset = Signal(reset=1)
+        sync = getattr(self.sync, cd.name)
+        sync += \
+            If(reset_counter != 0,
+                reset_counter.eq(reset_counter - 1)
+            ).Else(
+                ic_reset.eq(0)
+            )
+        self.specials += Instance("IDELAYCTRL", i_REFCLK=cd.clk, i_RST=ic_reset)