data/full_repos/permissive/51625123/src/ballmover.v
1: b'%Warning-WIDTHCONCAT: data/full_repos/permissive/51625123/src/ballmover.v:61: Unsized numbers/parameters not allowed in concatenations.\n                                                                            : ... In instance ballmover\n   {ball_x, lsb_x} = {(set_side ? (SCREENWIDTH/3) : (SCREENWIDTH-SCREENWIDTH/3)), 4\'b0};\n                                ^\n                      ... Use "/* verilator lint_off WIDTHCONCAT */" and lint_on around source to disable this message.\n%Warning-WIDTHCONCAT: data/full_repos/permissive/51625123/src/ballmover.v:61: Unsized numbers/parameters not allowed in replications.\n                                                                            : ... In instance ballmover\n   {ball_x, lsb_x} = {(set_side ? (SCREENWIDTH/3) : (SCREENWIDTH-SCREENWIDTH/3)), 4\'b0};\n                                                                                ^\n%Warning-WIDTH: data/full_repos/permissive/51625123/src/ballmover.v:81: Operator COND expects 14 bits on the Conditional True, but Conditional True\'s VARREF \'speedX\' generates 4 bits.\n                                                                      : ... In instance ballmover\n   {ball_x,lsb_x} = {ball_x,lsb_x} + (sgnX ? speedX : -speedX);     \n                                           ^\n%Warning-WIDTH: data/full_repos/permissive/51625123/src/ballmover.v:81: Operator NEGATE expects 14 bits on the LHS, but LHS\'s VARREF \'speedX\' generates 4 bits.\n                                                                      : ... In instance ballmover\n   {ball_x,lsb_x} = {ball_x,lsb_x} + (sgnX ? speedX : -speedX);     \n                                                      ^\n%Warning-WIDTH: data/full_repos/permissive/51625123/src/ballmover.v:82: Operator COND expects 14 bits on the Conditional True, but Conditional True\'s VARREF \'speedY\' generates 4 bits.\n                                                                      : ... In instance ballmover\n   {ball_y,lsb_y} = {ball_y,lsb_y} + (sgnY ? speedY : -speedY);\n                                           ^\n%Warning-WIDTH: data/full_repos/permissive/51625123/src/ballmover.v:82: Operator NEGATE expects 14 bits on the LHS, but LHS\'s VARREF \'speedY\' generates 4 bits.\n                                                                      : ... In instance ballmover\n   {ball_y,lsb_y} = {ball_y,lsb_y} + (sgnY ? speedY : -speedY);\n                                                      ^\n%Error: Exiting due to 6 warning(s)\n'
module ballmover(clk, reset, advance, ball_x, ball_y, collide, collidereset, deflect, set_side, outA, outB, wall);
	parameter SCREENWIDTH = 640;
	parameter SCREENHEIGHT = 480;
	parameter BALLSIZE = 8;
	
	input clk;
	input reset;
	input advance;
	output reg [9:0] ball_x;
	output reg [9:0] ball_y;
	input collide;
	output reg collidereset;
	input [9:0] deflect;
	input set_side;
	output reg outA, outB, wall;

	reg sgnX;
	reg sgnY;
	parameter speedX = 4'd8;
	reg [3:0] speedY = 8;
	
	reg [3:0] lsb_x;
	reg [3:0] lsb_y;
	
	wire[3:0] woot;
	assign woot[1:0] = {(ball_x < BALLSIZE/2), (ball_x > SCREENWIDTH - BALLSIZE/2)};
	assign woot[3:2] = {(ball_y < BALLSIZE/2), (ball_y > SCREENHEIGHT - BALLSIZE/2)};
	
	always @(posedge advance or posedge reset) begin
		if (reset) begin 



			{ball_x, lsb_x} = {(set_side ? (SCREENWIDTH/3) : (SCREENWIDTH-SCREENWIDTH/3)), 4'b0};
			{ball_y, lsb_y} = SCREENHEIGHT/2 * 16;
			speedY = 1;
			outA = 0;
			outB = 0;
		end 
		else begin 
			if (collide) begin
				sgnX = !sgnX;
				sgnY = ~deflect[9];
				speedY = deflect[5:2];
				collidereset = 1;
			end 
				else collidereset = 0;
			
			if (woot[1]) begin ball_x = BALLSIZE/2; sgnX = 1; outA = 1; end
			if (woot[0]) begin ball_x = 640-BALLSIZE/2; sgnX = 0; outB = 1; end
			if (woot[3]) begin ball_y = BALLSIZE/2; sgnY = 1; end
			if (woot[2]) begin ball_y = 480-BALLSIZE/2; sgnY = 0; end
			
			{ball_x,lsb_x} = {ball_x,lsb_x} + (sgnX ? speedX : -speedX);					
			{ball_y,lsb_y} = {ball_y,lsb_y} + (sgnY ? speedY : -speedY);
			wall <= woot[2] | woot[3];


		end
	end
endmodule
module ballmover(clk, reset, advance, ball_x, ball_y, collide, collidereset, deflect, set_side, outA, outB, wall);

	parameter SCREENWIDTH = 640;
	parameter SCREENHEIGHT = 480;
	parameter BALLSIZE = 8;
	
	input clk;
	input reset;
	input advance;
	output reg [9:0] ball_x;
	output reg [9:0] ball_y;
	input collide;
	output reg collidereset;
	input [9:0] deflect;
	input set_side;
	output reg outA, outB, wall;

	reg sgnX;
	reg sgnY;
	parameter speedX = 4'd8;
	reg [3:0] speedY = 8;
	
	reg [3:0] lsb_x;
	reg [3:0] lsb_y;
	
	wire[3:0] woot;
	assign woot[1:0] = {(ball_x < BALLSIZE/2), (ball_x > SCREENWIDTH - BALLSIZE/2)};
	assign woot[3:2] = {(ball_y < BALLSIZE/2), (ball_y > SCREENHEIGHT - BALLSIZE/2)};
	
	always @(posedge advance or posedge reset) begin
		if (reset) begin 



			{ball_x, lsb_x} = {(set_side ? (SCREENWIDTH/3) : (SCREENWIDTH-SCREENWIDTH/3)), 4'b0};
			{ball_y, lsb_y} = SCREENHEIGHT/2 * 16;
			speedY = 1;
			outA = 0;
			outB = 0;
		end 
		else begin 
			if (collide) begin
				sgnX = !sgnX;
				sgnY = ~deflect[9];
				speedY = deflect[5:2];
				collidereset = 1;
			end 
				else collidereset = 0;
			
			if (woot[1]) begin ball_x = BALLSIZE/2; sgnX = 1; outA = 1; end
			if (woot[0]) begin ball_x = 640-BALLSIZE/2; sgnX = 0; outB = 1; end
			if (woot[3]) begin ball_y = BALLSIZE/2; sgnY = 1; end
			if (woot[2]) begin ball_y = 480-BALLSIZE/2; sgnY = 0; end
			
			{ball_x,lsb_x} = {ball_x,lsb_x} + (sgnX ? speedX : -speedX);					
			{ball_y,lsb_y} = {ball_y,lsb_y} + (sgnY ? speedY : -speedY);
			wall <= woot[2] | woot[3];


		end
	end
endmodule