data/full_repos/permissive/51625123/src/robohand.v
1: b'%Warning-UNSIGNED: data/full_repos/permissive/51625123/src/robohand.v:47: Comparison is constant due to unsigned arithmetic\n                                                                        : ... In instance robohand\n  if (py < PADDLESIZE/2) \n         ^\n                   ... Use "/* verilator lint_off UNSIGNED */" and lint_on around source to disable this message.\n%Error: Exiting due to 1 warning(s)\n'
module robohand(reset, advance, ball_y, paddle_y);

	parameter PADDLESIZE   = 10'd0;
	parameter SCREENHEIGHT = 10'd0;

	input reset;
	input advance;
	input [9:0] ball_y;
	output reg[9:0] paddle_y;


	reg paddleDir;
	reg [9:0] ptop;
	reg [9:0] pbot;
	reg [2:0] increment;
	
	always @(negedge advance or posedge reset) begin
		if (reset) begin
			paddle_y <= SCREENHEIGHT/2;
		end
		else begin
			if (ball_y < ptop || ball_y > pbot) 
				paddle_y <= paddlelimiter(paddleDir == 1'b0 ? paddle_y + 1'b1 : paddle_y - 1'b1);
		end
	end
	
	always @(posedge advance) begin
		ptop <= paddle_y - PADDLESIZE/2;
		pbot <= paddle_y + PADDLESIZE/2;
		paddleDir <= ball_y < paddle_y;
	end
	
	function [9:0] paddlelimiter;
	input [9:0] py;
	begin
		if (py < PADDLESIZE/2) 
			paddlelimiter = PADDLESIZE/2;
		else 
		if (py > SCREENHEIGHT-PADDLESIZE/2)
			paddlelimiter = SCREENHEIGHT-PADDLESIZE/2;
		else
			paddlelimiter = py;
	end
	endfunction
	
endmodule
module robohand(reset, advance, ball_y, paddle_y);


	parameter PADDLESIZE   = 10'd0;
	parameter SCREENHEIGHT = 10'd0;

	input reset;
	input advance;
	input [9:0] ball_y;
	output reg[9:0] paddle_y;


	reg paddleDir;
	reg [9:0] ptop;
	reg [9:0] pbot;
	reg [2:0] increment;
	
	always @(negedge advance or posedge reset) begin
		if (reset) begin
			paddle_y <= SCREENHEIGHT/2;
		end
		else begin
			if (ball_y < ptop || ball_y > pbot) 
				paddle_y <= paddlelimiter(paddleDir == 1'b0 ? paddle_y + 1'b1 : paddle_y - 1'b1);
		end
	end
	
	always @(posedge advance) begin
		ptop <= paddle_y - PADDLESIZE/2;
		pbot <= paddle_y + PADDLESIZE/2;
		paddleDir <= ball_y < paddle_y;
	end
	
	function [9:0] paddlelimiter;
	input [9:0] py;
	begin
		if (py < PADDLESIZE/2) 
			paddlelimiter = PADDLESIZE/2;
		else 
		if (py > SCREENHEIGHT-PADDLESIZE/2)
			paddlelimiter = SCREENHEIGHT-PADDLESIZE/2;
		else
			paddlelimiter = py;
	end
	endfunction
	
endmodule