mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
soc/core/clock: allow selecting buffer type (None, BUFG, BUFR). (default = BUFG)
This commit is contained in:
parent
912ca3236b
commit
6cd954940c
1 changed files with 15 additions and 6 deletions
|
@ -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 = {}
|
||||
|
|
Loading…
Reference in a new issue