Skip to content

Commit 0e2e11c

Browse files
committed
library/util_axis_fifo_asym: fix behavior when tkeep=0
Fix a bug where m_axis_valid waits on m_axis_ready to be asserted a few times in order to skip over data for which tkeep was all zeroes. This was a violation of the AXI Streaming protocol. Signed-off-by: Laez Barbosa <laez.barbosa@analog.com>
1 parent 1920f83 commit 0e2e11c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

library/util_axis_fifo_asym/util_axis_fifo_asym.v

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,9 @@ module util_axis_fifo_asym #(
216216
if (RATIO_TYPE) begin : small_master
217217

218218
for (i=0; i<RATIO; i=i+1) begin
219-
assign m_axis_ready_int_s[i] = (m_axis_counter == i) ? m_axis_ready : 1'b0;
219+
// When TKEEP_EN, we need to discard the data from the internal FIFOs for which tkeep=0.
220+
// Thus we still need to assert m_axis_ready_int_s for that internal FIFO even without an actual AXI handshake.
221+
assign m_axis_ready_int_s[i] = (m_axis_counter == i) ? (m_axis_ready || (TKEEP_EN && !(|m_axis_tkeep))) : 0;
220222
end
221223

222224
assign m_axis_data = m_axis_data_int_s >> (m_axis_counter*A_WIDTH) ;
@@ -317,7 +319,10 @@ module util_axis_fifo_asym #(
317319
if (!m_axis_aresetn) begin
318320
m_axis_counter <= 0;
319321
end else begin
320-
if (m_axis_ready && m_axis_valid_int) begin
322+
// When using tkeep, we might have an internally "valid" data beat without any actually valid bytes.
323+
// This will result in m_axis_valid being actually low for the external world.
324+
// In this case (tkeep is all 0), we need to increment the counter without waiting for m_axis_ready.
325+
if ((m_axis_ready && m_axis_valid) || (TKEEP_EN && m_axis_valid_int && !(|m_axis_tkeep))) begin
321326
m_axis_counter <= m_axis_counter + 1'b1;
322327
end
323328
end

0 commit comments

Comments
 (0)