From: Florent Kermarrec Date: Tue, 25 Sep 2018 06:35:50 +0000 (+0200) Subject: soc/core/clock: allow selecting buffer type (None, BUFG, BUFR). (default = BUFG) X-Git-Tag: 24jan2021_ls180~1582 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6cd954940cd91d67a5d314efb413dfd05c440515;p=litex.git soc/core/clock: allow selecting buffer type (None, BUFG, BUFR). (default = BUFG) --- diff --git a/litex/soc/cores/clock.py b/litex/soc/cores/clock.py index 766dd6f2..9ad5c52c 100644 --- a/litex/soc/cores/clock.py +++ b/litex/soc/cores/clock.py @@ -45,16 +45,25 @@ class S7Clocking(Module): raise ValueError self.clkin_freq = freq - def create_clkout(self, cd, freq, phase=0): + def create_clkout(self, cd, freq, phase=0, buf="bufg"): assert self.nclkouts < self.nclkouts_max clkout = Signal() - clkout_bufg = Signal() - self.specials += AsyncResetSynchronizer(cd, ~self.locked | self.reset), - self.specials += Instance("BUFG", i_I=clkout, o_O=clkout_bufg) - self.comb += cd.clk.eq(clkout_bufg) self.clkouts[self.nclkouts] = (clkout, freq, phase) self.nclkouts += 1 - return clkout_bufg + self.specials += AsyncResetSynchronizer(cd, ~self.locked | self.reset) + if buf is None: + self.comb += cd.clk.eq(clkout) + else: + clkout_buf = Signal() + self.comb += cd.clk.eq(clkout_buf) + if buf == "bufg": + self.specials += Instance("BUFG", i_I=clkout, o_O=clkout_buf) + elif buf == "bufr": + self.specials += Instance("BUFR", i_I=clkout, o_O=clkout_buf) + else: + raise ValueError + + return clkout_buf def compute_config(self): config = {}