// data sram cs genvar ibank; genvar ics; generate for(ibank=0;ibank<BANK_NUM;ibank++) begin : bankA_cs_gen_bank for(ics=0;ics<16;ics++) begin : bankA_cs_gen always_ff @(posedge clk or negedge reset_n) begin if(!reset_n) begin bankA_dma_cs[ibank][ics] <= 1'b0; end else begin bankA_dma_cs[ibank][ics] <= (((bank_index[ibank] == val_rd_addr_i[`CH_LHS:`CH_RHS]) && val_rd_addr_i[`BANK_AB] == 1'b0 && val_rd_addr_i[`BANK_ADDR_ST:`BANK_ADDR_ED]==bank_addr[ics] && r_data_en) || ((bank_index[ibank] == val_wr_addr_i[`CH_LHS:`CH_RHS] && val_wr_addr_i[`BANK_AB] == 1'b0 && val_wr_addr_i[`BANK_ADDR_ST:`BANK_ADDR_ED]==bank_addr[ics]) && (w_data_en || (w_data_en_d3 && preproc_type == SHIFTADD)))) ? 1'b1 : 1'b0; end end end end endgenerate
// data sram we genvar iwe; generate for(ibank=0;ibank<BANK_NUM;ibank++) begin : bankA_we_gen_bank for(iwe=0;iwe<16;iwe++) begin : bankA_we_gen always_ff @(posedge clk or negedge reset_n) begin if(!reset_n) begin bankA_dma_we[ibank][iwe] <= 1'b0; end else begin bankA_dma_we[ibank][iwe] <= ((bank_index[ibank] == val_wr_addr_i[`CH_LHS:`CH_RHS] && val_wr_addr_i[`BANK_AB] == 1'b0 && val_wr_addr_i[`BANK_ADDR_ST:`BANK_ADDR_ED]==bank_addr[iwe]) && ((w_data_en && preproc_type != SHIFTADD) || (w_data_en_d3 && preproc_type == SHIFTADD))) ? 1'b1 : 1'b0; end end end end endgenerate
// data sram addr genvar iaddr; generate for(ibank=0;ibank<BANK_NUM;ibank++) begin : bankA_addr_gen_bank for(iaddr=0;iaddr<16;iaddr++) begin : bankA_addr_gen always_ff @(posedge clk or negedge reset_n) begin if(!reset_n) begin bankA_dma_addr[ibank][iaddr] <= 11'b0; end else begin bankA_dma_addr[ibank][iaddr] <= (val_rd_addr_i[`BANK_AB] == 1'b0 && bank_index[ibank] == val_rd_addr_i[`CH_LHS:`CH_RHS] && val_rd_addr_i[`BANK_ADDR_ST:`BANK_ADDR_ED]==bank_addr[iaddr] && r_data_en) ? val_rd_addr_i[`INBANK_ADDR_ST:`INBANK_ADDR_ED] : ((val_wr_addr_i[`BANK_AB] == 1'b0 && val_wr_addr_i[`BANK_ADDR_ST:`BANK_ADDR_ED]==bank_addr[iaddr]) && bank_index[ibank] == val_wr_addr_i[`CH_LHS:`CH_RHS] && (w_data_en || (w_data_en_d3 && preproc_type == SHIFTADD))) ? val_wr_addr_i[`INBANK_ADDR_ST:`INBANK_ADDR_ED] : 11'h0; end end end end endgenerate
// data sram din genvar idin, ibit; generate for(ibank=0;ibank<BANK_NUM;ibank++) begin : bankA_din_gen_bank for(idin=0;idin<16;idin++) begin : bankA_din_gen for(ibit=0;ibit<128;ibit++) begin : bankA_din_bit_gen always_ff @(posedge clk or negedge reset_n) begin if(!reset_n) begin bankA_dma_din[ibank][idin][ibit] <= 1'b0; end else if (val_wr_addr_i[`BANK_AB] == 1'b0 && val_wr_addr_i[`BANK_ADDR_ST:`BANK_ADDR_ED]==bank_addr[idin]) begin bankA_dma_din[ibank][idin][ibit] <= bank_index[ibank] == val_wr_addr_i[`CH_LHS:`CH_RHS] ? ((w_data_en && preproc_type == WRITETHROUGH) ? val_wr_data_i[ibit] : (w_data_en && preproc_type == SHIFT) ? data_a_after_shift_w[ibit] : (w_data_en_d3 && preproc_type == SHIFTADD) ? shift_add_result_w[ibit] : 1'b0) : 1'b0; end else begin bankA_dma_din[ibank][idin][ibit] <= 1'b0; end end end end end endgenerate
// data sram strb genvar istrb, isbit; generate for(ibank=0;ibank<BANK_NUM;ibank++) begin : bankA_strb_gen_bank for(istrb=0;istrb<16;istrb++) begin : bankA_strb_gen for(isbit=0;isbit<16;isbit++) begin : bankA_strb_bit_gen always_ff @(posedge clk or negedge reset_n) begin if(!reset_n) begin bankA_dma_byte_en[ibank][istrb][isbit] <= 1'b0; end else if (val_wr_addr_i[`BANK_AB] == 1'b0 && val_wr_addr_i[`BANK_ADDR_ST:`BANK_ADDR_ED]==bank_addr[istrb]) begin bankA_dma_byte_en[ibank][istrb][isbit] <= bank_index[ibank] == val_wr_addr_i[`CH_LHS:`CH_RHS] ? (((w_data_en && preproc_type == WRITETHROUGH) || (w_data_en && preproc_type == SHIFT) || (w_data_en_d3 && preproc_type == SHIFTADD)) ? val_wr_strb_i[isbit] : 1'b0) : 1'b0; end else begin bankA_dma_byte_en[ibank][istrb][isbit] <= 1'b0; end end end end end endgenerate
//***************************************** // data sram bankB cs/we/addr/din/strb //***************************************** // data sram cs genvar ibcs; generate for(ibank=0;ibank<BANK_NUM;ibank++) begin : bankB_cs_gen_bank for(ibcs=0;ibcs<16;ibcs++) begin : bankB_cs_gen always_ff @(posedge clk or negedge reset_n) begin if(!reset_n) begin bankB_dma_cs[ibank][ibcs] <= 1'b0; end else begin bankB_dma_cs[ibank][ibcs] <= (((bank_index[ibank] == val_rd_addr_i[`CH_LHS:`CH_RHS]) && val_rd_addr_i[`BANK_AB] == 1'b1 && val_rd_addr_i[`BANK_ADDR_ST:`BANK_ADDR_ED]==bank_addr[ibcs] && r_data_en) || ((bank_index[ibank] == val_wr_addr_i[`CH_LHS:`CH_RHS] && val_wr_addr_i[`BANK_AB] == 1'b1 && val_wr_addr_i[`BANK_ADDR_ST:`BANK_ADDR_ED]==bank_addr[ibcs]) && (w_data_en || (w_data_en_d3 && preproc_type == SHIFTADD)))) ? 1'b1 : 1'b0; end end end end endgenerate
// data sram we genvar ibwe; generate for(ibank=0;ibank<BANK_NUM;ibank++) begin : bankB_we_gen_bank for(ibwe=0;ibwe<16;ibwe++) begin : bankB_we_gen always_ff @(posedge clk or negedge reset_n) begin if(!reset_n) begin bankB_dma_we[ibank][ibwe] <= 1'b0; end else begin bankB_dma_we[ibank][ibwe] <= ((bank_index[ibank] == val_wr_addr_i[`CH_LHS:`CH_RHS] && val_wr_addr_i[`BANK_AB] == 1'b1 && val_wr_addr_i[`BANK_ADDR_ST:`BANK_ADDR_ED]==bank_addr[ibwe]) && ((w_data_en && preproc_type != SHIFTADD) || (w_data_en_d3 && preproc_type == SHIFTADD))) ? 1'b1 : 1'b0; end end end end endgenerate
// data sram addr genvar ibaddr; generate for(ibank=0;ibank<BANK_NUM;ibank++) begin : bankB_addr_gen_bank for(ibaddr=0;ibaddr<16;ibaddr++) begin : bankB_addr_gen always_ff @(posedge clk or negedge reset_n) begin if(!reset_n) begin bankB_dma_addr[ibank][ibaddr] <= 11'b0; end else begin bankB_dma_addr[ibank][ibaddr] <= (val_rd_addr_i[`BANK_AB] == 1'b1 && bank_index[ibank] == val_rd_addr_i[`CH_LHS:`CH_RHS] && val_rd_addr_i[`BANK_ADDR_ST:`BANK_ADDR_ED]==bank_addr[ibaddr] && r_data_en) ? val_rd_addr_i[`INBANK_ADDR_ST:`INBANK_ADDR_ED] : ((val_wr_addr_i[`BANK_AB] == 1'b1 && val_wr_addr_i[`BANK_ADDR_ST:`BANK_ADDR_ED]==bank_addr[ibaddr]) && bank_index[ibank] == val_wr_addr_i[`CH_LHS:`CH_RHS] && (w_data_en || (w_data_en_d3 && preproc_type == SHIFTADD))) ? val_wr_addr_i[`INBANK_ADDR_ST:`INBANK_ADDR_ED] : 11'h0; end end end end endgenerate
// data sram din genvar ibdin, ibbit; generate for(ibank=0;ibank<BANK_NUM;ibank++) begin : bankB_din_gen_bank for(ibdin=0;ibdin<16;ibdin++) begin : bankB_din_gen for(ibbit=0;ibbit<128;ibbit++) begin : bankB_din_bit_gen always_ff @(posedge clk or negedge reset_n) begin if(!reset_n) begin bankB_dma_din[ibank][ibdin][ibbit] <= 1'b0; end else if (val_wr_addr_i[`BANK_AB] == 1'b1 && val_wr_addr_i[`BANK_ADDR_ST:`BANK_ADDR_ED]==bank_addr[ibdin]) begin bankB_dma_din[ibank][ibdin][ibbit] <= bank_index[ibank] == val_wr_addr_i[`CH_LHS:`CH_RHS] ? ((w_data_en && preproc_type == WRITETHROUGH) ? val_wr_data_i[ibbit] : (w_data_en && preproc_type == SHIFT) ? data_a_after_shift_w[ibbit] : (w_data_en_d3 && preproc_type == SHIFTADD) ? shift_add_result_w[ibbit] : 1'b0) : 1'b0; end else begin bankB_dma_din[ibank][ibdin][ibbit] <= 1'b0; end end end end end endgenerate
// data sram strb genvar ibstrb, ibsbit; generate for(ibank=0;ibank<BANK_NUM;ibank++) begin : bankB_strb_gen_bank for(ibstrb=0;ibstrb<16;ibstrb++) begin : bankB_strb_gen for(ibsbit=0;ibsbit<16;ibsbit++) begin : bankB_strb_bit_gen always_ff @(posedge clk or negedge reset_n) begin if(!reset_n) begin bankB_dma_byte_en[ibank][ibstrb][ibsbit] <= 1'b0; end else if (val_wr_addr_i[`BANK_AB] == 1'b1 && val_wr_addr_i[`BANK_ADDR_ST:`BANK_ADDR_ED]==bank_addr[ibstrb]) begin bankB_dma_byte_en[ibank][ibstrb][ibsbit] <= bank_index[ibank] == val_wr_addr_i[`CH_LHS:`CH_RHS] ? (((w_data_en && preproc_type == WRITETHROUGH) || (w_data_en && preproc_type == SHIFT) || (w_data_en_d3 && preproc_type == SHIFTADD)) ? val_wr_strb_i[ibsbit] : 1'b0) : 1'b0; end else begin bankB_dma_byte_en[ibank][ibstrb][ibsbit] <= 1'b0; end end end end end endgenerate