data/full_repos/permissive/490316079/max_finder.v
1: b'%Warning-LITENDIAN: data/full_repos/permissive/490316079/max_finder.v:12: Little bit endian vector: MSB < LSB of bit range: 0:46\n    reg [0:INDATA_WIDTH-1]max;\n        ^\n                    ... Use "/* verilator lint_off LITENDIAN */" and lint_on around source to disable this message.\n%Warning-LITENDIAN: data/full_repos/permissive/490316079/max_finder.v:13: Little bit endian vector: MSB < LSB of bit range: 0:3\n    reg [0:3]index;\n        ^\n%Warning-LITENDIAN: data/full_repos/permissive/490316079/max_finder.v:14: Little bit endian vector: MSB < LSB of bit range: 0:3\n    reg [0:3] address;\n        ^\n%Warning-WIDTH: data/full_repos/permissive/490316079/max_finder.v:28: Operator NEQCASE expects 47 bits on the RHS, but RHS\'s CONST \'28\'bxxxxxxxxxxxxxxxxxxxxxxxxxxxx\' generates 28 bits.\n                                                                    : ... In instance max_finder\n          if(find_max && (!valid_input) && (found_max==0)&& (input_data!==28\'bx))\n                                                                       ^~~\n%Error: Exiting due to 4 warning(s)\n'
module max_finder #(parameter INDATA_WIDTH = 47, NN4=10, PREVLAYER_COUNT =10)(
    input clk,find_max,
    input [INDATA_WIDTH-1:0]input_data,
    input valid_input,
    input reset,
    output reg [3:0]predicted_output,
    output reg found_max
    );
    reg [0:INDATA_WIDTH-1]max;
    reg [0:3]index;
    reg [0:3] address;
    reg x,y;
    integer correction=0;
    always @(negedge clk)
    begin
        if(reset)
        begin
        address=0;
        index=0;
        y=0;
        x=0;
        correction=correction+1;
        found_max=0;
        end
          if(find_max && (!valid_input) && (found_max==0)&& (input_data!==28'bx))
          begin
             if(x==0)
             begin
                max=input_data;
                x=1;
                index=0;
             end
            if(max<input_data)
                begin
                max=input_data;
                index=address;
                end
             address = address+1;
             if(address==10)
             found_max=1;
          end
         if(found_max)
         begin
         if(correction==0)
         predicted_output= index;
         else if(correction >1)
         predicted_output= index-2;
         max=0;
         end
            
        end
endmodule
module max_finder #(parameter INDATA_WIDTH = 47, NN4=10, PREVLAYER_COUNT =10)(
    input clk,find_max,
    input [INDATA_WIDTH-1:0]input_data,
    input valid_input,
    input reset,
    output reg [3:0]predicted_output,
    output reg found_max
    );

    reg [0:INDATA_WIDTH-1]max;
    reg [0:3]index;
    reg [0:3] address;
    reg x,y;
    integer correction=0;
    always @(negedge clk)
    begin
        if(reset)
        begin
        address=0;
        index=0;
        y=0;
        x=0;
        correction=correction+1;
        found_max=0;
        end
          if(find_max && (!valid_input) && (found_max==0)&& (input_data!==28'bx))
          begin
             if(x==0)
             begin
                max=input_data;
                x=1;
                index=0;
             end
            if(max<input_data)
                begin
                max=input_data;
                index=address;
                end
             address = address+1;
             if(address==10)
             found_max=1;
          end
         if(found_max)
         begin
         if(correction==0)
         predicted_output= index;
         else if(correction >1)
         predicted_output= index-2;
         max=0;
         end
            
        end
endmodule