data/full_repos/permissive/46625639/pong.v
1: b'%Warning-WIDTH: data/full_repos/permissive/46625639/pong.v:438: Operator ADD expects 11 bits on the RHS, but RHS\'s VARREF \'speed\' generates 5 bits.\n                                                              : ... In instance pong.gl.bp\n    value_x <= value_x + speed;\n                       ^\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/46625639/pong.v:442: Operator SUB expects 11 bits on the RHS, but RHS\'s VARREF \'speed\' generates 5 bits.\n                                                              : ... In instance pong.gl.bp\n    value_x <= value_x - speed;\n                       ^\n%Warning-WIDTH: data/full_repos/permissive/46625639/pong.v:448: Operator ADD expects 11 bits on the RHS, but RHS\'s VARREF \'speed\' generates 5 bits.\n                                                              : ... In instance pong.gl.bp\n    value_y <= value_y + speed;\n                       ^\n%Warning-WIDTH: data/full_repos/permissive/46625639/pong.v:452: Operator SUB expects 11 bits on the RHS, but RHS\'s VARREF \'speed\' generates 5 bits.\n                                                              : ... In instance pong.gl.bp\n    value_y <= value_y - speed;\n                       ^\n%Warning-WIDTH: data/full_repos/permissive/46625639/pong.v:388: Operator SUB expects 11 bits on the RHS, but RHS\'s VARREF \'speed\' generates 5 bits.\n                                                              : ... In instance pong.gl.b2\n     value <= value - speed;\n                    ^\n%Warning-WIDTH: data/full_repos/permissive/46625639/pong.v:386: Operator SUB expects 32 or 11 bits on the RHS, but RHS\'s VARREF \'speed\' generates 5 bits.\n                                                              : ... In instance pong.gl.b2\n    if ((value - speed) > 3) begin\n               ^\n%Warning-WIDTH: data/full_repos/permissive/46625639/pong.v:395: Operator ADD expects 11 bits on the RHS, but RHS\'s VARREF \'speed\' generates 5 bits.\n                                                              : ... In instance pong.gl.b2\n     value <= value + speed;\n                    ^\n%Warning-WIDTH: data/full_repos/permissive/46625639/pong.v:393: Operator ADD expects 32 or 11 bits on the RHS, but RHS\'s VARREF \'speed\' generates 5 bits.\n                                                              : ... In instance pong.gl.b2\n    if ((value + speed) < (1024 - 128)) begin\n               ^\n%Warning-WIDTH: data/full_repos/permissive/46625639/pong.v:647: Operator ASSIGN expects 2 bits on the Assign RHS, but Assign RHS\'s CONST \'1\'h0\' generates 1 bits.\n                                                              : ... In instance pong.gl\n   count_secs = 1\'b0;\n              ^\n%Error: data/full_repos/permissive/46625639/pong.v:116: Cannot find file containing module: \'pll108MHz\'\n pll108MHz pll(.inclk0(CLOCK_27), .c0(video_clock));\n ^~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/46625639,data/full_repos/permissive/46625639/pll108MHz\n             data/full_repos/permissive/46625639,data/full_repos/permissive/46625639/pll108MHz.v\n             data/full_repos/permissive/46625639,data/full_repos/permissive/46625639/pll108MHz.sv\n             pll108MHz\n             pll108MHz.v\n             pll108MHz.sv\n             obj_dir/pll108MHz\n             obj_dir/pll108MHz.v\n             obj_dir/pll108MHz.sv\n%Error: data/full_repos/permissive/46625639/pong.v:203: Cannot find file containing module: \'keyboard\'\n keyboard keybd(\n ^~~~~~~~\n%Error: data/full_repos/permissive/46625639/pong.v:215: Cannot find file containing module: \'oneshot\'\n oneshot pulser(\n ^~~~~~~\n%Error: Exiting due to 3 error(s), 9 warning(s)\n'
module gamelogic(
	clock50,
	video_clock,
	start,
	reset,	
	p1_up,
	p1_down,
	p2_up,
	p2_down,
	p1_y,
	p2_y,
	ball_on,
	ball_x,
	ball_y,
	p1_score,
	p2_score,
	winner
	);
	
	input clock50;
	input reset;
	input video_clock;
	input start;
	input p1_up, p1_down, p2_up, p2_down;
	output [10:0] p1_y, p2_y;
	output [10:0] ball_x, ball_y;
	output ball_on;
	output [3:0] p1_score, p2_score;
	output [1:0] winner;
	
	reg [3:0] p1_score, p2_score;
	initial begin
		p1_score <= 4'b0;
		p2_score <= 4'b0;
	end
	
	reg [1:0] winner;
	initial begin
		winner <= 0;
	end
	
	reg ball_on;
	initial begin
		ball_on <= 1;
	end
	
	wire dir_x;
	wire dir_y;
	
	wire outofbounds;
	reg newround;
	
	reg [25:0] count_sec;
	reg [1:0] count_secs;
	always @ (posedge clock50) begin
		if (outofbounds) begin
			ball_on = 0;
			

			if (count_sec == 26'd49_999_999) begin

				count_sec = 26'd0;
				count_secs = count_secs + 1;
			end
			else begin

				count_sec = count_sec + 1;
			end
			

			if (count_secs == 3) begin
			


				if (count_sec == 26'd1) begin
					if (dir_x) begin

						p1_score = p1_score + 1;
					end
					else begin

						p2_score = p2_score + 1;
					end	
				end
				

				if (p1_score == 4'd10) begin
					winner = 1;
				end
				else if (p2_score == 4'd10) begin
					winner = 2;
				end
				

				ball_on = 1;
				newround = 1;
			end
		end
		else begin
			if (newround) begin
				newround = 0;
			end
			count_secs = 1'b0;
			count_sec = 26'd0;
			
			if (reset) begin
				p1_score = 0;
				p2_score = 0;
				winner = 0;
			end
		end
	end
	

	batpos b1 (
		.clk(video_clock && start),
		.up(p1_up),
		.down(p1_down),
		.reset(reset),
		.speed(`batspeed),
		.value(p1_y)
		);
		

	batpos b2 (
		.clk(video_clock && start),
		.up(p2_up),
		.down(p2_down),
		.reset(reset),
		.speed(`batspeed),
		.value(p2_y)
		);
		

	ballcollisions bcs (
		.clk(video_clock && start && ball_on),
		.reset(reset || newround),
		.p1_y(p1_y),
		.p2_y(p2_y),
		.ball_x(ball_x),
		.ball_y(ball_y),
		.dir_x(dir_x),
		.dir_y(dir_y),
		.oob(outofbounds)
		);
	

	ballpos bp (
		.clk(video_clock && start && ball_on),
		.reset(reset || newround || (winner > 0)),
		.speed(`ballspeed),
		.dir_x(dir_x),
		.dir_y(dir_y),
		.value_x(ball_x),
		.value_y(ball_y)
		);
	
endmodule
module gamelogic(
	clock50,
	video_clock,
	start,
	reset,	
	p1_up,
	p1_down,
	p2_up,
	p2_down,
	p1_y,
	p2_y,
	ball_on,
	ball_x,
	ball_y,
	p1_score,
	p2_score,
	winner
	);

	
	input clock50;
	input reset;
	input video_clock;
	input start;
	input p1_up, p1_down, p2_up, p2_down;
	output [10:0] p1_y, p2_y;
	output [10:0] ball_x, ball_y;
	output ball_on;
	output [3:0] p1_score, p2_score;
	output [1:0] winner;
	
	reg [3:0] p1_score, p2_score;
	initial begin
		p1_score <= 4'b0;
		p2_score <= 4'b0;
	end
	
	reg [1:0] winner;
	initial begin
		winner <= 0;
	end
	
	reg ball_on;
	initial begin
		ball_on <= 1;
	end
	
	wire dir_x;
	wire dir_y;
	
	wire outofbounds;
	reg newround;
	
	reg [25:0] count_sec;
	reg [1:0] count_secs;
	always @ (posedge clock50) begin
		if (outofbounds) begin
			ball_on = 0;
			

			if (count_sec == 26'd49_999_999) begin

				count_sec = 26'd0;
				count_secs = count_secs + 1;
			end
			else begin

				count_sec = count_sec + 1;
			end
			

			if (count_secs == 3) begin
			


				if (count_sec == 26'd1) begin
					if (dir_x) begin

						p1_score = p1_score + 1;
					end
					else begin

						p2_score = p2_score + 1;
					end	
				end
				

				if (p1_score == 4'd10) begin
					winner = 1;
				end
				else if (p2_score == 4'd10) begin
					winner = 2;
				end
				

				ball_on = 1;
				newround = 1;
			end
		end
		else begin
			if (newround) begin
				newround = 0;
			end
			count_secs = 1'b0;
			count_sec = 26'd0;
			
			if (reset) begin
				p1_score = 0;
				p2_score = 0;
				winner = 0;
			end
		end
	end
	

	batpos b1 (
		.clk(video_clock && start),
		.up(p1_up),
		.down(p1_down),
		.reset(reset),
		.speed(`batspeed),
		.value(p1_y)
		);
		

	batpos b2 (
		.clk(video_clock && start),
		.up(p2_up),
		.down(p2_down),
		.reset(reset),
		.speed(`batspeed),
		.value(p2_y)
		);
		

	ballcollisions bcs (
		.clk(video_clock && start && ball_on),
		.reset(reset || newround),
		.p1_y(p1_y),
		.p2_y(p2_y),
		.ball_x(ball_x),
		.ball_y(ball_y),
		.dir_x(dir_x),
		.dir_y(dir_y),
		.oob(outofbounds)
		);
	

	ballpos bp (
		.clk(video_clock && start && ball_on),
		.reset(reset || newround || (winner > 0)),
		.speed(`ballspeed),
		.dir_x(dir_x),
		.dir_y(dir_y),
		.value_x(ball_x),
		.value_y(ball_y)
		);
	
endmodule