soc/interconnect/packet/Depacketizer: another simplifcation pass

This commit is contained in:
Florent Kermarrec 2019-11-18 08:51:44 +01:00
parent af52203c00
commit 1efb18f1ea
1 changed files with 12 additions and 9 deletions

View File

@ -338,17 +338,20 @@ class Depacketizer(Module):
) )
self.sync += If(sink.ready, sink_d.eq(sink)) self.sync += If(sink.ready, sink_d.eq(sink))
fsm.act("UNALIGNED-DATA-COPY", fsm.act("UNALIGNED-DATA-COPY",
source.valid.eq((sink.valid & ~fsm_from_idle) | sink_d.last), source.valid.eq(sink.valid | sink_d.last),
source.last.eq(sink.last | sink_d.last), source.last.eq(sink.last | sink_d.last),
sink.ready.eq(source.ready | fsm_from_idle), sink.ready.eq(source.ready),
If(sink.valid & sink.ready, source.data.eq(sink_d.data[header_leftover*8:]),
NextValue(fsm_from_idle, 0), source.data[min((bytes_per_clk-header_leftover)*8, data_width-1):].eq(sink.data),
If(fsm_from_idle, If(fsm_from_idle,
source.valid.eq(sink_d.last),
sink.ready.eq(1),
If(sink.valid,
NextValue(fsm_from_idle, 0),
sr_shift_leftover.eq(1), sr_shift_leftover.eq(1),
).Else( )
source.data.eq(sink_d.data[header_leftover*8:]), ),
source.data[min((bytes_per_clk-header_leftover)*8, data_width-1):].eq(sink.data) If(source.valid & source.ready,
),
If(source.last, If(source.last,
NextState("IDLE") NextState("IDLE")
) )