cores/clock: add with_reset parameter (default to True)

In some cases we want to generate the reset externally.
This commit is contained in:
Florent Kermarrec 2018-10-31 16:23:23 +01:00
parent 445c49400f
commit f7969b660a
1 changed files with 3 additions and 2 deletions

View File

@ -40,12 +40,13 @@ class S7Clocking(Module, AutoCSR):
raise ValueError raise ValueError
self.clkin_freq = freq self.clkin_freq = freq
def create_clkout(self, cd, freq, phase=0, buf="bufg", margin=1e-2): def create_clkout(self, cd, freq, phase=0, buf="bufg", margin=1e-2, with_reset=True):
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)
self.nclkouts += 1 self.nclkouts += 1
self.specials += AsyncResetSynchronizer(cd, ~self.locked | self.reset) if with_reset:
self.specials += AsyncResetSynchronizer(cd, ~self.locked | self.reset)
if buf is None: if buf is None:
self.comb += cd.clk.eq(clkout) self.comb += cd.clk.eq(clkout)
else: else: