From: Florent Kermarrec Date: Mon, 24 Sep 2018 21:22:59 +0000 (+0200) Subject: soc/cores/clock: create specific S7IDELAYCTRL module X-Git-Tag: 24jan2021_ls180~1583 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=912ca3236b9b69c811f849d535abd87edc733d45;p=litex.git soc/cores/clock: create specific S7IDELAYCTRL module --- diff --git a/litex/boards/targets/arty.py b/litex/boards/targets/arty.py index 4f1dec58..80561090 100755 --- a/litex/boards/targets/arty.py +++ b/litex/boards/targets/arty.py @@ -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 += [ diff --git a/litex/soc/cores/clock.py b/litex/soc/cores/clock.py index 6fe04d25..766dd6f2 100644 --- a/litex/soc/cores/clock.py +++ b/litex/soc/cores/clock.py @@ -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)