data/full_repos/permissive/141175658/snake_top_level.v
 line:84: before: "."
1: b'%Warning-PINMISSING: data/full_repos/permissive/141175658/snake_top_level.v:116: Cell has missing pin: \'release_direction\'\n  datapath d0(\n           ^~\n                     ... Use "/* verilator lint_off PINMISSING */" and lint_on around source to disable this message.\n%Warning-IMPLICIT: data/full_repos/permissive/141175658/snake_top_level.v:118: Signal definition not found, creating implicitly: \'game_reset\'\n    .game_reset(game_reset),\n                ^~~~~~~~~~\n%Warning-IMPLICIT: data/full_repos/permissive/141175658/snake_top_level.v:123: Signal definition not found, creating implicitly: \'inlevelDisplay\'\n    .inlevelDisplay(inlevelDisplay),\n                    ^~~~~~~~~~~~~~\n%Warning-IMPLICIT: data/full_repos/permissive/141175658/snake_top_level.v:130: Signal definition not found, creating implicitly: \'initial_head\'\n                                                                             : ... Suggested alternative: \'initial_game\'\n    .initial_head(initial_head),\n                  ^~~~~~~~~~~~\n%Warning-IMPLICIT: data/full_repos/permissive/141175658/snake_top_level.v:132: Signal definition not found, creating implicitly: \'finished_displaying_level\'\n    .finished_displaying_level(finished_displaying_level),\n                               ^~~~~~~~~~~~~~~~~~~~~~~~~\n%Warning-IMPLICIT: data/full_repos/permissive/141175658/snake_top_level.v:133: Signal definition not found, creating implicitly: \'continue_reset\'\n    .continue_reset(continue_reset),\n                    ^~~~~~~~~~~~~~\n%Warning-IMPLICIT: data/full_repos/permissive/141175658/snake_top_level.v:134: Signal definition not found, creating implicitly: \'next_level\'\n    .next_level(next_level),\n                ^~~~~~~~~~\n%Warning-WIDTH: data/full_repos/permissive/141175658/snake_top_level.v:862: Operator EQCASE expects 32 bits on the LHS, but LHS\'s VARREF \'x_counter\' generates 8 bits.\n                                                                          : ... In instance snake_top_level.d0.ref0\n  if(x_counter === max_width)\n               ^~~\n%Warning-WIDTH: data/full_repos/permissive/141175658/snake_top_level.v:872: Operator EQCASE expects 32 bits on the LHS, but LHS\'s VARREF \'y_counter\' generates 7 bits.\n                                                                          : ... In instance snake_top_level.d0.ref0\n   if(y_counter === max_height)\n                ^~~\n%Warning-WIDTH: data/full_repos/permissive/141175658/snake_top_level.v:870: Operator EQCASE expects 32 bits on the LHS, but LHS\'s VARREF \'x_counter\' generates 8 bits.\n                                                                          : ... In instance snake_top_level.d0.ref0\n  if(x_counter === max_width)\n               ^~~\n%Warning-WIDTH: data/full_repos/permissive/141175658/snake_top_level.v:671: Operator EQCASE expects 32 bits on the LHS, but LHS\'s VARREF \'rand_X\' generates 8 bits.\n                                                                          : ... In instance snake_top_level.d0.rand2\n  if(rand_X === max_width)\n            ^~~\n%Warning-WIDTH: data/full_repos/permissive/141175658/snake_top_level.v:681: Operator EQCASE expects 32 bits on the LHS, but LHS\'s VARREF \'rand_Y\' generates 7 bits.\n                                                                          : ... In instance snake_top_level.d0.rand2\n   if(rand_Y === max_height)\n             ^~~\n%Warning-WIDTH: data/full_repos/permissive/141175658/snake_top_level.v:679: Operator EQCASE expects 32 bits on the LHS, but LHS\'s VARREF \'rand_X\' generates 8 bits.\n                                                                          : ... In instance snake_top_level.d0.rand2\n  if(rand_X === max_width)\n            ^~~\n%Warning-WIDTH: data/full_repos/permissive/141175658/snake_top_level.v:640: Operator EQCASE expects 32 bits on the LHS, but LHS\'s VARREF \'rand_X\' generates 8 bits.\n                                                                          : ... In instance snake_top_level.d0.rand1\n  if(rand_X === max_width)\n            ^~~\n%Warning-WIDTH: data/full_repos/permissive/141175658/snake_top_level.v:650: Operator EQCASE expects 32 bits on the LHS, but LHS\'s VARREF \'rand_Y\' generates 7 bits.\n                                                                          : ... In instance snake_top_level.d0.rand1\n   if(rand_Y === max_height)\n             ^~~\n%Warning-WIDTH: data/full_repos/permissive/141175658/snake_top_level.v:648: Operator EQCASE expects 32 bits on the LHS, but LHS\'s VARREF \'rand_X\' generates 8 bits.\n                                                                          : ... In instance snake_top_level.d0.rand1\n  if(rand_X === max_width)\n            ^~~\n%Warning-WIDTH: data/full_repos/permissive/141175658/snake_top_level.v:742: Operator NEQ expects 11 bits on the RHS, but RHS\'s CONST \'8\'hf0\' generates 8 bits.\n                                                                          : ... In instance snake_top_level.kbIn\n   if(previousCode != 8\'hF0)begin\n                   ^~\n%Warning-WIDTH: data/full_repos/permissive/141175658/snake_top_level.v:746: Operator EQ expects 11 bits on the RHS, but RHS\'s CONST \'8\'hf0\' generates 8 bits.\n                                                                          : ... In instance snake_top_level.kbIn\n   if(previousCode == 8\'hF0)begin\n                   ^~\n%Warning-WIDTH: data/full_repos/permissive/141175658/snake_top_level.v:752: Operator ASSIGN expects 11 bits on the Assign RHS, but Assign RHS\'s SEL generates 8 bits.\n                                                                          : ... In instance snake_top_level.kbIn\n   previousCode = keyCode[8:1];\n                ^\n%Warning-WIDTH: data/full_repos/permissive/141175658/snake_top_level.v:809: Operator EQ expects 11 bits on the RHS, but RHS\'s CONST \'8\'hf0\' generates 8 bits.\n                                                                          : ... In instance snake_top_level.kbIn\n  if(previousCode == 8\'hF0) begin\n                  ^~\n%Error: data/full_repos/permissive/141175658/snake_top_level.v:296: Cannot find file containing module: \'logo_text_setter\'\n logo_text_setter logo0(clk, inLogoDisplay,x_pointer, y_pointer, logo_text);\n ^~~~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/141175658,data/full_repos/permissive/141175658/logo_text_setter\n             data/full_repos/permissive/141175658,data/full_repos/permissive/141175658/logo_text_setter.v\n             data/full_repos/permissive/141175658,data/full_repos/permissive/141175658/logo_text_setter.sv\n             logo_text_setter\n             logo_text_setter.v\n             logo_text_setter.sv\n             obj_dir/logo_text_setter\n             obj_dir/logo_text_setter.v\n             obj_dir/logo_text_setter.sv\n%Error: data/full_repos/permissive/141175658/snake_top_level.v:297: Cannot find file containing module: \'menu_text_setter\'\n menu_text_setter menu0(clk, inmenu, x_pointer, y_pointer, menu_text);\n ^~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/141175658/snake_top_level.v:298: Cannot find file containing module: \'game_text_setter\'\n game_text_setter gametxt0(clk, score, hiscore, ingame, main_difficulty, x_pointer, y_pointer, game_text);\n ^~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/141175658/snake_top_level.v:299: Cannot find file containing module: \'result_text_setter\'\n result_text_setter restxt0(clk, score, inresult, main_difficulty, x_pointer, y_pointer, result_text);\n ^~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/141175658/snake_top_level.v:300: Cannot find file containing module: \'level_text_setter\'\n level_text_setter lvltxt0(clk, game_reset, inlevelDisplay, current_level, main_difficulty, x_pointer, y_pointer, level_text, finished_displaying_level);\n ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/141175658/snake_top_level.v:301: Cannot find file containing module: \'game_barrier_setter\'\n game_barrier_setter gamebar0(clk, ingame, current_level, x_pointer, y_pointer, barrier);\n ^~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/141175658/snake_top_level.v:302: Cannot find file containing module: \'level_chooser\'\n level_chooser lvlchoose0(clk, inLevelChooser, release_up, release_down, enter, x_pointer, y_pointer, chooser_text, level_chosen);\n ^~~~~~~~~~~~~\n%Warning-WIDTH: data/full_repos/permissive/141175658/snake_top_level.v:406: Operator SUB expects 32 bits on the LHS, but LHS\'s VARREF \'size\' generates 7 bits.\n                                                                          : ... In instance snake_top_level.d0\n       if(bodycounter2 <= size - 1)begin\n                               ^\n%Error: data/full_repos/permissive/141175658/snake_top_level.v:68: Cannot find file containing module: \'vga_adapter\'\n vga_adapter VGA(\n ^~~~~~~~~~~\n%Error: Exiting due to 8 error(s), 21 warning(s)\n'
module Controller(
	input reset_n,
	input clk,
	output LEDdebug,


	input [4:0] direction,
	input [4:0] number_input,
	input finished_displaying_level, next_level,

	input game_over,
	input any_touched,
	input direction_touched,
	input level_chosen,
	output reg inLevelChooser,
	output reg inmenu,
	output reg ingame,
	output reg inresult,
	output reg inLogoDisplay,
	output reg inlevelDisplay,
	output reg initial_game,
	output reg initial_head,
	output reg choose_initial_level,
	output reg game_reset,
	output reg continue_reset,
	output reg allow_moving,


	output reg [3:0] main_difficulty

);
   assign LEDdebug = allow_moving;
   wire number_touched = (number_input == 5'b00010
									||number_input == 5'b00100
								   ||number_input == 5'b01000);





	reg [3:0] current_state, next_state;
	
   localparam GLOBAL_WAIT = 4'd0,
				  LOGO = 4'd1,
				  INIT = 4'd2,
	           MENU = 4'd3,
				  LEVEL_CHOOSE = 4'd4,
				  LEVEL_DISPLAY = 4'd5,
				  GAME_INIT = 4'd6,
				  GAME_WAIT = 4'd7,
				  INGAME = 4'd8,
				  GAME_OVER = 4'd9;

	always@(*)
      begin: state_table 
            case (current_state)
					GLOBAL_WAIT: next_state = LOGO;
					LOGO: next_state = (any_touched) ? INIT : LOGO;
					INIT: next_state = MENU;
					MENU: next_state = (number_touched) ? LEVEL_CHOOSE : MENU;
					LEVEL_CHOOSE: next_state = (level_chosen) ? LEVEL_DISPLAY : LEVEL_CHOOSE;
					LEVEL_DISPLAY: next_state = (finished_displaying_level) ? GAME_INIT : LEVEL_DISPLAY; 
					GAME_INIT: next_state = GAME_WAIT;
					GAME_WAIT: next_state = (direction_touched) ? INGAME : GAME_WAIT;
					INGAME: begin
						if (next_level)
							next_state = LEVEL_DISPLAY;
						else if (game_over)
							next_state = GAME_OVER;
						else if (reset_n)
							next_state = INIT; 
						else
							next_state = INGAME;
					end
					GAME_OVER: begin
						if (number_input == 5'b00010)
							next_state = LEVEL_DISPLAY;
						else if (reset_n)
							next_state = INIT;
						else
							next_state = GAME_OVER;
					end
            default: next_state = INIT;
        endcase
      end 
	
	always@(posedge clk)begin
		if (current_state == MENU) begin
				if (number_input == 5'b00010)
					main_difficulty <= 4'd4;
				else if (number_input == 5'b00100)
					main_difficulty <= 4'd2;
				else
					main_difficulty <= 4'd1;
		end
	end
	
	always@(posedge clk)begin
		continue_reset = 0;
		if (current_state == GAME_OVER) begin
				if (number_input == 5'b00010)
					continue_reset = 1;
		end
	end
		
	always@(*) begin
		    inLogoDisplay = 1'b0;
	       inmenu = 1'b0;
	       ingame = 1'b0;
			 inresult = 1'b0;
			 inlevelDisplay = 1'b0;
			 allow_moving = 1'b0;
			 initial_game = 1'b0;
			 initial_head = 1'b0;
			 game_reset = 1'b0;
			 inLevelChooser = 1'b0;
			 choose_initial_level = 1'b0;
		  case(current_state)
				LOGO:begin
						inLogoDisplay = 1'b1;
				end
				INIT:begin
					   game_reset = 1'b1;
				end
		      MENU:begin
				      inmenu = 1'b1;
					end
				LEVEL_CHOOSE:begin
						inLevelChooser = 1'b1;
						choose_initial_level = 1'b1;
				end
				LEVEL_DISPLAY:begin
						inlevelDisplay = 1'b1;
				end
				GAME_INIT:begin
						initial_game = 1'b1;
				end
				GAME_WAIT:begin
				      ingame = 1'b1;
						initial_head = 1'b1;
				end
				INGAME:begin
				      ingame = 1'b1;
						allow_moving = 1'b1;
					end
				GAME_OVER: begin
						inresult = 1'b1;
					end
		  endcase
     end
	
	always@(posedge clk)
      begin
            current_state <= next_state;
      end 
endmodule
module Controller(
	input reset_n,
	input clk,
	output LEDdebug,


	input [4:0] direction,
	input [4:0] number_input,
	input finished_displaying_level, next_level,

	input game_over,
	input any_touched,
	input direction_touched,
	input level_chosen,
	output reg inLevelChooser,
	output reg inmenu,
	output reg ingame,
	output reg inresult,
	output reg inLogoDisplay,
	output reg inlevelDisplay,
	output reg initial_game,
	output reg initial_head,
	output reg choose_initial_level,
	output reg game_reset,
	output reg continue_reset,
	output reg allow_moving,


	output reg [3:0] main_difficulty

);

   assign LEDdebug = allow_moving;
   wire number_touched = (number_input == 5'b00010
									||number_input == 5'b00100
								   ||number_input == 5'b01000);





	reg [3:0] current_state, next_state;
	
   localparam GLOBAL_WAIT = 4'd0,
				  LOGO = 4'd1,
				  INIT = 4'd2,
	           MENU = 4'd3,
				  LEVEL_CHOOSE = 4'd4,
				  LEVEL_DISPLAY = 4'd5,
				  GAME_INIT = 4'd6,
				  GAME_WAIT = 4'd7,
				  INGAME = 4'd8,
				  GAME_OVER = 4'd9;

	always@(*)
      begin: state_table 
            case (current_state)
					GLOBAL_WAIT: next_state = LOGO;
					LOGO: next_state = (any_touched) ? INIT : LOGO;
					INIT: next_state = MENU;
					MENU: next_state = (number_touched) ? LEVEL_CHOOSE : MENU;
					LEVEL_CHOOSE: next_state = (level_chosen) ? LEVEL_DISPLAY : LEVEL_CHOOSE;
					LEVEL_DISPLAY: next_state = (finished_displaying_level) ? GAME_INIT : LEVEL_DISPLAY; 
					GAME_INIT: next_state = GAME_WAIT;
					GAME_WAIT: next_state = (direction_touched) ? INGAME : GAME_WAIT;
					INGAME: begin
						if (next_level)
							next_state = LEVEL_DISPLAY;
						else if (game_over)
							next_state = GAME_OVER;
						else if (reset_n)
							next_state = INIT; 
						else
							next_state = INGAME;
					end
					GAME_OVER: begin
						if (number_input == 5'b00010)
							next_state = LEVEL_DISPLAY;
						else if (reset_n)
							next_state = INIT;
						else
							next_state = GAME_OVER;
					end
            default: next_state = INIT;
        endcase
      end 
	
	always@(posedge clk)begin
		if (current_state == MENU) begin
				if (number_input == 5'b00010)
					main_difficulty <= 4'd4;
				else if (number_input == 5'b00100)
					main_difficulty <= 4'd2;
				else
					main_difficulty <= 4'd1;
		end
	end
	
	always@(posedge clk)begin
		continue_reset = 0;
		if (current_state == GAME_OVER) begin
				if (number_input == 5'b00010)
					continue_reset = 1;
		end
	end
		
	always@(*) begin
		    inLogoDisplay = 1'b0;
	       inmenu = 1'b0;
	       ingame = 1'b0;
			 inresult = 1'b0;
			 inlevelDisplay = 1'b0;
			 allow_moving = 1'b0;
			 initial_game = 1'b0;
			 initial_head = 1'b0;
			 game_reset = 1'b0;
			 inLevelChooser = 1'b0;
			 choose_initial_level = 1'b0;
		  case(current_state)
				LOGO:begin
						inLogoDisplay = 1'b1;
				end
				INIT:begin
					   game_reset = 1'b1;
				end
		      MENU:begin
				      inmenu = 1'b1;
					end
				LEVEL_CHOOSE:begin
						inLevelChooser = 1'b1;
						choose_initial_level = 1'b1;
				end
				LEVEL_DISPLAY:begin
						inlevelDisplay = 1'b1;
				end
				GAME_INIT:begin
						initial_game = 1'b1;
				end
				GAME_WAIT:begin
				      ingame = 1'b1;
						initial_head = 1'b1;
				end
				INGAME:begin
				      ingame = 1'b1;
						allow_moving = 1'b1;
					end
				GAME_OVER: begin
						inresult = 1'b1;
					end
		  endcase
     end
	
	always@(posedge clk)
      begin
            current_state <= next_state;
      end 
endmodule