data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v
1: b'%Warning-WIDTH: data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v:101: Operator LT expects 10 bits on the RHS, but RHS\'s VARREF \'width_paddle\' generates 7 bits.\n                                                                                                     : ... In instance PxsFrontonGame\n  Paddle <= (PX >= 0 && PX < width_paddle) && (PY >= 0 && PY < height_paddle);\n                           ^\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v:123: Operator SUB expects 32 or 10 bits on the RHS, but RHS\'s VARREF \'SPEED\' generates 5 bits.\n                                                                                                     : ... In instance PxsFrontonGame\n    if (x_logo>=x_logo_max  || x_logo>=(VISIBLECOLS-SPEED-border) || x_logo<border || x_logo<SPEED) \n                                                   ^\n%Warning-WIDTH: data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v:123: Operator LT expects 10 bits on the RHS, but RHS\'s VARREF \'SPEED\' generates 5 bits.\n                                                                                                     : ... In instance PxsFrontonGame\n    if (x_logo>=x_logo_max  || x_logo>=(VISIBLECOLS-SPEED-border) || x_logo<border || x_logo<SPEED) \n                                                                                            ^\n%Warning-WIDTH: data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v:135: Operator LT expects 10 bits on the RHS, but RHS\'s VARREF \'SPEED\' generates 5 bits.\n                                                                                                     : ... In instance PxsFrontonGame\n    if (y_logo<border || y_logo<SPEED)   \n                               ^\n%Warning-WIDTH: data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v:139: Operator SUB expects 32 or 10 bits on the RHS, but RHS\'s VARREF \'SPEED\' generates 5 bits.\n                                                                                                     : ... In instance PxsFrontonGame\n    if (y_logo>=y_logo_max  || y_logo>=(VISIBLEROWS-SPEED-border))   \n                                                   ^\n%Warning-WIDTH: data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v:148: Operator SUB expects 32 or 10 bits on the RHS, but RHS\'s VARREF \'SPEED\' generates 5 bits.\n                                                                                                     : ... In instance PxsFrontonGame\n    if (y_logo>= y_paddle-SPEED-height_paddle && x_logo> x_paddle && x_logo<x_paddle+ width_paddle)   \n                         ^\n%Warning-WIDTH: data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v:148: Operator ADD expects 10 bits on the RHS, but RHS\'s VARREF \'width_paddle\' generates 7 bits.\n                                                                                                     : ... In instance PxsFrontonGame\n    if (y_logo>= y_paddle-SPEED-height_paddle && x_logo> x_paddle && x_logo<x_paddle+ width_paddle)   \n                                                                                    ^\n%Warning-WIDTH: data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v:158: Operator ADD expects 10 bits on the RHS, but RHS\'s VARREF \'SPEED\' generates 5 bits.\n                                                                                                     : ... In instance PxsFrontonGame\n     x_logo = x_logo+SPEED;\n                    ^\n%Warning-WIDTH: data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v:160: Operator SUB expects 10 bits on the RHS, but RHS\'s VARREF \'SPEED\' generates 5 bits.\n                                                                                                     : ... In instance PxsFrontonGame\n     x_logo = x_logo-SPEED;\n                    ^\n%Warning-WIDTH: data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v:163: Operator ADD expects 10 bits on the RHS, but RHS\'s VARREF \'SPEED\' generates 5 bits.\n                                                                                                     : ... In instance PxsFrontonGame\n     y_logo = y_logo+SPEED;\n                    ^\n%Warning-WIDTH: data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v:165: Operator SUB expects 10 bits on the RHS, but RHS\'s VARREF \'SPEED\' generates 5 bits.\n                                                                                                     : ... In instance PxsFrontonGame\n     y_logo = y_logo-SPEED;\n                    ^\n%Warning-UNSIGNED: data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v:100: Comparison is constant due to unsigned arithmetic\n                                                                                                        : ... In instance PxsFrontonGame\n  Ball<= (BX >= 0 && BX < width_logo) && (BY >= 0 && BY < height_logo);\n             ^~\n%Warning-UNSIGNED: data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v:100: Comparison is constant due to unsigned arithmetic\n                                                                                                        : ... In instance PxsFrontonGame\n  Ball<= (BX >= 0 && BX < width_logo) && (BY >= 0 && BY < height_logo);\n                                             ^~\n%Warning-UNSIGNED: data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v:101: Comparison is constant due to unsigned arithmetic\n                                                                                                        : ... In instance PxsFrontonGame\n  Paddle <= (PX >= 0 && PX < width_paddle) && (PY >= 0 && PY < height_paddle);\n                ^~\n%Warning-UNSIGNED: data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v:101: Comparison is constant due to unsigned arithmetic\n                                                                                                        : ... In instance PxsFrontonGame\n  Paddle <= (PX >= 0 && PX < width_paddle) && (PY >= 0 && PY < height_paddle);\n                                                  ^~\n%Warning-UNSIGNED: data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v:123: Comparison is constant due to unsigned arithmetic\n                                                                                                        : ... In instance PxsFrontonGame\n    if (x_logo>=x_logo_max  || x_logo>=(VISIBLECOLS-SPEED-border) || x_logo<border || x_logo<SPEED) \n                                                                           ^\n%Warning-UNSIGNED: data/full_repos/permissive/127044786/blocks/Display/iPxs/Overlay/PxsFrontonGame.v:135: Comparison is constant due to unsigned arithmetic\n                                                                                                        : ... In instance PxsFrontonGame\n    if (y_logo<border || y_logo<SPEED)   \n              ^\n%Error: Exiting due to 17 warning(s)\n'
module PxsFrontonGame (
                input wire        px_clk,
				input wire		  rightButton,
				input wire 		  leftButton,
                input wire [22:0] VGAStr_i,
				output reg [7:0]  counter,
                output reg [25:0] RGBStr_o
               );


`define Active 0:0
`define VS 1:1
`define HS 2:2
`define YC 12:3
`define XC 22:13
`define R 23:23
`define G 24:24
`define B 25:25
`define RGB 25:23
   

    parameter width_logo = 8;
    parameter height_logo = 10;



    parameter height_paddle = 8;

	

    parameter border = 0;
    parameter [9:0] x_logo_min = border;
    parameter [9:0] x_logo_max = 640 - width_logo - border;
    parameter [9:0] y_logo_min = border;
    parameter [9:0] y_logo_max = 480 - height_logo - border;


	parameter [9:0] VISIBLECOLS = 640;
	parameter [9:0] VISIBLEROWS = 480;


	reg [4:0] SPEED;
	reg dx,dy;
	wire endframe;
	reg [9:0] x_logo, y_logo, x_paddle, y_paddle;
	reg [9:0] BX, BY, PX, PY;
	reg [22:0] AuxStr1, AuxStr2;
	reg [6:0] width_paddle;
	reg Ball, Paddle, left, right;
	

	initial
    begin
		x_logo <= (640 - width_logo)/4;
		y_logo <= (480 - height_logo)/2;
		x_paddle <= 320;
		y_paddle <= 480 - 20;
		width_paddle<= 64;
		counter<=0;
		left<=0;
		right<=0;
		dx <=0;
		dy <=0;
		SPEED <= 2;
    end
	
	assign endframe = (VGAStr_i[`XC]==VISIBLECOLS-1 && VGAStr_i[`YC]==VISIBLEROWS-1)? 1'b1 : 1'b0 ;

	always @(posedge px_clk)
    begin
		BX <= VGAStr_i[`XC]-x_logo; PX<= VGAStr_i[`XC]-x_paddle;
		BY <= VGAStr_i[`YC]-y_logo; PY <= VGAStr_i[`YC]-y_paddle;
		AuxStr1[`HS]<=VGAStr_i[`HS]; AuxStr1[`VS]<=VGAStr_i[`VS];
		AuxStr1[`XC]<=VGAStr_i[`XC]; AuxStr1[`YC]<=VGAStr_i[`YC];
		AuxStr1[`Active]<=VGAStr_i[`Active];
	end

	always @(posedge px_clk)
    begin
		Ball<= (BX >= 0 && BX < width_logo) && (BY >= 0 && BY < height_logo);
		Paddle <= (PX >= 0 && PX < width_paddle) && (PY >= 0 && PY < height_paddle);
		AuxStr2[`HS]<=AuxStr1[`HS]; AuxStr2[`VS]<=AuxStr1[`VS];
		AuxStr2[`XC]<=AuxStr1[`XC]; AuxStr2[`YC]<=AuxStr1[`YC];
		AuxStr2[`Active]<=AuxStr1[`Active];
	end		

	always @(posedge px_clk)
    begin
		RGBStr_o[`HS]<=AuxStr2[`HS]; RGBStr_o[`VS]<=AuxStr2[`VS];
		RGBStr_o[`XC]<=AuxStr2[`XC]; RGBStr_o[`YC]<=AuxStr2[`YC];
		RGBStr_o[`Active]<=AuxStr2[`Active];
		
		RGBStr_o[`RGB]<= (Ball || Paddle)? 3'b111:3'b001;

	end
	

	always @(posedge px_clk)
    begin
		if (endframe)
		begin

				if (x_logo>=x_logo_max  || x_logo>=(VISIBLECOLS-SPEED-border) || x_logo<border || x_logo<SPEED) 
				begin	
					dx = ~ dx;


				end






				if (y_logo<border || y_logo<SPEED)			
				begin
					dy = ~ dy;
				end
				if (y_logo>=y_logo_max  || y_logo>=(VISIBLEROWS-SPEED-border))			
				begin
					dy = ~ dy;
					counter<=counter-1;



				end

				if (y_logo>= y_paddle-SPEED-height_paddle && x_logo> x_paddle && x_logo<x_paddle+ width_paddle)			
				begin
					dy = ~ dy;
					counter<=counter+1;


				end


				if (dx==0)
					x_logo = x_logo+SPEED;
				else 
					x_logo = x_logo-SPEED;

				if (dy==0)
					y_logo = y_logo+SPEED;
				else 
					y_logo = y_logo-SPEED;






						

				if (left==1)
				
					x_paddle = x_paddle-2;					
				else
					if (right==1)
						x_paddle = x_paddle+2;



		end		
    end
	
	

	always @(posedge px_clk)
    begin
		if (leftButton==1)
			left <= 1;
		else 
			left<=0;
			
		if (rightButton)
			right<=1;
		else
			right<=0;
	end
	
endmodule
module PxsFrontonGame (
                input wire        px_clk,
				input wire		  rightButton,
				input wire 		  leftButton,
                input wire [22:0] VGAStr_i,
				output reg [7:0]  counter,
                output reg [25:0] RGBStr_o
               );



`define Active 0:0
`define VS 1:1
`define HS 2:2
`define YC 12:3
`define XC 22:13
`define R 23:23
`define G 24:24
`define B 25:25
`define RGB 25:23
   

    parameter width_logo = 8;
    parameter height_logo = 10;



    parameter height_paddle = 8;

	

    parameter border = 0;
    parameter [9:0] x_logo_min = border;
    parameter [9:0] x_logo_max = 640 - width_logo - border;
    parameter [9:0] y_logo_min = border;
    parameter [9:0] y_logo_max = 480 - height_logo - border;


	parameter [9:0] VISIBLECOLS = 640;
	parameter [9:0] VISIBLEROWS = 480;


	reg [4:0] SPEED;
	reg dx,dy;
	wire endframe;
	reg [9:0] x_logo, y_logo, x_paddle, y_paddle;
	reg [9:0] BX, BY, PX, PY;
	reg [22:0] AuxStr1, AuxStr2;
	reg [6:0] width_paddle;
	reg Ball, Paddle, left, right;
	

	initial
    begin
		x_logo <= (640 - width_logo)/4;
		y_logo <= (480 - height_logo)/2;
		x_paddle <= 320;
		y_paddle <= 480 - 20;
		width_paddle<= 64;
		counter<=0;
		left<=0;
		right<=0;
		dx <=0;
		dy <=0;
		SPEED <= 2;
    end
	
	assign endframe = (VGAStr_i[`XC]==VISIBLECOLS-1 && VGAStr_i[`YC]==VISIBLEROWS-1)? 1'b1 : 1'b0 ;

	always @(posedge px_clk)
    begin
		BX <= VGAStr_i[`XC]-x_logo; PX<= VGAStr_i[`XC]-x_paddle;
		BY <= VGAStr_i[`YC]-y_logo; PY <= VGAStr_i[`YC]-y_paddle;
		AuxStr1[`HS]<=VGAStr_i[`HS]; AuxStr1[`VS]<=VGAStr_i[`VS];
		AuxStr1[`XC]<=VGAStr_i[`XC]; AuxStr1[`YC]<=VGAStr_i[`YC];
		AuxStr1[`Active]<=VGAStr_i[`Active];
	end

	always @(posedge px_clk)
    begin
		Ball<= (BX >= 0 && BX < width_logo) && (BY >= 0 && BY < height_logo);
		Paddle <= (PX >= 0 && PX < width_paddle) && (PY >= 0 && PY < height_paddle);
		AuxStr2[`HS]<=AuxStr1[`HS]; AuxStr2[`VS]<=AuxStr1[`VS];
		AuxStr2[`XC]<=AuxStr1[`XC]; AuxStr2[`YC]<=AuxStr1[`YC];
		AuxStr2[`Active]<=AuxStr1[`Active];
	end		

	always @(posedge px_clk)
    begin
		RGBStr_o[`HS]<=AuxStr2[`HS]; RGBStr_o[`VS]<=AuxStr2[`VS];
		RGBStr_o[`XC]<=AuxStr2[`XC]; RGBStr_o[`YC]<=AuxStr2[`YC];
		RGBStr_o[`Active]<=AuxStr2[`Active];
		
		RGBStr_o[`RGB]<= (Ball || Paddle)? 3'b111:3'b001;

	end
	

	always @(posedge px_clk)
    begin
		if (endframe)
		begin

				if (x_logo>=x_logo_max  || x_logo>=(VISIBLECOLS-SPEED-border) || x_logo<border || x_logo<SPEED) 
				begin	
					dx = ~ dx;


				end






				if (y_logo<border || y_logo<SPEED)			
				begin
					dy = ~ dy;
				end
				if (y_logo>=y_logo_max  || y_logo>=(VISIBLEROWS-SPEED-border))			
				begin
					dy = ~ dy;
					counter<=counter-1;



				end

				if (y_logo>= y_paddle-SPEED-height_paddle && x_logo> x_paddle && x_logo<x_paddle+ width_paddle)			
				begin
					dy = ~ dy;
					counter<=counter+1;


				end


				if (dx==0)
					x_logo = x_logo+SPEED;
				else 
					x_logo = x_logo-SPEED;

				if (dy==0)
					y_logo = y_logo+SPEED;
				else 
					y_logo = y_logo-SPEED;






						

				if (left==1)
				
					x_paddle = x_paddle-2;					
				else
					if (right==1)
						x_paddle = x_paddle+2;



		end		
    end
	
	

	always @(posedge px_clk)
    begin
		if (leftButton==1)
			left <= 1;
		else 
			left<=0;
			
		if (rightButton)
			right<=1;
		else
			right<=0;
	end
	
endmodule