Fix pipe_cnt range: issue 0-15 (16 rounds), acc 4-19, done at 20

This commit is contained in:
2026-06-25 22:26:07 +08:00
parent db9997b473
commit 8bc3d42ac6

View File

@@ -565,8 +565,8 @@ module matmul_axi_slave (
end end
C_RUN: begin C_RUN: begin
// Issue 4 new operands every cycle (pipe_cnt 0-11, 12 rounds) // Issue 4 new operands every cycle (pipe_cnt 0-15, 16 rounds)
if (pipe_cnt < 5'd12) begin if (pipe_cnt < 5'd16) begin
if (cur_bank == 1'b0) begin if (cur_bank == 1'b0) begin
m_in_a[0] <= b0_a[{pipe_cnt[3:2], 2'd0}]; m_in_b[0] <= b0_b[{2'd0, pipe_cnt[1:0]}]; m_in_a[0] <= b0_a[{pipe_cnt[3:2], 2'd0}]; m_in_b[0] <= b0_b[{2'd0, pipe_cnt[1:0]}];
m_in_a[1] <= b0_a[{pipe_cnt[3:2], 2'd1}]; m_in_b[1] <= b0_b[{2'd1, pipe_cnt[1:0]}]; m_in_a[1] <= b0_a[{pipe_cnt[3:2], 2'd1}]; m_in_b[1] <= b0_b[{2'd1, pipe_cnt[1:0]}];
@@ -580,8 +580,8 @@ module matmul_axi_slave (
end end
end end
// Accumulate results from 4 cycles ago (pipe_cnt 4-15) // Accumulate results from 4 cycles ago (pipe_cnt 4-19)
if (pipe_cnt >= 5'd4 && pipe_cnt < 5'd16) begin if (pipe_cnt >= 5'd4 && pipe_cnt < 5'd20) begin
if (acc_bank_d4 == 1'b0) if (acc_bank_d4 == 1'b0)
b0_c[acc_idx_d4] <= ({2'b0, mult_p[0]} + {2'b0, mult_p[1]}) + b0_c[acc_idx_d4] <= ({2'b0, mult_p[0]} + {2'b0, mult_p[1]}) +
({2'b0, mult_p[2]} + {2'b0, mult_p[3]}); ({2'b0, mult_p[2]} + {2'b0, mult_p[3]});
@@ -590,7 +590,7 @@ module matmul_axi_slave (
({2'b0, mult_p[2]} + {2'b0, mult_p[3]}); ({2'b0, mult_p[2]} + {2'b0, mult_p[3]});
end end
if (pipe_cnt == 5'd16) begin if (pipe_cnt == 5'd20) begin
calc_done_pulse <= 1'b1; calc_done_pulse <= 1'b1;
busy <= 1'b0; busy <= 1'b0;
state <= C_IDLE; state <= C_IDLE;