From b018fcedc48003dc2fa3c69d0246daecadf1598f Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 16 Apr 2013 22:21:03 +0200 Subject: [PATCH] dvisampler/chansync: set synced to 0 when control tokens do not arrive at the same time --- milkymist/dvisampler/chansync.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/milkymist/dvisampler/chansync.py b/milkymist/dvisampler/chansync.py index 2a046b659..5f53de18b 100644 --- a/milkymist/dvisampler/chansync.py +++ b/milkymist/dvisampler/chansync.py @@ -45,8 +45,20 @@ class ChanSync(Module, AutoCSR): ] lst_control_starts.append(control_starts) - self.comb += all_control_starts.eq(optree("&", lst_control_starts)) + some_control_starts = Signal() + self.comb += [ + all_control_starts.eq(optree("&", lst_control_starts)), + some_control_starts.eq(optree("|", lst_control_starts)) + ] self.sync.pix += If(~self.valid_i, self.chan_synced.eq(0) - ).Elif(all_control_starts, self.chan_synced.eq(1)) + ).Else( + If(some_control_starts, + If(all_control_starts, + self.chan_synced.eq(1) + ).Else( + self.chan_synced.eq(0) + ) + ) + ) self.specials += MultiReg(self.chan_synced, self._r_channels_synced.status)