diff --git a/sync_rtl/top/mlkem_top.v b/sync_rtl/top/mlkem_top.v index 61463d1..d926c02 100644 --- a/sync_rtl/top/mlkem_top.v +++ b/sync_rtl/top/mlkem_top.v @@ -99,7 +99,26 @@ module mlkem_top #( localparam PA_AW = 12; // bank_a addr width (4096) localparam PSE_AW = 11; // bank_se addr width (2048) localparam PT_AW = 10; // bank_t addr width (1024) - reg [11:0] bank_a [0:(1<= slot_t_rt) dbg_coeff_r <= bank_t [dbg_t_addr[PT_AW-1:0]]; else if (dbg_slot_i >= slot_s_rt) dbg_coeff_r <= bank_se[dbg_se_addr[PSE_AW-1:0]]; - else dbg_coeff_r <= bank_a [dbg_a_addr[PA_AW-1:0]]; + else dbg_coeff_r <= ba_rd_data; // bank_a (registered in sd_bram) end assign dbg_coeff_o = dbg_coeff_r; @@ -493,8 +514,8 @@ module mlkem_top #( // poly_mul one cycle later (pm_valid delayed 1 cyc), like ST_N. wire [13:0] pm_a_full = m_aslot*256 + m_ld[7:0]; wire [13:0] pm_b_full = m_j*256 + m_ld[7:0]; - reg [11:0] pm_a_rd, pm_b_rd; // registered bank reads (sd_bram timing) - wire [11:0] pm_a_in = pm_a_rd; + reg [11:0] pm_b_rd; // registered bank_se read (sd_bram timing) + wire [11:0] pm_a_in = ba_rd_data; // bank_a sd_bram registered read wire [11:0] pm_b_in = pm_b_rd; poly_mul_sync u_pmul ( @@ -579,7 +600,6 @@ module mlkem_top #( m_loading <= 1'b0; m_pending <= 1'b0; pm_valid <= 1'b0; - pm_a_rd <= 12'd0; pm_b_rd <= 12'd0; m_acc_rd <= 12'd0; e_poly <= 3'd0; @@ -647,9 +667,11 @@ module mlkem_top #( a_busy <= 1'b1; end - // store each output coefficient only while busy (ignore stale last coeff from prior poly) + // store each output coefficient only while busy (ignore stale + // last coeff from prior poly). The bank_a write itself is the + // combinational ba_we/ba_wa/ba_wd assigns above; here we only + // advance the write index and (i,j) bookkeeping. if (a_busy && snt_vo && snt_ack) begin - bank_a[(a_slot*256 + a_widx) & ((1<