Skip to content

Commit

Permalink
dvisampler/clocking: proper pix5x reset synchronization
Browse files Browse the repository at this point in the history
Sebastien Bourdeauducq committed Mar 18, 2013

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 5126f61 commit 28cb970
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion milkymist/dvisampler/clocking.py
Original file line number Diff line number Diff line change
@@ -57,5 +57,20 @@ def __init__(self):
self.specials += Instance("BUFG",
Instance.Input("I", pll_clk2), Instance.Output("O", self._cd_pix.clk))
self.specials += MultiReg(locked_async, self.locked, "sys")
self.specials += MultiReg(~locked_async, self._cd_pix5x.rst, "pix5x")
self.comb += self._r_locked.field.w.eq(self.locked)

# sychronize pix5x reset
# this reset is also sampled in the sys clock domain, also guarantee
# a sufficient minimum pulse width.
pix5x_rst_n = 1
for i in range(5):
new_pix5x_rst_n = Signal()
self.specials += Instance("FDCE",
Instance.Input("D", pix5x_rst_n),
Instance.Input("CE", 1),
Instance.Input("C", ClockSignal("pix5x")),
Instance.Input("CLR", ~locked_async),
Instance.Output("Q", new_pix5x_rst_n)
)
pix5x_rst_n = new_pix5x_rst_n
self.comb += self._cd_pix5x.rst.eq(~pix5x_rst_n)

0 comments on commit 28cb970

Please sign in to comment.