Skip to content

Commit

Permalink
gateware.iostream.IOClocker: Fix phase and state keeps flipping.
Browse files Browse the repository at this point in the history
When i_stream is idle, there is currently nothing that prevents
the state machine from changing state between Falling/Rising,
toggling phase, and restarting the timer.

This results in lost power, and sometimes shortened clock pulses
after an idle period.
  • Loading branch information
purdeaandrei authored and whitequark committed Sep 21, 2024
1 parent 3c90d56 commit d7041e4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion software/glasgow/gateware/iostream.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def elaborate(self, platform):
m.d.comb += self.i_stream.ready.eq(1)
with m.Else():
m.d.comb += phase.eq(0)
with m.If(self.o_stream.ready):
with m.If(self.o_stream.ready & self.i_stream.valid):
m.d.sync += timer.eq(self.divisor)
m.next = "Rising"

Expand Down

0 comments on commit d7041e4

Please sign in to comment.