From f1eb1c6064d3e74cf1b927e0604726c7ee577e9f Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 1 Apr 2015 12:48:51 +0200 Subject: [PATCH] util_axis_resize: Add support for non power-of-two ratios Update the axi_repack core so it can handle non power-of-two ratios between the input and output stream width. The ratio still needs to be a integer though. Signed-off-by: Lars-Peter Clausen --- library/util_axis_resize/util_axis_resize.v | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/library/util_axis_resize/util_axis_resize.v b/library/util_axis_resize/util_axis_resize.v index e6160db9c..463f3006e 100644 --- a/library/util_axis_resize/util_axis_resize.v +++ b/library/util_axis_resize/util_axis_resize.v @@ -77,8 +77,12 @@ begin else if (m_ready == 1'b1) valid <= 1'b0; - if (s_ready == 1'b1 && s_valid == 1'b1) - count <= count - 1'b1; + if (s_ready == 1'b1 && s_valid == 1'b1) begin + if (count == 'h00) + count <= RATIO - 1; + else + count <= count - 1'b1; + end end end @@ -111,8 +115,12 @@ begin else if (count == 'h0 && m_ready == 1'b1 && m_valid == 1'b1) valid <= 1'b0; - if (m_ready == 1'b1 && m_valid == 1'b1) - count <= count - 1'b1; + if (m_ready == 1'b1 && m_valid == 1'b1) begin + if (count == 'h00) + count <= RATIO - 1; + else + count <= count - 1'b1; + end end end