soc/interconnect/packet/Packetizer: fix last_be for 10gbe.
This commit is contained in:
parent
168c5380cf
commit
5e10552f3f
|
@ -186,6 +186,15 @@ class Packetizer(Module):
|
|||
if header_words != 1:
|
||||
self.sync += If(sr_shift, sr.eq(sr[data_width:]))
|
||||
|
||||
# Last BE ----------------------------------------------------------------------------------
|
||||
last_be = Signal(data_width//8)
|
||||
last_be_d = Signal(data_width//8)
|
||||
if hasattr(sink, "last_be") and hasattr(source, "last_be"):
|
||||
rotate_by = header.length%bytes_per_clk
|
||||
x = [sink.last_be[(i + rotate_by)%bytes_per_clk] for i in range(bytes_per_clk)]
|
||||
self.comb += last_be.eq(Cat(*x))
|
||||
self.sync += last_be_d.eq(last_be)
|
||||
|
||||
# FSM --------------------------------------------------------------------------------------
|
||||
self.submodules.fsm = fsm = FSM(reset_state="IDLE")
|
||||
fsm_from_idle = Signal()
|
||||
|
@ -231,9 +240,11 @@ class Packetizer(Module):
|
|||
)
|
||||
)
|
||||
)
|
||||
source_last_be = getattr(source, "last_be", Signal())
|
||||
fsm.act("ALIGNED-DATA-COPY",
|
||||
source.valid.eq(sink.valid),
|
||||
source.last.eq(sink.last),
|
||||
source_last_be.eq(last_be),
|
||||
source.data.eq(sink.data),
|
||||
If(source.valid & source.ready,
|
||||
sink.ready.eq(1),
|
||||
|
@ -247,6 +258,7 @@ class Packetizer(Module):
|
|||
fsm.act("UNALIGNED-DATA-COPY",
|
||||
source.valid.eq(sink.valid | sink_d.last),
|
||||
source.last.eq(sink_d.last),
|
||||
source_last_be.eq(last_be_d),
|
||||
If(fsm_from_idle,
|
||||
source.data[:max(header_leftover*8, 1)].eq(sr[min(header_offset_multiplier*data_width, len(sr)-1):])
|
||||
).Else(
|
||||
|
@ -266,12 +278,6 @@ class Packetizer(Module):
|
|||
if hasattr(sink, "error") and hasattr(source, "error"):
|
||||
self.comb += source.error.eq(sink.error)
|
||||
|
||||
# Last BE ----------------------------------------------------------------------------------
|
||||
if hasattr(sink, "last_be") and hasattr(source, "last_be"):
|
||||
rotate_by = header.length%bytes_per_clk
|
||||
x = [sink.last_be[(i + rotate_by)%bytes_per_clk] for i in range(bytes_per_clk)]
|
||||
self.comb += source.last_be.eq(Cat(*x))
|
||||
|
||||
# Depacketizer -------------------------------------------------------------------------------------
|
||||
|
||||
class Depacketizer(Module):
|
||||
|
|
Loading…
Reference in New Issue