data/full_repos/permissive/51625123/src/tehgame.v
1: b"%Error: data/full_repos/permissive/51625123/src/tehgame.v:81: Cannot find file containing module: 'soundnik'\nsoundnik canhassound(clkdiv8, sound, keydown, sfx, sdur);\n^~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/51625123/src,data/full_repos/permissive/51625123/soundnik\n             data/full_repos/permissive/51625123/src,data/full_repos/permissive/51625123/soundnik.v\n             data/full_repos/permissive/51625123/src,data/full_repos/permissive/51625123/soundnik.sv\n             soundnik\n             soundnik.v\n             soundnik.sv\n             obj_dir/soundnik\n             obj_dir/soundnik.v\n             obj_dir/soundnik.sv\n%Error: data/full_repos/permissive/51625123/src/tehgame.v:177: Cannot find file containing module: 'scores'\nscores scorekeeper(clk, hsync, realx, realy, outB, outA, score_reset, scoreA, scoreB, scans[0]);\n^~~~~~\n%Error: data/full_repos/permissive/51625123/src/tehgame.v:195: Cannot find file containing module: 'collider'\ncollider #(15, 16)   colliderA(ballAdvance, ball_x, ball_y, paddleA_top, paddleA_bot, collisionreset, collideA);\n^~~~~~~~\n%Error: data/full_repos/permissive/51625123/src/tehgame.v:196: Cannot find file containing module: 'collider'\ncollider #(640-32, 16)  colliderB(ballAdvance, ball_x, ball_y, paddleB_top, paddleB_bot, collisionreset, collideB);\n^~~~~~~~\n%Error: data/full_repos/permissive/51625123/src/tehgame.v:198: Cannot find file containing module: 'deflector'\ndeflector deflectorA(collideA, ball_y, paddleA_y, deflectA);\n^~~~~~~~~\n%Error: data/full_repos/permissive/51625123/src/tehgame.v:199: Cannot find file containing module: 'deflector'\ndeflector deflectorB(collideB, ball_y, paddleB_y, deflectB);\n^~~~~~~~~\n%Error: data/full_repos/permissive/51625123/src/tehgame.v:204: Cannot find file containing module: 'ballmover'\nballmover #(SCREENWIDTH,SCREENHEIGHT,BALLSIZE) \n^~~~~~~~~\n%Error: data/full_repos/permissive/51625123/src/tehgame.v:211: Cannot find file containing module: 'paddlescan'\npaddlescan #(PADDLESIZE, 15)   paddlescanA(clk, paddleA_top, paddleA_bot, realx, realy, paddleA_scan);\n^~~~~~~~~~\n%Error: data/full_repos/permissive/51625123/src/tehgame.v:212: Cannot find file containing module: 'paddlescan'\npaddlescan #(PADDLESIZE, 640-32)  paddlescanB(clk, paddleB_top, paddleB_bot, realx, realy, paddleB_scan);\n^~~~~~~~~~\n%Error: data/full_repos/permissive/51625123/src/tehgame.v:214: Cannot find file containing module: 'ballscan'\nballscan #(BALLSIZE) ballscan(clk, realx, realy, ball_x, ball_y, scans[2]);\n^~~~~~~~\n%Error: Exiting due to 10 error(s)\n"
module tehgame(clk, clkdiv8, reset, gamereset, hsync, realx, realy, paddleA_y, paddleB_y, ballAdvance, scans, ball_y, sound, led);

parameter SCREENWIDTH = 10'd640;
parameter SCREENHEIGHT = 10'd480;
parameter PADDLESIZE = 10'd64;
parameter BALLSIZE = 8;

input clk, clkdiv8;
input reset;
input gamereset;
input hsync;
input [9:0] realx;
input [9:0] realy;
input [9:0] paddleA_y;
input [9:0] paddleB_y;
input ballAdvance;
output [2:0] scans;
output [9:0] ball_y;
output sound;
output led;

reg [7:0] ledcounter;
reg 	  ledled;

assign led = ledled;




reg [3:0] sfx;
reg keydown;
reg [3:0] sdur;
always @(posedge clk) begin
	keydown = !reset & (collide | wallbounce | outA | outB);
	if (keydown) begin
		sdur <= 0;
		if (collide) sfx <= 0;
		else if (wallbounce) sfx <= 1;
		else if (outA | outB) begin
			sdur <= 1;
			sfx <= 2; 
		end
	end
end
soundnik canhassound(clkdiv8, sound, keydown, sfx, sdur);



parameter state0 = 0, state1 = 1, state2 = 2, state3 = 3, state4 = 4, state5 = 5, state6 = 6, state7 = 7;


reg[3:0] state;

reg ball_reset;
reg service_side;
reg score_reset;
reg [11:0] pause;
wire[9:0] ball_x;
wire[9:0] ball_y;


always @(posedge ballAdvance or posedge reset or posedge gamereset) begin
	if (reset) state <= state5;
	else if (gamereset) state <= state0;
	else begin
		case (state) 

		state0: begin
				score_reset <= 1;
				service_side <= 0;
				ledled <= 1;


				state <= state1;
			end

		state1: begin 
				score_reset <= 0;
				ball_reset <= 1;
				pause <= 1024;
				state <= state2;
			end

		state2: begin 
				if (pause == 0) begin
					ball_reset <= 0;
					state <= state3;
				end else begin
					pause <= pause - 1;
				end
			end

		state3: begin 
				if (outA | outB) begin
					service_side <= outB;

					if (scoreA == 8'h21 || scoreB == 8'h21) begin
						pause <= 4095;
						ball_reset <= 1;
						state <= state4;
					end else begin
						state <= state1;
					end
				end
			end

		state4: begin
				ledcounter <= ledcounter - 1;
				if (ledcounter == 0) ledled = !ledled;
			end

		state5: begin				
				ball_reset <= 1;
				state <= state4;
			end
		default:
			begin 
				state <= state0;
			end
		endcase
	end
end







reg[9:0] paddleA_top;
reg[9:0] paddleA_bot;
reg[9:0] paddleB_top;
reg[9:0] paddleB_bot;
always @(posedge clk) begin
	paddleA_top <= paddleA_y - PADDLESIZE/2;
	paddleA_bot <= paddleA_y + PADDLESIZE/2;
	paddleB_top <= paddleB_y - PADDLESIZE/2;
	paddleB_bot <= paddleB_y + PADDLESIZE/2;
end

scores scorekeeper(clk, hsync, realx, realy, outB, outA, score_reset, scoreA, scoreB, scans[0]);





wire collideA;
wire collideB;
wire collide = collideA | collideB;

wire[9:0] deflectA;
wire[9:0] deflectB;

wire collisionreset;

wire [7:0] scoreA;
wire [7:0] scoreB;

collider #(15, 16) 		colliderA(ballAdvance, ball_x, ball_y, paddleA_top, paddleA_bot, collisionreset, collideA);
collider #(640-32, 16) 	colliderB(ballAdvance, ball_x, ball_y, paddleB_top, paddleB_bot, collisionreset, collideB);

deflector deflectorA(collideA, ball_y, paddleA_y, deflectA);
deflector deflectorB(collideB, ball_y, paddleB_y, deflectB);

wire outA;
wire outB;
wire wallbounce;
ballmover #(SCREENWIDTH,SCREENHEIGHT,BALLSIZE) 
	ballmover(clk, ball_reset, ballAdvance, ball_x, ball_y, collide, collisionreset, ({10{collideA}} & deflectA) | ({10{collideB}} & deflectB),
			  service_side, outA, outB, wallbounce);


wire paddleA_scan, paddleB_scan;
assign scans[1] = paddleA_scan | paddleB_scan;
paddlescan #(PADDLESIZE, 15) 		paddlescanA(clk, paddleA_top, paddleA_bot, realx, realy, paddleA_scan);
paddlescan #(PADDLESIZE, 640-32) 	paddlescanB(clk, paddleB_top, paddleB_bot, realx, realy, paddleB_scan);

ballscan #(BALLSIZE) ballscan(clk, realx, realy, ball_x, ball_y, scans[2]);

endmodule
module tehgame(clk, clkdiv8, reset, gamereset, hsync, realx, realy, paddleA_y, paddleB_y, ballAdvance, scans, ball_y, sound, led);


parameter SCREENWIDTH = 10'd640;
parameter SCREENHEIGHT = 10'd480;
parameter PADDLESIZE = 10'd64;
parameter BALLSIZE = 8;

input clk, clkdiv8;
input reset;
input gamereset;
input hsync;
input [9:0] realx;
input [9:0] realy;
input [9:0] paddleA_y;
input [9:0] paddleB_y;
input ballAdvance;
output [2:0] scans;
output [9:0] ball_y;
output sound;
output led;

reg [7:0] ledcounter;
reg 	  ledled;

assign led = ledled;




reg [3:0] sfx;
reg keydown;
reg [3:0] sdur;
always @(posedge clk) begin
	keydown = !reset & (collide | wallbounce | outA | outB);
	if (keydown) begin
		sdur <= 0;
		if (collide) sfx <= 0;
		else if (wallbounce) sfx <= 1;
		else if (outA | outB) begin
			sdur <= 1;
			sfx <= 2; 
		end
	end
end
soundnik canhassound(clkdiv8, sound, keydown, sfx, sdur);



parameter state0 = 0, state1 = 1, state2 = 2, state3 = 3, state4 = 4, state5 = 5, state6 = 6, state7 = 7;


reg[3:0] state;

reg ball_reset;
reg service_side;
reg score_reset;
reg [11:0] pause;
wire[9:0] ball_x;
wire[9:0] ball_y;


always @(posedge ballAdvance or posedge reset or posedge gamereset) begin
	if (reset) state <= state5;
	else if (gamereset) state <= state0;
	else begin
		case (state) 

		state0: begin
				score_reset <= 1;
				service_side <= 0;
				ledled <= 1;


				state <= state1;
			end

		state1: begin 
				score_reset <= 0;
				ball_reset <= 1;
				pause <= 1024;
				state <= state2;
			end

		state2: begin 
				if (pause == 0) begin
					ball_reset <= 0;
					state <= state3;
				end else begin
					pause <= pause - 1;
				end
			end

		state3: begin 
				if (outA | outB) begin
					service_side <= outB;

					if (scoreA == 8'h21 || scoreB == 8'h21) begin
						pause <= 4095;
						ball_reset <= 1;
						state <= state4;
					end else begin
						state <= state1;
					end
				end
			end

		state4: begin
				ledcounter <= ledcounter - 1;
				if (ledcounter == 0) ledled = !ledled;
			end

		state5: begin				
				ball_reset <= 1;
				state <= state4;
			end
		default:
			begin 
				state <= state0;
			end
		endcase
	end
end







reg[9:0] paddleA_top;
reg[9:0] paddleA_bot;
reg[9:0] paddleB_top;
reg[9:0] paddleB_bot;
always @(posedge clk) begin
	paddleA_top <= paddleA_y - PADDLESIZE/2;
	paddleA_bot <= paddleA_y + PADDLESIZE/2;
	paddleB_top <= paddleB_y - PADDLESIZE/2;
	paddleB_bot <= paddleB_y + PADDLESIZE/2;
end

scores scorekeeper(clk, hsync, realx, realy, outB, outA, score_reset, scoreA, scoreB, scans[0]);





wire collideA;
wire collideB;
wire collide = collideA | collideB;

wire[9:0] deflectA;
wire[9:0] deflectB;

wire collisionreset;

wire [7:0] scoreA;
wire [7:0] scoreB;

collider #(15, 16) 		colliderA(ballAdvance, ball_x, ball_y, paddleA_top, paddleA_bot, collisionreset, collideA);
collider #(640-32, 16) 	colliderB(ballAdvance, ball_x, ball_y, paddleB_top, paddleB_bot, collisionreset, collideB);

deflector deflectorA(collideA, ball_y, paddleA_y, deflectA);
deflector deflectorB(collideB, ball_y, paddleB_y, deflectB);

wire outA;
wire outB;
wire wallbounce;
ballmover #(SCREENWIDTH,SCREENHEIGHT,BALLSIZE) 
	ballmover(clk, ball_reset, ballAdvance, ball_x, ball_y, collide, collisionreset, ({10{collideA}} & deflectA) | ({10{collideB}} & deflectB),
			  service_side, outA, outB, wallbounce);


wire paddleA_scan, paddleB_scan;
assign scans[1] = paddleA_scan | paddleB_scan;
paddlescan #(PADDLESIZE, 15) 		paddlescanA(clk, paddleA_top, paddleA_bot, realx, realy, paddleA_scan);
paddlescan #(PADDLESIZE, 640-32) 	paddlescanB(clk, paddleB_top, paddleB_bot, realx, realy, paddleB_scan);

ballscan #(BALLSIZE) ballscan(clk, realx, realy, ball_x, ball_y, scans[2]);

endmodule