From c4717f56997dc93195e06e2b0d71170b36b4f689 Mon Sep 17 00:00:00 2001 From: Nils Wistoff Date: Fri, 9 Aug 2024 16:27:05 +0200 Subject: [PATCH] axi_burst_unwrap: Fix burst length computation Signed-off-by: Nils Wistoff Co-authored-by: Zexin Fu --- src/axi_burst_unwrap.sv | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/axi_burst_unwrap.sv b/src/axi_burst_unwrap.sv index 35c44e189..427c6c278 100644 --- a/src/axi_burst_unwrap.sv +++ b/src/axi_burst_unwrap.sv @@ -468,7 +468,7 @@ module axi_burst_unwrap_ax_chan #( logic [AddrWidth-1:0] wrap_boundary; // The total size of this burst (beat_size * burst_length) - assign container_size = ax_i.len << ax_i.size; + assign container_size = (ax_i.len + 1) << ax_i.size; // For wrapping bursts, this returns the wrap boundary (container size is power of two according to A.3.4.1) assign wrap_boundary = ax_i.addr & ~(AddrWidth'(container_size) - 1); @@ -494,9 +494,10 @@ module axi_burst_unwrap_ax_chan #( // Try to feed first burst through. ax_o = ax_d; // First (this) incr burst from addr to wrap boundary + container size - ax_o.len = (wrap_boundary + container_size - ax_i.addr) >> ax_i.size; + ax_o.len = ((wrap_boundary + container_size - ax_i.addr) >> ax_i.size) - 1; // Next incr burst from wrap boundary to addr - ax_d.len = (ax_i.addr - wrap_boundary) >> ax_i.size; + ax_d.len = ((ax_i.addr - wrap_boundary) >> ax_i.size) - 1; + ax_d.addr = wrap_boundary; ax_valid_o = 1'b1; if (ax_ready_i) begin ax_ready_o = 1'b1;