soc/interconnect/packet: connect error/last_be only present on both sink and source

This commit is contained in:
Florent Kermarrec 2019-11-15 14:57:31 +01:00
parent 2946581e50
commit 31661e9e2d
1 changed files with 4 additions and 4 deletions

View File

@ -262,11 +262,11 @@ class Packetizer(Module):
)
# Error ------------------------------------------------------------------------------------
if hasattr(sink, "error"):
if hasattr(sink, "error") and hasattr(source, "error"):
self.comb += source.error.eq(sink.error)
# Last BE ----------------------------------------------------------------------------------
if hasattr(sink, "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))
@ -375,11 +375,11 @@ class Depacketizer(Module):
)
# Error ------------------------------------------------------------------------------------
if hasattr(sink, "error"):
if hasattr(sink, "error") and hasattr(source, "error"):
self.comb += source.error.eq(sink.error)
# Last BE ----------------------------------------------------------------------------------
if hasattr(sink, "last_be"):
if hasattr(sink, "last_be") and hasattr(source, "last_be"):
x = [sink.last_be[(i - (bytes_per_clk - header_leftover))%bytes_per_clk]
for i in range(bytes_per_clk)]
self.comb += source.last_be.eq(Cat(*x))