data/full_repos/permissive/503973366/RTL/Convolution/COUNTER/ACC_counter.v
1: b'%Warning-WIDTH: data/full_repos/permissive/503973366/RTL/Convolution/COUNTER/ACC_counter.v:73: Operator EQ expects 32 or 9 bits on the LHS, but LHS\'s VARREF \'acc_cnt\' generates 5 bits.\n                                                                                             : ... In instance ACC_COUNTER\n            if (acc_cnt==ACC_CNT_NUM-1) begin\n                       ^~\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/503973366/RTL/Convolution/COUNTER/ACC_counter.v:84: Operator EQ expects 32 or 9 bits on the LHS, but LHS\'s VARREF \'acc_cnt\' generates 5 bits.\n                                                                                             : ... In instance ACC_COUNTER\n    assign ofmap_valid_o = (acc_cnt==ACC_CNT_NUM-1) & psum_en_i & (!psum_cnt_done);     \n                                   ^~\n%Warning-WIDTH: data/full_repos/permissive/503973366/RTL/Convolution/COUNTER/ACC_counter.v:85: Operator EQ expects 32 or 9 bits on the LHS, but LHS\'s VARREF \'acc_cnt\' generates 5 bits.\n                                                                                             : ... In instance ACC_COUNTER\n    assign fifo_rst_n_o = (acc_cnt==ACC_CNT_NUM-1) & psum_cnt_done;  \n                                  ^~\n%Error: Exiting due to 3 warning(s)\n'
module ACC_COUNTER #(

    parameter PE_SIZE = 14,
    parameter WEIGHT_ROW_NUM = 70,
    parameter WEIGHT_COL_NUM = 294
    )
    (

    

    input   clk,
    input   rst_n,

    input   psum_en_i,

    output  ofmap_valid_o,
    output  fifo_rst_n_o
    );



    localparam PSUM_CNT_NUM = WEIGHT_ROW_NUM;
    localparam PSUM_CNT_WIDTH = $clog2(PSUM_CNT_NUM);
    localparam ACC_CNT_NUM = WEIGHT_COL_NUM / PE_SIZE;
    localparam ACC_CNT_WIDTH = $clog2(ACC_CNT_NUM);
    
    
    

    reg [PSUM_CNT_WIDTH-1:0] psum_cnt, psum_cnt_n;
    

    always @(posedge clk, negedge rst_n) begin
        if (!rst_n) begin
            psum_cnt <= {(PSUM_CNT_WIDTH){1'b0}};
        end else begin
            psum_cnt <= psum_cnt_n;
        end
    end
    

    always @(*) begin
        if (psum_cnt==PSUM_CNT_NUM) begin
            psum_cnt_n = 0;
        end else if (psum_en_i) begin
            psum_cnt_n = psum_cnt + 'd1;
        end else begin
            psum_cnt_n = psum_cnt;
        end
    end
    

    wire psum_cnt_done;
    assign psum_cnt_done = (psum_cnt==PSUM_CNT_NUM);
    
    
    

    reg [ACC_CNT_WIDTH-1:0] acc_cnt, acc_cnt_n;
    

    always @(posedge clk, negedge rst_n) begin
        if (!rst_n) begin
            acc_cnt <= {(ACC_CNT_WIDTH){1'b0}};
        end else begin
            acc_cnt <= acc_cnt_n;
        end
    end
    

    always @(*) begin
        if (psum_cnt_done) begin
            if (acc_cnt==ACC_CNT_NUM-1) begin
                acc_cnt_n = 'd0;
            end else begin
                acc_cnt_n = acc_cnt + 'd1;
            end
        end else begin
            acc_cnt_n = acc_cnt;
        end
    end
    

    assign ofmap_valid_o = (acc_cnt==ACC_CNT_NUM-1) & psum_en_i & (!psum_cnt_done);
    assign fifo_rst_n_o = (acc_cnt==ACC_CNT_NUM-1) & psum_cnt_done;
endmodule
module ACC_COUNTER #(

    parameter PE_SIZE = 14,
    parameter WEIGHT_ROW_NUM = 70,
    parameter WEIGHT_COL_NUM = 294
    )
    (

    

    input   clk,
    input   rst_n,

    input   psum_en_i,

    output  ofmap_valid_o,
    output  fifo_rst_n_o
    );




    localparam PSUM_CNT_NUM = WEIGHT_ROW_NUM;
    localparam PSUM_CNT_WIDTH = $clog2(PSUM_CNT_NUM);
    localparam ACC_CNT_NUM = WEIGHT_COL_NUM / PE_SIZE;
    localparam ACC_CNT_WIDTH = $clog2(ACC_CNT_NUM);
    
    
    

    reg [PSUM_CNT_WIDTH-1:0] psum_cnt, psum_cnt_n;
    

    always @(posedge clk, negedge rst_n) begin
        if (!rst_n) begin
            psum_cnt <= {(PSUM_CNT_WIDTH){1'b0}};
        end else begin
            psum_cnt <= psum_cnt_n;
        end
    end
    

    always @(*) begin
        if (psum_cnt==PSUM_CNT_NUM) begin
            psum_cnt_n = 0;
        end else if (psum_en_i) begin
            psum_cnt_n = psum_cnt + 'd1;
        end else begin
            psum_cnt_n = psum_cnt;
        end
    end
    

    wire psum_cnt_done;
    assign psum_cnt_done = (psum_cnt==PSUM_CNT_NUM);
    
    
    

    reg [ACC_CNT_WIDTH-1:0] acc_cnt, acc_cnt_n;
    

    always @(posedge clk, negedge rst_n) begin
        if (!rst_n) begin
            acc_cnt <= {(ACC_CNT_WIDTH){1'b0}};
        end else begin
            acc_cnt <= acc_cnt_n;
        end
    end
    

    always @(*) begin
        if (psum_cnt_done) begin
            if (acc_cnt==ACC_CNT_NUM-1) begin
                acc_cnt_n = 'd0;
            end else begin
                acc_cnt_n = acc_cnt + 'd1;
            end
        end else begin
            acc_cnt_n = acc_cnt;
        end
    end
    

    assign ofmap_valid_o = (acc_cnt==ACC_CNT_NUM-1) & psum_en_i & (!psum_cnt_done);
    assign fifo_rst_n_o = (acc_cnt==ACC_CNT_NUM-1) & psum_cnt_done;
endmodule