Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).


## Unreleased

### Fixed
- Transpose no longer deadlocks when `NumAxInFlight` is below the tile height: the R-AW coupler
and the write queues hold at least one whole tile, including rows split at a 4 KiB boundary
[#275](https://github.com/pulp-platform/iDMA/issues/275).

## 0.7.4 - 2026-10-06

MX changes the on-chip MX format and layout; MX has no production users yet, so they stay on 0.7.x.
Expand Down
11 changes: 8 additions & 3 deletions idma.mk
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,14 @@ idma_sim_tb_idma_otf_transpose:
.PHONY: idma_sim_tb_idma_transpose_nd
idma_sim_tb_idma_transpose_nd: $(IDMA_VSIM_DIR)/compile.tcl
cd $(IDMA_VSIM_DIR); $(VSIM) -c -do "source compile.tcl; quit"
# the TB sweeps the geometry list internally; one run per bus width
cd $(IDMA_VSIM_DIR); $(VSIM) -c -t 1ps -voptargs=+acc -gDataWidth=32 tb_idma_transpose_nd -do "run -all; quit"
cd $(IDMA_VSIM_DIR); $(VSIM) -c -t 1ps -voptargs=+acc -gDataWidth=64 tb_idma_transpose_nd -do "run -all; quit"
# the TB sweeps the geometry list internally; the shallow-queue runs must still fit a whole tile
cd $(IDMA_VSIM_DIR); for g in "-gDataWidth=32" "-gDataWidth=64" "-gDataWidth=64 -gAxIF=2" \
"-gDataWidth=64 -gAxIF=2 -gMaxAwAhead=1" "-gDataWidth=128 -gAxIF=2 -gMaxAwAhead=1" \
"-gDataWidth=512 -gAxIF=24 -gMaxAwAhead=1" "-gDataWidth=512 -gAxIF=24 -gMaxAwAhead=2"; do \
$(VSIM) -c -t 1ps -voptargs=+acc $$g tb_idma_transpose_nd -logfile transpose_nd.log \
-do "run -all; quit"; \
! grep -qE "Error:|Fatal:" transpose_nd.log || exit 1; \
grep -q "\[TPN\] ALL PASS" transpose_nd.log || exit 1; done

# OBI-destination transpose: the write strobe must mask edge tiles and padding
.PHONY: idma_sim_tb_idma_transpose_obi
Expand Down
26 changes: 18 additions & 8 deletions src/backend/tpl/idma_backend.sv.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,20 @@ _rsp_t ${mh_format['aw'][protocol]}${protocol}_write_rsp_i,
output idma_busy_t busy_o
);

/// Extra write-descriptor slots covering the compute (transpose) tile-fill latency.
/// Write queues holding a whole transpose tile; a transpose config change drains the backend
% if compute_eligible:
localparam int unsigned ComputeFifoDepth = EnableCompute ? StrbWidth : 32'd0;
// a transpose tile is up to StrbWidth row writes, each split in two at a 4 KiB boundary
localparam int unsigned TransposeTileDepth =
(EnableCompute && ComputeOps.transpose) ? 32'd2 * StrbWidth : 32'd0;
localparam int unsigned TileFifoDepth =
(NumAxInFlight + ComputeFifoDepth > TransposeTileDepth) ?
NumAxInFlight + ComputeFifoDepth : TransposeTileDepth;
localparam int unsigned CouplerDepth =
(EnableCompute && ComputeOps.transpose) ? TileFifoDepth : NumAxInFlight;
% else:
localparam int unsigned ComputeFifoDepth = 32'd0;
localparam int unsigned TileFifoDepth = NumAxInFlight;
localparam int unsigned CouplerDepth = NumAxInFlight;
% endif

/// Dataflow element depth; each ready cut needs one more entry for the same rate
Expand All @@ -193,8 +202,8 @@ _rsp_t ${mh_format['aw'][protocol]}${protocol}_write_rsp_i,

/// The localparam MetaFifoDepth holds the maximum number of transfers that can be
/// in-flight under any circumstances.
localparam int unsigned MetaFifoDepth = DfeDepth + NumAxInFlight + MemSysDepth +
ComputeFifoDepth + 32'd2 * 32'(TimingCuts.wdp_head_spill);
localparam int unsigned MetaFifoDepth = DfeDepth + TileFifoDepth + MemSysDepth +
32'd2 * 32'(TimingCuts.wdp_head_spill);

/// Address type
typedef logic [AddrWidth-1:0] addr_t;
Expand Down Expand Up @@ -746,7 +755,7 @@ _rsp_t ${mh_format['aw'][protocol]}${protocol}_write_rsp_i,
);

cc_stream_fifo_optimal_wrap #(
.Depth ( NumAxInFlight + ComputeFifoDepth ),
.Depth ( TileFifoDepth ),
.data_t ( w_dp_req_t ),
.PrintInfo ( PrintFifoInfo )
) i_w_dp_req (
Expand Down Expand Up @@ -966,7 +975,7 @@ _rsp_t ${mh_format['aw'][protocol]}${protocol}_write_rsp_i,
% if one_read_port and one_write_port and (used_read_protocols[0] == used_write_protocols[0]):
// mirrors i_w_dp_req exactly: same depth, same push valid, same pop ready
cc_stream_fifo_optimal_wrap #(
.Depth ( NumAxInFlight + ComputeFifoDepth ),
.Depth ( TileFifoDepth ),
.data_t ( logic ),
.PrintInfo ( PrintFifoInfo )
) i_w_decouple_aw (
Expand All @@ -984,8 +993,9 @@ _rsp_t ${mh_format['aw'][protocol]}${protocol}_write_rsp_i,
);

// instantiate the channel coupler
// holds a whole transpose tile of AWs when transpose is enabled
idma_channel_coupler #(
.NumAxInFlight ( NumAxInFlight ),
.NumAxInFlight ( CouplerDepth ),
.AddrWidth ( AddrWidth ),
.UserWidth ( UserWidth ),
.AxiIdWidth ( AxiIdWidth ),
Expand Down Expand Up @@ -1044,7 +1054,7 @@ w_req.decouple_aw || (w_req.w_dp_req.dst_protocol inside {\
% if compute_eligible:
// combined aw+w read-meta buffer; deepened for the compute engine tile read-ahead (cf. i_w_dp_req)
cc_stream_fifo_optimal_wrap #(
.Depth ( EnableCompute ? NumAxInFlight + ComputeFifoDepth : 32'd2 ),
.Depth ( EnableCompute ? TileFifoDepth : 32'd2 ),
% else:
// Atleast one write protocol uses combined aw and w -> Need to buffer read meta requests
// As a write could depend on up to two reads
Expand Down
11 changes: 10 additions & 1 deletion target/sim/vlt/testbenches.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ IDMA_VLT_TESTBENCHES := \
tb_idma_rt_midend

IDMA_VLT_SUFFIXES_tb_idma_otf_transpose := sw8_fd0 sw8_fd1 sw64_fd0 sw64_fd1
IDMA_VLT_SUFFIXES_tb_idma_transpose_nd := dw32 dw64
IDMA_VLT_SUFFIXES_tb_idma_transpose_nd := dw32 dw64 dw64_axif2 dw64_axif2_aw1 dw128_axif2_aw1 \
dw512_axif24_aw1 dw512_axif24_aw2
IDMA_VLT_SUFFIXES_tb_idma_transpose_b2b := dw32 dw64
IDMA_VLT_SUFFIXES_tb_idma_transpose_midend := dw64 dw512
IDMA_VLT_SUFFIXES_tb_idma_nd_midend_b2b := default
Expand All @@ -42,6 +43,14 @@ IDMA_VLT_RUN_ARGS_tb_idma_otf_transpose__sw64_fd1 := +BP
# End-to-end transpose and transpose-midend bus-width configurations.
IDMA_VLT_ELAB_ARGS_tb_idma_transpose_nd__dw32 := -GDataWidth=32
IDMA_VLT_ELAB_ARGS_tb_idma_transpose_nd__dw64 := -GDataWidth=64
# Shallow AW queues and a slave taking one AW ahead of its W must still fit a whole tile
IDMA_VLT_ELAB_ARGS_tb_idma_transpose_nd__dw64_axif2 := -GDataWidth=64 -GAxIF=2
IDMA_VLT_ELAB_ARGS_tb_idma_transpose_nd__dw64_axif2_aw1 := -GDataWidth=64 -GAxIF=2 -GMaxAwAhead=1
IDMA_VLT_ELAB_ARGS_tb_idma_transpose_nd__dw128_axif2_aw1 := -GDataWidth=128 -GAxIF=2 -GMaxAwAhead=1
IDMA_VLT_ELAB_ARGS_tb_idma_transpose_nd__dw512_axif24_aw1 := \
-GDataWidth=512 -GAxIF=24 -GMaxAwAhead=1
IDMA_VLT_ELAB_ARGS_tb_idma_transpose_nd__dw512_axif24_aw2 := \
-GDataWidth=512 -GAxIF=24 -GMaxAwAhead=2
IDMA_VLT_ELAB_ARGS_tb_idma_transpose_b2b__dw32 := -GDataWidth=32
IDMA_VLT_ELAB_ARGS_tb_idma_transpose_b2b__dw64 := -GDataWidth=64
IDMA_VLT_ELAB_ARGS_tb_idma_transpose_midend__dw64 := -GDataWidth=64
Expand Down
31 changes: 23 additions & 8 deletions test/tb_idma_transpose_nd.sv
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,23 @@ module tb_idma_transpose_nd
parameter int unsigned UserWidth = 1,
parameter int unsigned AxiIdWidth = 12,
parameter int unsigned TFLenWidth = 32,
parameter int unsigned BufferDepth = 3
parameter int unsigned BufferDepth = 3,
parameter int unsigned AxIF = DataWidth / 8,
// AWs the memory accepts ahead of their W data (0: unlimited), like an interconnect write limit
parameter int unsigned MaxAwAhead = 0
);

localparam time TA = 1ns;
localparam time TT = 9ns;
localparam time TCK = 10ns;

localparam int unsigned StrbWidth = DataWidth / 8;
// transpose buffers a full NE-beat tile before the first write; NE <= StrbWidth
localparam int unsigned AxIF = StrbWidth;
localparam int unsigned NumDim = 4; // 1D + {row, row-tile, col-tile}
localparam logic [NumDim-1:0][31:0] RepWidths = '{default: 32'd16};

// Geometry cases (M, N, EB) swept in one elaboration: aligned + edge
// (M or N not a multiple of NE) for int8/fp16/fp32. EB>StrbWidth cases skip.
localparam int unsigned NCases = 14;
localparam int unsigned NCases = 16;
localparam int unsigned Cases[NCases][3] = '{
'{8, 8, 1},
'{16, 16, 1},
Expand All @@ -51,7 +52,9 @@ module tb_idma_transpose_nd
'{32, 24, 1},
'{9, 5, 4},
'{13, 19, 1},
'{9, 5, 8}
'{9, 5, 8},
'{4095, 4, 1},
'{2047, 2, 2}
};

// Whole-tile cases, all non-square so an M/N swap cannot hide
Expand Down Expand Up @@ -158,8 +161,20 @@ module tb_idma_transpose_nd
.mst_req_o (axi_req),
.mst_resp_i (axi_rsp)
);
assign axi_req_mem = axi_req;
assign axi_rsp = axi_rsp_mem;
int aw_ahead_q;
logic aw_block;
assign aw_block = (MaxAwAhead != 0) && (aw_ahead_q >= int'(MaxAwAhead));
always_comb begin
axi_req_mem = axi_req;
axi_rsp = axi_rsp_mem;
axi_req_mem.aw_valid = axi_req.aw_valid & ~aw_block;
axi_rsp.aw_ready = axi_rsp_mem.aw_ready & ~aw_block;
end
always_ff @(posedge clk or negedge rst_n)
if (!rst_n) aw_ahead_q <= 0;
else
aw_ahead_q <= aw_ahead_q + int'(axi_req_mem.aw_valid & axi_rsp_mem.aw_ready) -
int'(axi_req.w_valid & axi_rsp.w_ready & axi_req.w.last);

axi_sim_mem #(
.AddrWidth (AddrWidth),
Expand Down Expand Up @@ -553,7 +568,7 @@ module tb_idma_transpose_nd
// Sweep aligned and sub-beat misaligned bases to reach the 2-beat-row path
for (int unsigned misalign = 0; misalign < 2; misalign++) begin
sb = 'h0000_1000 + (misalign ? 1 : 0);
db = 'h0000_4000 + (misalign ? 3 : 0);
db = 'h0010_0000 + (misalign ? 3 : 0); // clear of the largest source matrix
for (int unsigned k = 0; k < NCases; k++) begin
if (Cases[k][2] > StrbWidth) continue; // element must fit the bus
for (int unsigned compact = 0; compact < 2; compact++) begin
Expand Down
Loading