self.b = Signal(8)
# in sys clock domain
- word_layout = [("parity", 1), ("pixels", word_width)]
+ word_layout = [("sof", 1), ("pixels", word_width)]
self.frame = Source(word_layout)
self.busy = Signal()
fifo.din.pixels.eq(cur_word),
fifo.we.eq(cur_word_valid)
]
- 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.sync.pix += \
+ If(new_frame,
+ fifo.din.sof.eq(1)
+ ).Elif(cur_word_valid,
+ fifo.din.sof.eq(0)
+ )
self.comb += [
self.frame.stb.eq(fifo.readable),
self.frame.payload.eq(fifo.dout),
self._r_overflow.w.eq(sys_overflow & ~overflow_mask),
self.overflow_reset.i.eq(self._r_overflow.re)
]
- self.sync += [
+ self.sync += \
If(self._r_overflow.re,
overflow_mask.eq(1)
).Elif(self.overflow_reset_ack.o,
overflow_mask.eq(0)
)
- ]
alignment_bits = bits_for(bus_dw//8) - 1
fifo_word_width = 24*bus_dw//32
- self.frame = Sink([("parity", 1), ("pixels", fifo_word_width)])
+ self.frame = Sink([("sof", 1), ("pixels", fifo_word_width)])
self._r_frame_size = CSRStorage(bus_aw + alignment_bits, alignment_bits=alignment_bits)
self.submodules._slot_array = _SlotArray(nslots, bus_aw, alignment_bits)
self.ev = self._slot_array.ev
###
- # start of frame detection
- sof = Signal()
- parity_r = Signal()
- self.sync += If(self.frame.stb & self.frame.ack, parity_r.eq(self.frame.payload.parity))
- self.comb += sof.eq(parity_r ^ self.frame.payload.parity)
-
# address generator + maximum memory word count to prevent DMA buffer overrun
reset_words = Signal()
count_word = Signal()
fsm.act("WAIT_SOF",
reset_words.eq(1),
- self.frame.ack.eq(~self._slot_array.address_valid | ~sof),
- If(self._slot_array.address_valid & sof & self.frame.stb, NextState("TRANSFER_PIXELS"))
+ self.frame.ack.eq(~self._slot_array.address_valid | ~self.frame.payload.sof),
+ If(self._slot_array.address_valid & self.frame.payload.sof & self.frame.stb, NextState("TRANSFER_PIXELS"))
)
fsm.act("TRANSFER_PIXELS",
self.frame.ack.eq(self._bus_accessor.address_data.ack),