mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
soc/cores/clock: add with_reset parameter to create_clkout on iCE40PLL/ECP5PLL (similar to others PLLs).
Avoid instantiating the AsyncResetSynchronizer manually.
This commit is contained in:
parent
f07efcb97f
commit
2538b2c300
1 changed files with 6 additions and 2 deletions
|
@ -584,13 +584,15 @@ class iCE40PLL(Module):
|
||||||
self.clkin_freq = freq
|
self.clkin_freq = freq
|
||||||
register_clkin_log(self.logger, clkin, freq)
|
register_clkin_log(self.logger, clkin, freq)
|
||||||
|
|
||||||
def create_clkout(self, cd, freq, margin=1e-2):
|
def create_clkout(self, cd, freq, margin=1e-2, with_reset=True):
|
||||||
(clko_freq_min, clko_freq_max) = self.clko_freq_range
|
(clko_freq_min, clko_freq_max) = self.clko_freq_range
|
||||||
assert freq >= clko_freq_min
|
assert freq >= clko_freq_min
|
||||||
assert freq <= clko_freq_max
|
assert freq <= clko_freq_max
|
||||||
assert self.nclkouts < self.nclkouts_max
|
assert self.nclkouts < self.nclkouts_max
|
||||||
clkout = Signal()
|
clkout = Signal()
|
||||||
self.clkouts[self.nclkouts] = (clkout, freq, 0, margin)
|
self.clkouts[self.nclkouts] = (clkout, freq, 0, margin)
|
||||||
|
if with_reset:
|
||||||
|
self.specials += AsyncResetSynchronizer(cd, ~self.locked | self.reset)
|
||||||
self.comb += cd.clk.eq(clkout)
|
self.comb += cd.clk.eq(clkout)
|
||||||
create_clkout_log(self.logger, cd.name, freq, margin, self.nclkouts)
|
create_clkout_log(self.logger, cd.name, freq, margin, self.nclkouts)
|
||||||
self.nclkouts += 1
|
self.nclkouts += 1
|
||||||
|
@ -684,13 +686,15 @@ class ECP5PLL(Module):
|
||||||
self.clkin_freq = freq
|
self.clkin_freq = freq
|
||||||
register_clkin_log(self.logger, clkin, freq)
|
register_clkin_log(self.logger, clkin, freq)
|
||||||
|
|
||||||
def create_clkout(self, cd, freq, phase=0, margin=1e-2):
|
def create_clkout(self, cd, freq, phase=0, margin=1e-2, with_reset=True):
|
||||||
(clko_freq_min, clko_freq_max) = self.clko_freq_range
|
(clko_freq_min, clko_freq_max) = self.clko_freq_range
|
||||||
assert freq >= clko_freq_min
|
assert freq >= clko_freq_min
|
||||||
assert freq <= clko_freq_max
|
assert freq <= clko_freq_max
|
||||||
assert self.nclkouts < self.nclkouts_max
|
assert self.nclkouts < self.nclkouts_max
|
||||||
clkout = Signal()
|
clkout = Signal()
|
||||||
self.clkouts[self.nclkouts] = (clkout, freq, phase, margin)
|
self.clkouts[self.nclkouts] = (clkout, freq, phase, margin)
|
||||||
|
if with_reset:
|
||||||
|
self.specials += AsyncResetSynchronizer(cd, ~self.locked | self.reset)
|
||||||
self.comb += cd.clk.eq(clkout)
|
self.comb += cd.clk.eq(clkout)
|
||||||
create_clkout_log(self.logger, cd.name, freq, margin, self.nclkouts)
|
create_clkout_log(self.logger, cd.name, freq, margin, self.nclkouts)
|
||||||
self.nclkouts += 1
|
self.nclkouts += 1
|
||||||
|
|
Loading…
Reference in a new issue