data/full_repos/permissive/197614074/MAX_POOL.v
1: b'%Error: data/full_repos/permissive/197614074/MAX_POOL.v:62: Cannot find file containing module: \'maxpool\'\n    maxpool Pooling (\n    ^~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/197614074,data/full_repos/permissive/197614074/maxpool\n             data/full_repos/permissive/197614074,data/full_repos/permissive/197614074/maxpool.v\n             data/full_repos/permissive/197614074,data/full_repos/permissive/197614074/maxpool.sv\n             maxpool\n             maxpool.v\n             maxpool.sv\n             obj_dir/maxpool\n             obj_dir/maxpool.v\n             obj_dir/maxpool.sv\n%Warning-WIDTH: data/full_repos/permissive/197614074/MAX_POOL.v:71: Operator ADD expects 32 bits on the RHS, but RHS\'s VARREF \'X_adr\' generates 8 bits.\n                                                                  : ... In instance MAX_POOL\n   adrressout = C_adr * HEIGHT * WIDTH / 4  + Y_adr * WIDTH/2 + X_adr;\n                                                              ^\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/197614074/MAX_POOL.v:71: Operator ASSIGN expects 8 bits on the Assign RHS, but Assign RHS\'s ADD generates 32 bits.\n                                                                  : ... In instance MAX_POOL\n   adrressout = C_adr * HEIGHT * WIDTH / 4  + Y_adr * WIDTH/2 + X_adr;\n              ^\n%Warning-WIDTH: data/full_repos/permissive/197614074/MAX_POOL.v:73: Operator EQ expects 32 bits on the LHS, but LHS\'s VARREF \'X_adr\' generates 8 bits.\n                                                                  : ... In instance MAX_POOL\n   if (X_adr ==  WIDTH/2) begin\n             ^~\n%Warning-WIDTH: data/full_repos/permissive/197614074/MAX_POOL.v:77: Operator EQ expects 32 bits on the LHS, but LHS\'s VARREF \'Y_adr\' generates 8 bits.\n                                                                  : ... In instance MAX_POOL\n   if (Y_adr ==  HEIGHT/2) begin\n             ^~\n%Warning-WIDTH: data/full_repos/permissive/197614074/MAX_POOL.v:81: Operator EQ expects 32 bits on the LHS, but LHS\'s VARREF \'C_adr\' generates 8 bits.\n                                                                  : ... In instance MAX_POOL\n   if (C_adr ==  CHANNEL) begin\n             ^~\n%Error: Exiting due to 1 error(s), 5 warning(s)\n'
module MAX_POOL #(
		parameter   integer WIDTH = 2,
		parameter 	integer HEIGHT = 2,
		parameter   integer CHANNEL = 3
    )
    (
    input 		[8 * WIDTH * HEIGHT * CHANNEL - 1 : 0]			indata,
	 input																	clk,
	 input 																	enable,
    output 	reg [7 : 0]												 	result,
	 output  reg [7:	0]													adrressout,
	 output	reg															maxpoolingdone,
	 output	reg 															maxpoolFIN
    );
    
    wire [8 - 1 : 0] dataArray[0 : CHANNEL - 1][0 : HEIGHT-1][0 : WIDTH - 1];
    wire [8 * 4 * HEIGHT * WIDTH - 1 : 0]data_Array;
	 reg 	[7:0] 	C_adr;
	 reg 	[7:0] 	X_adr;
	 reg 	[7:0] 	Y_adr;
    genvar 			i, j, k, m, n;
	 wire [20:0]	address;
	 wire [7:0] 	channel_ad;


    generate       
        for(i = 0; i < CHANNEL; i = i + 1) begin
            for(j = 0; j < HEIGHT; j = j + 1) begin
                for(k = 0; k < WIDTH; k = k + 1) begin
                    assign dataArray[i][j][k] = indata[(i * HEIGHT * WIDTH + j * HEIGHT + k)
						  * WIDTH + WIDTH +: 8];
                end
            end
        end      
    endgenerate
    
   initial begin
		C_adr	=	0;
		X_adr = 	0;
		Y_adr	=	0;
	end
    maxpool Pooling (
								 .in1(dataArray[C_adr][2*Y_adr][2*X_adr]), 
								 .in2(dataArray[C_adr][2*Y_adr][2*X_adr+1]), 
								 .in3(dataArray[C_adr][2*Y_adr+1][2*X_adr]), 
								 .in4(dataArray[C_adr][2*Y_adr+1][2*X_adr+1]), 
								 .op(result));

	always @ (posedge clk)begin
		if (enable) begin
			adrressout = C_adr * HEIGHT * WIDTH / 4  + Y_adr * WIDTH/2 + X_adr;
			X_adr = X_adr + 1; maxpoolingdone  = 1;
			if (X_adr	==		WIDTH/2) begin
				X_adr = 0;
				Y_adr = Y_adr + 1;
			end
			if (Y_adr	==		HEIGHT/2) begin
				Y_adr = 0;
				C_adr = C_adr + 1;
			end
			if (C_adr	==		CHANNEL) begin
				C_adr = 0;
				maxpoolFIN  =  1 ;
			end
		end
		else begin
			maxpoolingdone = 0;
			C_adr	=	0;
			X_adr = 	0;
			Y_adr	=	0;
		end
	end
endmodule
module MAX_POOL #(
		parameter   integer WIDTH = 2,
		parameter 	integer HEIGHT = 2,
		parameter   integer CHANNEL = 3
    )
    (
    input 		[8 * WIDTH * HEIGHT * CHANNEL - 1 : 0]			indata,
	 input																	clk,
	 input 																	enable,
    output 	reg [7 : 0]												 	result,
	 output  reg [7:	0]													adrressout,
	 output	reg															maxpoolingdone,
	 output	reg 															maxpoolFIN
    );

    
    wire [8 - 1 : 0] dataArray[0 : CHANNEL - 1][0 : HEIGHT-1][0 : WIDTH - 1];
    wire [8 * 4 * HEIGHT * WIDTH - 1 : 0]data_Array;
	 reg 	[7:0] 	C_adr;
	 reg 	[7:0] 	X_adr;
	 reg 	[7:0] 	Y_adr;
    genvar 			i, j, k, m, n;
	 wire [20:0]	address;
	 wire [7:0] 	channel_ad;


    generate       
        for(i = 0; i < CHANNEL; i = i + 1) begin
            for(j = 0; j < HEIGHT; j = j + 1) begin
                for(k = 0; k < WIDTH; k = k + 1) begin
                    assign dataArray[i][j][k] = indata[(i * HEIGHT * WIDTH + j * HEIGHT + k)
						  * WIDTH + WIDTH +: 8];
                end
            end
        end      
    endgenerate
    
   initial begin
		C_adr	=	0;
		X_adr = 	0;
		Y_adr	=	0;
	end
    maxpool Pooling (
								 .in1(dataArray[C_adr][2*Y_adr][2*X_adr]), 
								 .in2(dataArray[C_adr][2*Y_adr][2*X_adr+1]), 
								 .in3(dataArray[C_adr][2*Y_adr+1][2*X_adr]), 
								 .in4(dataArray[C_adr][2*Y_adr+1][2*X_adr+1]), 
								 .op(result));

	always @ (posedge clk)begin
		if (enable) begin
			adrressout = C_adr * HEIGHT * WIDTH / 4  + Y_adr * WIDTH/2 + X_adr;
			X_adr = X_adr + 1; maxpoolingdone  = 1;
			if (X_adr	==		WIDTH/2) begin
				X_adr = 0;
				Y_adr = Y_adr + 1;
			end
			if (Y_adr	==		HEIGHT/2) begin
				Y_adr = 0;
				C_adr = C_adr + 1;
			end
			if (C_adr	==		CHANNEL) begin
				C_adr = 0;
				maxpoolFIN  =  1 ;
			end
		end
		else begin
			maxpoolingdone = 0;
			C_adr	=	0;
			X_adr = 	0;
			Y_adr	=	0;
		end
	end
endmodule