dvisampler/chansync: set synced to 0 when control tokens do not arrive at the same...
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Tue, 16 Apr 2013 20:21:03 +0000 (22:21 +0200)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Tue, 16 Apr 2013 20:21:03 +0000 (22:21 +0200)
milkymist/dvisampler/chansync.py

index 2a046b659f67e357b28baabfcb98c2e4a133011b..5f53de18b46e012d592b5d9e95da119d54949c26 100644 (file)
@@ -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)