From 2eabf971478d9a2184dc9863341c32d33ee7d979 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 19 Nov 2013 23:38:48 +0100 Subject: [PATCH] dvisampler: transfer the last word in frames correctly --- misoclib/dvisampler/analysis.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/misoclib/dvisampler/analysis.py b/misoclib/dvisampler/analysis.py index 5108f8d8e..7005afbd0 100644 --- a/misoclib/dvisampler/analysis.py +++ b/misoclib/dvisampler/analysis.py @@ -141,11 +141,13 @@ class FrameExtraction(Module, AutoCSR): self.sync.pix += [ cur_word_valid.eq(0), If(new_frame, - pack_counter.eq(0) + cur_word_valid.eq(pack_counter == (pack_factor - 1)), + pack_counter.eq(0), ).Elif(self.valid_i & self.de, [If(pack_counter == (pack_factor-i-1), cur_word[24*i:24*(i+1)].eq(encoded_pixel)) for i in range(pack_factor)], - Cat(pack_counter, cur_word_valid).eq(pack_counter + 1) + cur_word_valid.eq(pack_counter == (pack_factor - 1)), + pack_counter.eq(pack_counter + 1) ) ] @@ -157,7 +159,11 @@ class FrameExtraction(Module, AutoCSR): fifo.din.pixels.eq(cur_word), fifo.we.eq(cur_word_valid) ] - self.sync.pix += If(new_frame, fifo.din.parity.eq(~fifo.din.parity)) + new_frame_r = Signal() + self.sync.pix += [ + If(new_frame_r, fifo.din.parity.eq(~fifo.din.parity)), + new_frame_r.eq(new_frame) + ] self.comb += [ self.frame.stb.eq(fifo.readable), self.frame.payload.eq(fifo.dout),