data/full_repos/permissive/167632244/FlappyBird/pic.v
'utf-8' codec can't decode byte 0xb5 in position 5664: invalid start byte
1: b'%Warning-WIDTHCONCAT: data/full_repos/permissive/167632244/FlappyBird/pic.v:118: Unsized numbers/parameters not allowed in concatenations.\n                                                                               : ... In instance pic\n   forrow={11\'b000_0000_0000,rowaddr/2};\n                                    ^\n                      ... Use "/* verilator lint_off WIDTHCONCAT */" and lint_on around source to disable this message.\n%Warning-WIDTHCONCAT: data/full_repos/permissive/167632244/FlappyBird/pic.v:118: Unsized numbers/parameters not allowed in replications.\n                                                                               : ... In instance pic\n   forrow={11\'b000_0000_0000,rowaddr/2};\n                            ^\n%Warning-WIDTHCONCAT: data/full_repos/permissive/167632244/FlappyBird/pic.v:130: Unsized numbers/parameters not allowed in concatenations.\n                                                                               : ... In instance pic\n   forrow={11\'b000_0000_0000,rowaddr/2};\n                                    ^\n%Warning-WIDTHCONCAT: data/full_repos/permissive/167632244/FlappyBird/pic.v:130: Unsized numbers/parameters not allowed in replications.\n                                                                               : ... In instance pic\n   forrow={11\'b000_0000_0000,rowaddr/2};\n                            ^\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:146: Operator SUB expects 32 or 12 bits on the LHS, but LHS\'s REPLICATE generates 10 bits.\n                                                                         : ... In instance pic\n     addr[9:0]=({1\'b0,rowaddr}-birdy)*32+coladdr%32;\n                              ^\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:146: Operator MODDIV expects 32 or 12 bits on the LHS, but LHS\'s VARREF \'coladdr\' generates 10 bits.\n                                                                         : ... In instance pic\n     addr[9:0]=({1\'b0,rowaddr}-birdy)*32+coladdr%32;\n                                                ^\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:146: Operator ASSIGN expects 10 bits on the Assign RHS, but Assign RHS\'s ADD generates 32 or 12 bits.\n                                                                         : ... In instance pic\n     addr[9:0]=({1\'b0,rowaddr}-birdy)*32+coladdr%32;\n              ^\n%Warning-WIDTHCONCAT: data/full_repos/permissive/167632244/FlappyBird/pic.v:150: Unsized numbers/parameters not allowed in concatenations.\n                                                                               : ... In instance pic\n     forrow={11\'b000_0000_0000,rowaddr/2};\n                                      ^\n%Warning-WIDTHCONCAT: data/full_repos/permissive/167632244/FlappyBird/pic.v:150: Unsized numbers/parameters not allowed in replications.\n                                                                               : ... In instance pic\n     forrow={11\'b000_0000_0000,rowaddr/2};\n                              ^\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:175: Operator LT expects 20 bits on the RHS, but RHS\'s CONST \'19\'h280\' generates 19 bits.\n                                                                         : ... In instance pic\n     else if(forcol<19\'d640) begin\n                   ^\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:169: Operator GTE expects 20 bits on the RHS, but RHS\'s CONST \'19\'h780\' generates 19 bits.\n                                                                         : ... In instance pic\n     else if(forcol>=19\'d1920) begin\n                   ^~\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:162: Operator GTE expects 20 bits on the RHS, but RHS\'s CONST \'19\'h280\' generates 19 bits.\n                                                                         : ... In instance pic\n     else if(forcol>=19\'d640&&forcol<19\'d1280) begin\n                   ^~\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:162: Operator LT expects 20 bits on the RHS, but RHS\'s CONST \'19\'h500\' generates 19 bits.\n                                                                         : ... In instance pic\n     else if(forcol>=19\'d640&&forcol<19\'d1280) begin\n                                    ^\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:155: Operator GTE expects 20 bits on the RHS, but RHS\'s CONST \'19\'h500\' generates 19 bits.\n                                                                         : ... In instance pic\n     if(forcol>=19\'d1280&&forcol<19\'d1920) begin\n              ^~\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:155: Operator LT expects 20 bits on the RHS, but RHS\'s CONST \'19\'h780\' generates 19 bits.\n                                                                         : ... In instance pic\n     if(forcol>=19\'d1280&&forcol<19\'d1920) begin\n                                ^\n%Warning-WIDTHCONCAT: data/full_repos/permissive/167632244/FlappyBird/pic.v:184: Unsized numbers/parameters not allowed in concatenations.\n                                                                               : ... In instance pic\n    forrow={11\'b000_0000_0000,rowaddr/2};\n                                     ^\n%Warning-WIDTHCONCAT: data/full_repos/permissive/167632244/FlappyBird/pic.v:184: Unsized numbers/parameters not allowed in replications.\n                                                                               : ... In instance pic\n    forrow={11\'b000_0000_0000,rowaddr/2};\n                             ^\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:208: Operator LT expects 20 bits on the RHS, but RHS\'s CONST \'19\'h280\' generates 19 bits.\n                                                                         : ... In instance pic\n    else if(forcol<19\'d640) begin\n                  ^\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:202: Operator GTE expects 20 bits on the RHS, but RHS\'s CONST \'19\'h780\' generates 19 bits.\n                                                                         : ... In instance pic\n    else if(forcol>=19\'d1920) begin\n                  ^~\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:195: Operator GTE expects 20 bits on the RHS, but RHS\'s CONST \'19\'h280\' generates 19 bits.\n                                                                         : ... In instance pic\n    else if(forcol>=19\'d640&&forcol<19\'d1280) begin\n                  ^~\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:195: Operator LT expects 20 bits on the RHS, but RHS\'s CONST \'19\'h500\' generates 19 bits.\n                                                                         : ... In instance pic\n    else if(forcol>=19\'d640&&forcol<19\'d1280) begin\n                                   ^\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:188: Operator GTE expects 20 bits on the RHS, but RHS\'s CONST \'19\'h500\' generates 19 bits.\n                                                                         : ... In instance pic\n    if(forcol>=19\'d1280&&forcol<19\'d1920) begin\n             ^~\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:188: Operator LT expects 20 bits on the RHS, but RHS\'s CONST \'19\'h780\' generates 19 bits.\n                                                                         : ... In instance pic\n    if(forcol>=19\'d1280&&forcol<19\'d1920) begin\n                               ^\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:143: Operator GTE expects 12 bits on the LHS, but LHS\'s VARREF \'rowaddr\' generates 9 bits.\n                                                                         : ... In instance pic\n   if(coladdr>=0&&coladdr<=32&&rowaddr>=birdy&&rowaddr<birdy+32) begin\n                                      ^~\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:143: Operator LT expects 32 or 12 bits on the LHS, but LHS\'s VARREF \'rowaddr\' generates 9 bits.\n                                                                         : ... In instance pic\n   if(coladdr>=0&&coladdr<=32&&rowaddr>=birdy&&rowaddr<birdy+32) begin\n                                                      ^\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:276: Operator LT expects 20 bits on the RHS, but RHS\'s CONST \'19\'h280\' generates 19 bits.\n                                                                         : ... In instance pic\n   else if(judgecol<19\'d640) begin\n                   ^\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:260: Operator GTE expects 20 bits on the RHS, but RHS\'s CONST \'19\'h780\' generates 19 bits.\n                                                                         : ... In instance pic\n   else if(judgecol>=19\'d1920)begin\n                   ^~\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:243: Operator GTE expects 20 bits on the RHS, but RHS\'s CONST \'19\'h280\' generates 19 bits.\n                                                                         : ... In instance pic\n   else if(judgecol>=19\'d640&&judgecol<19\'d1280) begin\n                   ^~\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:243: Operator LT expects 20 bits on the RHS, but RHS\'s CONST \'19\'h500\' generates 19 bits.\n                                                                         : ... In instance pic\n   else if(judgecol>=19\'d640&&judgecol<19\'d1280) begin\n                                      ^\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:225: Operator GTE expects 20 bits on the RHS, but RHS\'s CONST \'19\'h500\' generates 19 bits.\n                                                                         : ... In instance pic\n   if(judgecol>=19\'d1280&&judgecol<19\'d1920) begin\n              ^~\n%Warning-WIDTH: data/full_repos/permissive/167632244/FlappyBird/pic.v:225: Operator LT expects 20 bits on the RHS, but RHS\'s CONST \'19\'h780\' generates 19 bits.\n                                                                         : ... In instance pic\n   if(judgecol>=19\'d1280&&judgecol<19\'d1920) begin\n                                  ^\n%Error: data/full_repos/permissive/167632244/FlappyBird/pic.v:313: Cannot find file containing module: \'backpic\'\n backpic forback(.clka(clkdiv[1]),.addra(addr[18:0]),.douta(back[11:0]));\n ^~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/167632244/FlappyBird,data/full_repos/permissive/167632244/backpic\n             data/full_repos/permissive/167632244/FlappyBird,data/full_repos/permissive/167632244/backpic.v\n             data/full_repos/permissive/167632244/FlappyBird,data/full_repos/permissive/167632244/backpic.sv\n             backpic\n             backpic.v\n             backpic.sv\n             obj_dir/backpic\n             obj_dir/backpic.v\n             obj_dir/backpic.sv\n%Error: data/full_repos/permissive/167632244/FlappyBird/pic.v:314: Cannot find file containing module: \'birdpic\'\n birdpic forbird(.a(addr[9:0]),.spo(bird[11:0]));\n ^~~~~~~\n%Error: Exiting due to 2 error(s), 31 warning(s)\n'
module pic(
	input clk,                      
	input clrn,
	input wire [8:0]rowaddr,
	input wire [9:0]coladdr,
	input wire [9:0]keydata,
	output wire [11:0]outRGB,
	output death,
	output wire [11:0]wintime
    );

	
	reg judgedeath;                 
	reg [11:0]recordwintime=0;
	
	reg [19:0]forrow;
	reg [19:0]forcol;
	reg [19:0]judgecol;
	
	reg [19:0]addr;
	
	wire [11:0] bird;
	wire [11:0] back;
	
	reg [11:0] RGB;
	
	reg isbird=1'b0;
	reg [11:0]birdy;
	
	reg [31:0] clkdiv;
	
	reg [19:0]movepic;

	reg [2:0]judgerestart=0;
	reg judgepause=0;
	
	assign outRGB=RGB;
	assign wintime=recordwintime;
	assign death=judgedeath;
	

	always @(posedge clk) begin
		clkdiv<=clkdiv+1'b1;
	end
	
	

	always @(posedge clkdiv[19]) begin
		if(birdy==450) begin
			birdy=0;
		end
		
		else if(judgepause==0)begin
			birdy=birdy+1;
		end
		
		if(keydata==10'b00_0001_1101) begin
			if(birdy>=10) begin
				birdy=birdy-3;
			end
		end
	
		if(clrn==0||judgerestart==1) begin
			birdy=200;
		end
	end
		
		

	always @(posedge clkdiv[1]) begin
		if(isbird==1) begin
			RGB<=bird;
		end
		else begin 
			RGB<=back;
		end
	end
	

	always @(posedge clkdiv[19]) begin
		if(movepic==1920) begin
			movepic=0;
		end
		else if(judgepause==0)begin
			movepic=movepic+1'b1;
		end
		
		if(clrn==0||judgerestart==1) begin
			movepic=0;
		end
	end
		
	
	always @(posedge clkdiv[1]) begin
		

		if(judgerestart==1) begin
			forrow={11'b000_0000_0000,rowaddr/2};
			forcol={10'b00_0000_0000,coladdr};
			
			forrow=forrow*320;
					
			addr=forrow+forcol/2;
			addr=addr+307200;
		
		end
		

		else if(judgedeath==1) begin
			forrow={11'b000_0000_0000,rowaddr/2};
			forcol={10'b00_0000_0000,coladdr};
			
			forrow=forrow*320;
					
			addr=forrow+forcol/2;
			addr=addr+230402;
		end


		else begin
			

			if(coladdr>=0&&coladdr<=32&&rowaddr>=birdy&&rowaddr<birdy+32) begin

				if(bird!=12'hcc4) begin
					addr[9:0]=({1'b0,rowaddr}-birdy)*32+coladdr%32;
					isbird=1;
				end
				else begin
					forrow={11'b000_0000_0000,rowaddr/2};
					forcol={10'b00_0000_0000,coladdr}+movepic;
				
					isbird=0;
				
					if(forcol>=19'd1280&&forcol<19'd1920) begin
						forcol=forcol-19'd1280;
						forrow=forrow*320;
					
						addr=forrow+forcol/2;
						addr=addr+153600;
					end
					else if(forcol>=19'd640&&forcol<19'd1280) begin
						forcol=forcol-19'd640;
						forrow=forrow*320;
					
						addr=forrow+forcol/2;
						addr=addr+76800;
					end
					else if(forcol>=19'd1920) begin
						forcol=forcol-19'd1920;
						forrow=forrow*320;
					
						addr=forrow+forcol/2;
					end 
					else if(forcol<19'd640) begin
						forrow=forrow*320;
					
						addr=forrow+forcol/2;
					end
				end
			end 

			else begin
				forrow={11'b000_0000_0000,rowaddr/2};
				forcol={10'b00_0000_0000,coladdr}+movepic;
				
				isbird=0;
				if(forcol>=19'd1280&&forcol<19'd1920) begin
					forcol=forcol-19'd1280;
					forrow=forrow*320;
					
					addr=forrow+forcol/2;
					addr=addr+153600;
				end
				else if(forcol>=19'd640&&forcol<19'd1280) begin
					forcol=forcol-19'd640;
					forrow=forrow*320;
					
					addr=forrow+forcol/2;
					addr=addr+76800;
				end
				else if(forcol>=19'd1920) begin
					forcol=forcol-19'd1920;
					forrow=forrow*320;
					
					addr=forrow+forcol/2;
				end 
				else if(forcol<19'd640) begin
					forrow=forrow*320;
					
					addr=forrow+forcol/2;
				end
			end				
		end
	end
	
	

	always @(posedge clkdiv[1]) begin
		judgecol={10'b00_0000_0000,coladdr}+movepic;



		if(coladdr>=0&&coladdr<32) begin
			if(judgecol>=19'd1280&&judgecol<19'd1920) begin
				
				judgecol=judgecol-19'd1280;
				if(judgecol>=120&&judgecol<=195) begin
					if((birdy+30>=360)||(birdy+2<=280))
							judgedeath=1'b1;
				end
				if(forcol>=440&&forcol<=520)begin
					if((birdy+30>=400)||(birdy+2<=320))
						judgedeath=1'b1;
				end
				
				if((judgecol==200||judgecol==520)&&rowaddr==1&&judgedeath==0)begin
					recordwintime=recordwintime+1;
				end
			end
			
			
			else if(judgecol>=19'd640&&judgecol<19'd1280) begin
				
				judgecol=judgecol-19'd640;
				if(judgecol>=110&&judgecol<=200) begin
					if((birdy+30>=180)||(birdy+2<=100))
							judgedeath=1'b1;
				end
				if(forcol>=440&&forcol<=520)begin
						if((birdy+30>=140)||(birdy+2<=60))
							judgedeath=1'b1;
				end
			
				if((judgecol==200||judgecol==520)&&rowaddr==1&&judgedeath==0)begin
					recordwintime=recordwintime+1;
				end
			end
			
			else if(judgecol>=19'd1920)begin
				judgecol=judgecol-19'd1920;
				
				if(judgecol>=120&&judgecol<=195)begin
					if((birdy+30>=280)||(birdy+2<=200))
						judgedeath=1'b1;
				end
				if(judgecol>=440&&judgecol<=520)begin
					if((birdy+30>=340)||(birdy+2<=240))
						judgedeath=1'b1;
				end
				if((judgecol==200||judgecol==520)&&rowaddr==1&&judgedeath==0)begin
					recordwintime=recordwintime+1;
				end
			end
			
			else if(judgecol<19'd640) begin
				if(judgecol>=120&&judgecol<=195)begin
					if((birdy+30>=280)||(birdy+2<=200))
						judgedeath=1'b1;
				end
				if(judgecol>=440&&judgecol<=520)begin
					if((birdy+30>=340)||(birdy+2<=240))
						judgedeath=1'b1;
				end
				if((judgecol==200||judgecol==520)&&rowaddr==1&&judgedeath==0)begin
					recordwintime=recordwintime+1;
			 end
			end
		end



		if(keydata==10'b00_0001_1011||clrn==0) begin
			recordwintime=0;
			judgedeath=1'b0;
			if(clrn==0) begin
				judgerestart=1;
			end
		end
					

		if(keydata==10'b00_0001_1100) begin
			judgerestart=0;
		end
		
		if(keydata==10'b00_0100_1101) begin
			judgepause=~judgepause;
		end

	end
		
				
	backpic forback(.clka(clkdiv[1]),.addra(addr[18:0]),.douta(back[11:0]));
	birdpic forbird(.a(addr[9:0]),.spo(bird[11:0]));
	


endmodule
module pic(
	input clk,                      
	input clrn,
	input wire [8:0]rowaddr,
	input wire [9:0]coladdr,
	input wire [9:0]keydata,
	output wire [11:0]outRGB,
	output death,
	output wire [11:0]wintime
    );


	
	reg judgedeath;                 
	reg [11:0]recordwintime=0;
	
	reg [19:0]forrow;
	reg [19:0]forcol;
	reg [19:0]judgecol;
	
	reg [19:0]addr;
	
	wire [11:0] bird;
	wire [11:0] back;
	
	reg [11:0] RGB;
	
	reg isbird=1'b0;
	reg [11:0]birdy;
	
	reg [31:0] clkdiv;
	
	reg [19:0]movepic;

	reg [2:0]judgerestart=0;
	reg judgepause=0;
	
	assign outRGB=RGB;
	assign wintime=recordwintime;
	assign death=judgedeath;
	

	always @(posedge clk) begin
		clkdiv<=clkdiv+1'b1;
	end
	
	

	always @(posedge clkdiv[19]) begin
		if(birdy==450) begin
			birdy=0;
		end
		
		else if(judgepause==0)begin
			birdy=birdy+1;
		end
		
		if(keydata==10'b00_0001_1101) begin
			if(birdy>=10) begin
				birdy=birdy-3;
			end
		end
	
		if(clrn==0||judgerestart==1) begin
			birdy=200;
		end
	end
		
		

	always @(posedge clkdiv[1]) begin
		if(isbird==1) begin
			RGB<=bird;
		end
		else begin 
			RGB<=back;
		end
	end
	

	always @(posedge clkdiv[19]) begin
		if(movepic==1920) begin
			movepic=0;
		end
		else if(judgepause==0)begin
			movepic=movepic+1'b1;
		end
		
		if(clrn==0||judgerestart==1) begin
			movepic=0;
		end
	end
		
	
	always @(posedge clkdiv[1]) begin
		

		if(judgerestart==1) begin
			forrow={11'b000_0000_0000,rowaddr/2};
			forcol={10'b00_0000_0000,coladdr};
			
			forrow=forrow*320;
					
			addr=forrow+forcol/2;
			addr=addr+307200;
		
		end
		

		else if(judgedeath==1) begin
			forrow={11'b000_0000_0000,rowaddr/2};
			forcol={10'b00_0000_0000,coladdr};
			
			forrow=forrow*320;
					
			addr=forrow+forcol/2;
			addr=addr+230402;
		end


		else begin
			

			if(coladdr>=0&&coladdr<=32&&rowaddr>=birdy&&rowaddr<birdy+32) begin

				if(bird!=12'hcc4) begin
					addr[9:0]=({1'b0,rowaddr}-birdy)*32+coladdr%32;
					isbird=1;
				end
				else begin
					forrow={11'b000_0000_0000,rowaddr/2};
					forcol={10'b00_0000_0000,coladdr}+movepic;
				
					isbird=0;
				
					if(forcol>=19'd1280&&forcol<19'd1920) begin
						forcol=forcol-19'd1280;
						forrow=forrow*320;
					
						addr=forrow+forcol/2;
						addr=addr+153600;
					end
					else if(forcol>=19'd640&&forcol<19'd1280) begin
						forcol=forcol-19'd640;
						forrow=forrow*320;
					
						addr=forrow+forcol/2;
						addr=addr+76800;
					end
					else if(forcol>=19'd1920) begin
						forcol=forcol-19'd1920;
						forrow=forrow*320;
					
						addr=forrow+forcol/2;
					end 
					else if(forcol<19'd640) begin
						forrow=forrow*320;
					
						addr=forrow+forcol/2;
					end
				end
			end 

			else begin
				forrow={11'b000_0000_0000,rowaddr/2};
				forcol={10'b00_0000_0000,coladdr}+movepic;
				
				isbird=0;
				if(forcol>=19'd1280&&forcol<19'd1920) begin
					forcol=forcol-19'd1280;
					forrow=forrow*320;
					
					addr=forrow+forcol/2;
					addr=addr+153600;
				end
				else if(forcol>=19'd640&&forcol<19'd1280) begin
					forcol=forcol-19'd640;
					forrow=forrow*320;
					
					addr=forrow+forcol/2;
					addr=addr+76800;
				end
				else if(forcol>=19'd1920) begin
					forcol=forcol-19'd1920;
					forrow=forrow*320;
					
					addr=forrow+forcol/2;
				end 
				else if(forcol<19'd640) begin
					forrow=forrow*320;
					
					addr=forrow+forcol/2;
				end
			end				
		end
	end
	
	

	always @(posedge clkdiv[1]) begin
		judgecol={10'b00_0000_0000,coladdr}+movepic;



		if(coladdr>=0&&coladdr<32) begin
			if(judgecol>=19'd1280&&judgecol<19'd1920) begin
				
				judgecol=judgecol-19'd1280;
				if(judgecol>=120&&judgecol<=195) begin
					if((birdy+30>=360)||(birdy+2<=280))
							judgedeath=1'b1;
				end
				if(forcol>=440&&forcol<=520)begin
					if((birdy+30>=400)||(birdy+2<=320))
						judgedeath=1'b1;
				end
				
				if((judgecol==200||judgecol==520)&&rowaddr==1&&judgedeath==0)begin
					recordwintime=recordwintime+1;
				end
			end
			
			
			else if(judgecol>=19'd640&&judgecol<19'd1280) begin
				
				judgecol=judgecol-19'd640;
				if(judgecol>=110&&judgecol<=200) begin
					if((birdy+30>=180)||(birdy+2<=100))
							judgedeath=1'b1;
				end
				if(forcol>=440&&forcol<=520)begin
						if((birdy+30>=140)||(birdy+2<=60))
							judgedeath=1'b1;
				end
			
				if((judgecol==200||judgecol==520)&&rowaddr==1&&judgedeath==0)begin
					recordwintime=recordwintime+1;
				end
			end
			
			else if(judgecol>=19'd1920)begin
				judgecol=judgecol-19'd1920;
				
				if(judgecol>=120&&judgecol<=195)begin
					if((birdy+30>=280)||(birdy+2<=200))
						judgedeath=1'b1;
				end
				if(judgecol>=440&&judgecol<=520)begin
					if((birdy+30>=340)||(birdy+2<=240))
						judgedeath=1'b1;
				end
				if((judgecol==200||judgecol==520)&&rowaddr==1&&judgedeath==0)begin
					recordwintime=recordwintime+1;
				end
			end
			
			else if(judgecol<19'd640) begin
				if(judgecol>=120&&judgecol<=195)begin
					if((birdy+30>=280)||(birdy+2<=200))
						judgedeath=1'b1;
				end
				if(judgecol>=440&&judgecol<=520)begin
					if((birdy+30>=340)||(birdy+2<=240))
						judgedeath=1'b1;
				end
				if((judgecol==200||judgecol==520)&&rowaddr==1&&judgedeath==0)begin
					recordwintime=recordwintime+1;
			 end
			end
		end



		if(keydata==10'b00_0001_1011||clrn==0) begin
			recordwintime=0;
			judgedeath=1'b0;
			if(clrn==0) begin
				judgerestart=1;
			end
		end
					

		if(keydata==10'b00_0001_1100) begin
			judgerestart=0;
		end
		
		if(keydata==10'b00_0100_1101) begin
			judgepause=~judgepause;
		end

	end
		
				
	backpic forback(.clka(clkdiv[1]),.addra(addr[18:0]),.douta(back[11:0]));
	birdpic forbird(.a(addr[9:0]),.spo(bird[11:0]));
	


endmodule