data/full_repos/permissive/426823752/ball.sv
1: b'%Warning-WIDTH: data/full_repos/permissive/426823752/ball.sv:58: Operator ASSIGNDLY expects 32 bits on the Assign RHS, but Assign RHS\'s VARREF \'Block_Array\' generates 33 bits.\n                                                               : ... In instance ball\n    Blocks<=Block_Array;\n          ^~\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/426823752/ball.sv:164: Operator XOR expects 32 bits on the LHS, but LHS\'s CONST \'10\'h0\' generates 10 bits.\n                                                                : ... In instance ball\n     BlockX = (10\'b0000000000^((i%8)*80+40));\n                             ^\n%Warning-WIDTH: data/full_repos/permissive/426823752/ball.sv:164: Operator ASSIGN expects 10 bits on the Assign RHS, but Assign RHS\'s XOR generates 32 bits.\n                                                                : ... In instance ball\n     BlockX = (10\'b0000000000^((i%8)*80+40));\n            ^\n%Warning-WIDTH: data/full_repos/permissive/426823752/ball.sv:165: Operator XOR expects 32 bits on the LHS, but LHS\'s CONST \'10\'h0\' generates 10 bits.\n                                                                : ... In instance ball\n     BlockY = (10\'b0000000000^(10+20*(i>>3)));\n                             ^\n%Warning-WIDTH: data/full_repos/permissive/426823752/ball.sv:165: Operator ASSIGN expects 10 bits on the Assign RHS, but Assign RHS\'s XOR generates 32 bits.\n                                                                : ... In instance ball\n     BlockY = (10\'b0000000000^(10+20*(i>>3)));\n            ^\n%Error-PROCASSWIRE: data/full_repos/permissive/426823752/ball.sv:57: Procedural assignment to wire, perhaps intended var (IEEE 1800-2017 6.5): \'Bar_Reset\'\n                                                                   : ... In instance ball\n    Bar_Reset <= 1\'b1;\n    ^~~~~~~~~\n%Error-PROCASSWIRE: data/full_repos/permissive/426823752/ball.sv:58: Procedural assignment to wire, perhaps intended var (IEEE 1800-2017 6.5): \'Blocks\'\n                                                                   : ... In instance ball\n    Blocks<=Block_Array;\n    ^~~~~~\n%Error-PROCASSWIRE: data/full_repos/permissive/426823752/ball.sv:60: Procedural assignment to wire, perhaps intended var (IEEE 1800-2017 6.5): \'lives\'\n                                                                   : ... In instance ball\n    lives <= 3;  \n    ^~~~~\n%Error-PROCASSWIRE: data/full_repos/permissive/426823752/ball.sv:61: Procedural assignment to wire, perhaps intended var (IEEE 1800-2017 6.5): \'curr_score\'\n                                                                   : ... In instance ball\n    curr_score <= 0;\n    ^~~~~~~~~~\n%Error-PROCASSWIRE: data/full_repos/permissive/426823752/ball.sv:66: Procedural assignment to wire, perhaps intended var (IEEE 1800-2017 6.5): \'Bar_Reset\'\n                                                                   : ... In instance ball\n    Bar_Reset <= 1\'b0;\n    ^~~~~~~~~\n%Error-PROCASSWIRE: data/full_repos/permissive/426823752/ball.sv:73: Procedural assignment to wire, perhaps intended var (IEEE 1800-2017 6.5): \'Bar_Reset\'\n                                                                   : ... In instance ball\n     Bar_Reset <= 1\'b1;\n     ^~~~~~~~~\n%Error-PROCASSWIRE: data/full_repos/permissive/426823752/ball.sv:77: Procedural assignment to wire, perhaps intended var (IEEE 1800-2017 6.5): \'lives\'\n                                                                   : ... In instance ball\n     lives <= lives - 1;  \n     ^~~~~\n%Error-PROCASSWIRE: data/full_repos/permissive/426823752/ball.sv:178: Procedural assignment to wire, perhaps intended var (IEEE 1800-2017 6.5): \'Blocks\'\n                                                                    : ... In instance ball\n   Blocks[i]<=0;\n   ^~~~~~\n%Error-PROCASSWIRE: data/full_repos/permissive/426823752/ball.sv:179: Procedural assignment to wire, perhaps intended var (IEEE 1800-2017 6.5): \'curr_score\'\n                                                                    : ... In instance ball\n   curr_score <= curr_score + 1;\n   ^~~~~~~~~~\n%Error-PROCASSWIRE: data/full_repos/permissive/426823752/ball.sv:189: Procedural assignment to wire, perhaps intended var (IEEE 1800-2017 6.5): \'Blocks\'\n                                                                    : ... In instance ball\n   Blocks[i] <=0;\n   ^~~~~~\n%Error-PROCASSWIRE: data/full_repos/permissive/426823752/ball.sv:190: Procedural assignment to wire, perhaps intended var (IEEE 1800-2017 6.5): \'curr_score\'\n                                                                    : ... In instance ball\n   curr_score <= curr_score + 1;\n   ^~~~~~~~~~\n%Error-PROCASSWIRE: data/full_repos/permissive/426823752/ball.sv:202: Procedural assignment to wire, perhaps intended var (IEEE 1800-2017 6.5): \'Blocks\'\n                                                                    : ... In instance ball\n   Blocks[i] <=0;\n   ^~~~~~\n%Error-PROCASSWIRE: data/full_repos/permissive/426823752/ball.sv:203: Procedural assignment to wire, perhaps intended var (IEEE 1800-2017 6.5): \'curr_score\'\n                                                                    : ... In instance ball\n   curr_score <= curr_score + 1;\n   ^~~~~~~~~~\n%Error-PROCASSWIRE: data/full_repos/permissive/426823752/ball.sv:213: Procedural assignment to wire, perhaps intended var (IEEE 1800-2017 6.5): \'Blocks\'\n                                                                    : ... In instance ball\n   Blocks[i] <=0;\n   ^~~~~~\n%Error-PROCASSWIRE: data/full_repos/permissive/426823752/ball.sv:214: Procedural assignment to wire, perhaps intended var (IEEE 1800-2017 6.5): \'curr_score\'\n                                                                    : ... In instance ball\n   curr_score <= curr_score + 1;\n   ^~~~~~~~~~\n%Error: Exiting due to 15 error(s), 5 warning(s)\n'
module  ball ( input Reset, frame_clk,
					input [07:00] keycode,
					input [09:00] BarX, BarY, Bar_Sizex, Bar_Sizey,
					input [09:00] Block_SizeX, Block_SizeY,
					input [32:00] Block_Array,
					input 		  start_menu,
               output [09:00] BallX, BallY, BallS,
				   output [31:00] Blocks,
					output 			Bar_Reset,
					output [01:00] lives,
					output			lives_zero,
					output [15:00] curr_score);

	logic [9:0] Ball_X_Pos, Ball_X_Motion, Ball_Y_Pos, Ball_Y_Motion, Ball_Size;

	parameter [9:0] Ball_X_Start=320;
	parameter [9:0] Ball_Y_Start=452;
	parameter [9:0] Ball_X_Min=4;
	parameter [9:0] Ball_X_Max=635;
	parameter [9:0] Ball_Y_Min=4;
	parameter [9:0] Ball_Y_Max=475;
	parameter [9:0] Ball_X_Step=2;
	parameter [9:0] Ball_X_Step2=2;
	parameter [9:0] Ball_Y_Step=3;
	logic Ball_Reset;
	logic[9:0] BlockX, BlockY;


	assign Ball_Size = 4;
	logic moved;
	assign lives_zero = (lives == 0);

    always_ff @ (posedge Reset or posedge frame_clk )
    begin: Move_Ball
			if (Reset)
			begin
				Ball_Y_Motion <= 10'd0;
				Ball_X_Motion <= 10'd0;
				Ball_Y_Pos <= Ball_Y_Start;
				Ball_X_Pos <= Ball_X_Start;
				Ball_Reset<= 1'b1;
				Bar_Reset <= 1'b1;
				Blocks<=Block_Array;
				moved<=1'b0;
				lives <= 3;
				curr_score <= 0;
			end
			else

			begin
				Bar_Reset <= 1'b0;
				moved<=1'b0;
				if ( (Ball_Y_Pos + Ball_Size) >= Ball_Y_Max && ~Ball_Reset)
				begin
					Ball_Reset<=1'b1 ;
					Ball_Y_Motion <= 10'd0;
				   	Ball_X_Motion <= 10'd0;
					Bar_Reset <= 1'b1;
				   	Ball_Y_Pos <= Ball_Y_Start;
				   	Ball_X_Pos <= BarX;
					moved<=1'b1;
					lives <= lives - 1;
				end


				else if(keycode == 8'h2c && Ball_Reset && ~start_menu)
				begin
				 	Ball_X_Motion <=Ball_X_Step;
				 	Ball_Y_Motion <=-Ball_Y_Step;
				 	Ball_Reset <= 1'b0;
				 	Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
				 	Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
				 	moved<=1'b1;
				end
				else if(Ball_Reset)
				begin
					Ball_Y_Pos <= Ball_Y_Start;
					Ball_X_Pos <= BarX;
					moved<=1'b1;
				 end

				else if ( (Ball_X_Pos - Ball_Size) <= Ball_X_Min || Ball_X_Pos>700)
					begin
					  Ball_X_Motion <= Ball_X_Step;
					  Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
					  Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
					  moved<=1'b1;
					end


				else if ( (Ball_Y_Pos - Ball_Size) <= Ball_Y_Min || Ball_Y_Pos>700 )
					begin
						Ball_Y_Motion <= Ball_Y_Step;
						Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
						Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
						moved<=1'b1;
					end


				 else if ( (Ball_X_Pos + Ball_Size) >= Ball_X_Max)
					  begin
					  Ball_X_Motion <= (~ (Ball_X_Step) + 1'b1);
					  Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
				 	  Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
					  moved<=1'b1;

					  end






				 else if( (((Ball_X_Pos)<=(BarX+Bar_Sizex)) && ((Ball_X_Pos)>=(BarX-Bar_Sizex))) &&
				 ((Ball_Y_Pos+Ball_Size)>=(BarY-Bar_Sizey)) &&(~Ball_Reset))
				 begin

					Ball_Y_Motion <= ( ~(Ball_Y_Step) + 1'b1);


					if(  Ball_X_Pos>(BarX+(Bar_Sizex>>1))  )
					begin
					Ball_X_Motion <=(Ball_X_Step2);
					end
					else if ((Ball_X_Pos)>=(BarX))
					begin
					Ball_X_Motion <=(Ball_X_Step);
					end
					else if(  Ball_X_Pos < (BarX-(Bar_Sizex>>1))  )
					begin
					Ball_X_Motion <=   (~(Ball_X_Step2)+1'b1);
					end
					else
					begin
					Ball_X_Motion <= ((~Ball_X_Step) + 1'b1 );
					end

				 Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
				 Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
			   	moved<=1'b1;
			     end





		for (int i =0; i<32; i++)
		 begin
			  BlockX = (10'b0000000000^((i%8)*80+40));
			  BlockY = (10'b0000000000^(10+20*(i>>3)));




			if(Blocks[i])
			begin
			if(  ((Ball_X_Pos<=(BlockX+Block_SizeX)) && (Ball_X_Pos>=(BlockX-Block_SizeX))) && ((Ball_Y_Pos<=(BlockY+Block_SizeY)) && (Ball_Y_Pos>=((BlockY+Block_SizeY)-Ball_Y_Step))))
			begin
			Ball_Y_Motion <= Ball_Y_Step;
			Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
			Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
			moved<=1'b1;
			Blocks[i]<=0;
			curr_score <= curr_score + 1;
			end


			else if(((Ball_X_Pos<=(BlockX+Block_SizeX)) && (Ball_X_Pos>=(BlockX-Block_SizeX))) && ((Ball_Y_Pos>=(BlockY-Block_SizeY)) && (Ball_Y_Pos<=((BlockY-Block_SizeY)+Ball_Y_Step))))
	      begin
			Ball_Y_Motion <= (~(Ball_Y_Step) + 1'b1);
			Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
			Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
			moved<=1'b1;
			Blocks[i] <=0;
			curr_score <= curr_score + 1;
			end



			else if(((Ball_Y_Pos<=(BlockY+Block_SizeY)) && (Ball_Y_Pos>=(BlockY-Block_SizeY))) && ((Ball_X_Pos>=(BlockX-Block_SizeX)) && (Ball_X_Pos<=((BlockX-Block_SizeX)+Ball_X_Step))))
	      begin

			Ball_X_Motion <= (~(Ball_X_Step) + 1'b1);
			Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
			Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
			moved<=1'b1;
			Blocks[i] <=0;
			curr_score <= curr_score + 1;
			end

			else if(((Ball_Y_Pos<=(BlockY+Block_SizeY)) && (Ball_Y_Pos>=(BlockY-Block_SizeY))) && ((Ball_X_Pos<=(BlockX+Block_SizeX)) && (Ball_X_Pos>=((BlockX+Block_SizeX)-Ball_X_Step))))
	      begin

			Ball_X_Motion <= Ball_X_Step;
			Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
			Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
			moved<=1'b1;
			Blocks[i] <=0;
			curr_score <= curr_score + 1;
			end
			end

			end




				if(~moved)

					 begin
					  Ball_Y_Motion <= Ball_Y_Motion;
					  Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
				     Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
					  moved<=1'b1;
                end





	    end
    end

    assign BallX = Ball_X_Pos;

    assign BallY = Ball_Y_Pos;

    assign BallS = Ball_Size;


endmodule
module  ball ( input Reset, frame_clk,
					input [07:00] keycode,
					input [09:00] BarX, BarY, Bar_Sizex, Bar_Sizey,
					input [09:00] Block_SizeX, Block_SizeY,
					input [32:00] Block_Array,
					input 		  start_menu,
               output [09:00] BallX, BallY, BallS,
				   output [31:00] Blocks,
					output 			Bar_Reset,
					output [01:00] lives,
					output			lives_zero,
					output [15:00] curr_score);


	logic [9:0] Ball_X_Pos, Ball_X_Motion, Ball_Y_Pos, Ball_Y_Motion, Ball_Size;

	parameter [9:0] Ball_X_Start=320;
	parameter [9:0] Ball_Y_Start=452;
	parameter [9:0] Ball_X_Min=4;
	parameter [9:0] Ball_X_Max=635;
	parameter [9:0] Ball_Y_Min=4;
	parameter [9:0] Ball_Y_Max=475;
	parameter [9:0] Ball_X_Step=2;
	parameter [9:0] Ball_X_Step2=2;
	parameter [9:0] Ball_Y_Step=3;
	logic Ball_Reset;
	logic[9:0] BlockX, BlockY;


	assign Ball_Size = 4;
	logic moved;
	assign lives_zero = (lives == 0);

    always_ff @ (posedge Reset or posedge frame_clk )
    begin: Move_Ball
			if (Reset)
			begin
				Ball_Y_Motion <= 10'd0;
				Ball_X_Motion <= 10'd0;
				Ball_Y_Pos <= Ball_Y_Start;
				Ball_X_Pos <= Ball_X_Start;
				Ball_Reset<= 1'b1;
				Bar_Reset <= 1'b1;
				Blocks<=Block_Array;
				moved<=1'b0;
				lives <= 3;
				curr_score <= 0;
			end
			else

			begin
				Bar_Reset <= 1'b0;
				moved<=1'b0;
				if ( (Ball_Y_Pos + Ball_Size) >= Ball_Y_Max && ~Ball_Reset)
				begin
					Ball_Reset<=1'b1 ;
					Ball_Y_Motion <= 10'd0;
				   	Ball_X_Motion <= 10'd0;
					Bar_Reset <= 1'b1;
				   	Ball_Y_Pos <= Ball_Y_Start;
				   	Ball_X_Pos <= BarX;
					moved<=1'b1;
					lives <= lives - 1;
				end


				else if(keycode == 8'h2c && Ball_Reset && ~start_menu)
				begin
				 	Ball_X_Motion <=Ball_X_Step;
				 	Ball_Y_Motion <=-Ball_Y_Step;
				 	Ball_Reset <= 1'b0;
				 	Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
				 	Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
				 	moved<=1'b1;
				end
				else if(Ball_Reset)
				begin
					Ball_Y_Pos <= Ball_Y_Start;
					Ball_X_Pos <= BarX;
					moved<=1'b1;
				 end

				else if ( (Ball_X_Pos - Ball_Size) <= Ball_X_Min || Ball_X_Pos>700)
					begin
					  Ball_X_Motion <= Ball_X_Step;
					  Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
					  Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
					  moved<=1'b1;
					end


				else if ( (Ball_Y_Pos - Ball_Size) <= Ball_Y_Min || Ball_Y_Pos>700 )
					begin
						Ball_Y_Motion <= Ball_Y_Step;
						Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
						Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
						moved<=1'b1;
					end


				 else if ( (Ball_X_Pos + Ball_Size) >= Ball_X_Max)
					  begin
					  Ball_X_Motion <= (~ (Ball_X_Step) + 1'b1);
					  Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
				 	  Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
					  moved<=1'b1;

					  end






				 else if( (((Ball_X_Pos)<=(BarX+Bar_Sizex)) && ((Ball_X_Pos)>=(BarX-Bar_Sizex))) &&
				 ((Ball_Y_Pos+Ball_Size)>=(BarY-Bar_Sizey)) &&(~Ball_Reset))
				 begin

					Ball_Y_Motion <= ( ~(Ball_Y_Step) + 1'b1);


					if(  Ball_X_Pos>(BarX+(Bar_Sizex>>1))  )
					begin
					Ball_X_Motion <=(Ball_X_Step2);
					end
					else if ((Ball_X_Pos)>=(BarX))
					begin
					Ball_X_Motion <=(Ball_X_Step);
					end
					else if(  Ball_X_Pos < (BarX-(Bar_Sizex>>1))  )
					begin
					Ball_X_Motion <=   (~(Ball_X_Step2)+1'b1);
					end
					else
					begin
					Ball_X_Motion <= ((~Ball_X_Step) + 1'b1 );
					end

				 Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
				 Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
			   	moved<=1'b1;
			     end





		for (int i =0; i<32; i++)
		 begin
			  BlockX = (10'b0000000000^((i%8)*80+40));
			  BlockY = (10'b0000000000^(10+20*(i>>3)));




			if(Blocks[i])
			begin
			if(  ((Ball_X_Pos<=(BlockX+Block_SizeX)) && (Ball_X_Pos>=(BlockX-Block_SizeX))) && ((Ball_Y_Pos<=(BlockY+Block_SizeY)) && (Ball_Y_Pos>=((BlockY+Block_SizeY)-Ball_Y_Step))))
			begin
			Ball_Y_Motion <= Ball_Y_Step;
			Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
			Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
			moved<=1'b1;
			Blocks[i]<=0;
			curr_score <= curr_score + 1;
			end


			else if(((Ball_X_Pos<=(BlockX+Block_SizeX)) && (Ball_X_Pos>=(BlockX-Block_SizeX))) && ((Ball_Y_Pos>=(BlockY-Block_SizeY)) && (Ball_Y_Pos<=((BlockY-Block_SizeY)+Ball_Y_Step))))
	      begin
			Ball_Y_Motion <= (~(Ball_Y_Step) + 1'b1);
			Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
			Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
			moved<=1'b1;
			Blocks[i] <=0;
			curr_score <= curr_score + 1;
			end



			else if(((Ball_Y_Pos<=(BlockY+Block_SizeY)) && (Ball_Y_Pos>=(BlockY-Block_SizeY))) && ((Ball_X_Pos>=(BlockX-Block_SizeX)) && (Ball_X_Pos<=((BlockX-Block_SizeX)+Ball_X_Step))))
	      begin

			Ball_X_Motion <= (~(Ball_X_Step) + 1'b1);
			Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
			Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
			moved<=1'b1;
			Blocks[i] <=0;
			curr_score <= curr_score + 1;
			end

			else if(((Ball_Y_Pos<=(BlockY+Block_SizeY)) && (Ball_Y_Pos>=(BlockY-Block_SizeY))) && ((Ball_X_Pos<=(BlockX+Block_SizeX)) && (Ball_X_Pos>=((BlockX+Block_SizeX)-Ball_X_Step))))
	      begin

			Ball_X_Motion <= Ball_X_Step;
			Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
			Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
			moved<=1'b1;
			Blocks[i] <=0;
			curr_score <= curr_score + 1;
			end
			end

			end




				if(~moved)

					 begin
					  Ball_Y_Motion <= Ball_Y_Motion;
					  Ball_Y_Pos <= (Ball_Y_Pos + Ball_Y_Motion);
				     Ball_X_Pos <= (Ball_X_Pos + Ball_X_Motion);
					  moved<=1'b1;
                end





	    end
    end

    assign BallX = Ball_X_Pos;

    assign BallY = Ball_Y_Pos;

    assign BallS = Ball_Size;


endmodule