Skip to content

Commit 28cb970

Browse files
author
Sebastien Bourdeauducq
committedMar 18, 2013
dvisampler/clocking: proper pix5x reset synchronization
1 parent 5126f61 commit 28cb970

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed
 

‎milkymist/dvisampler/clocking.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,20 @@ def __init__(self):
5757
self.specials += Instance("BUFG",
5858
Instance.Input("I", pll_clk2), Instance.Output("O", self._cd_pix.clk))
5959
self.specials += MultiReg(locked_async, self.locked, "sys")
60-
self.specials += MultiReg(~locked_async, self._cd_pix5x.rst, "pix5x")
6160
self.comb += self._r_locked.field.w.eq(self.locked)
61+
62+
# sychronize pix5x reset
63+
# this reset is also sampled in the sys clock domain, also guarantee
64+
# a sufficient minimum pulse width.
65+
pix5x_rst_n = 1
66+
for i in range(5):
67+
new_pix5x_rst_n = Signal()
68+
self.specials += Instance("FDCE",
69+
Instance.Input("D", pix5x_rst_n),
70+
Instance.Input("CE", 1),
71+
Instance.Input("C", ClockSignal("pix5x")),
72+
Instance.Input("CLR", ~locked_async),
73+
Instance.Output("Q", new_pix5x_rst_n)
74+
)
75+
pix5x_rst_n = new_pix5x_rst_n
76+
self.comb += self._cd_pix5x.rst.eq(~pix5x_rst_n)

0 commit comments

Comments
 (0)
Please sign in to comment.