data/full_repos/permissive/176151176/control_master.v
1: b"%Error: data/full_repos/permissive/176151176/control_master.v:409: Cannot find file containing module: 'counter5x5'\n counter5x5 c0(.q(loc), .clock(clock), .reset_n(reset_n), .enable(count5x5_en));\n ^~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/176151176,data/full_repos/permissive/176151176/counter5x5\n             data/full_repos/permissive/176151176,data/full_repos/permissive/176151176/counter5x5.v\n             data/full_repos/permissive/176151176,data/full_repos/permissive/176151176/counter5x5.sv\n             counter5x5\n             counter5x5.v\n             counter5x5.sv\n             obj_dir/counter5x5\n             obj_dir/counter5x5.v\n             obj_dir/counter5x5.sv\n%Error: data/full_repos/permissive/176151176/control_master.v:35: Cannot find file containing module: 'score_alu'\n score_alu alu(.score(score),\n ^~~~~~~~~\n%Error: data/full_repos/permissive/176151176/control_master.v:41: Cannot find file containing module: 'random_generator'\n random_generator rng(.clock(clock_div),\n ^~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176151176/control_master.v:45: Cannot find file containing module: 'rate_divider'\n rate_divider div(.q(clock_div),\n ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/176151176/control_master.v:79: Cannot find file containing module: 'data5x5'\n data5x5 pac_data(.col_out(col_pac),\n ^~~~~~~\n%Error: data/full_repos/permissive/176151176/control_master.v:92: Cannot find file containing module: 'control_pacman'\n control_pacman pac_control(.shape(shape_pac_bus),\n ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176151176/control_master.v:104: Cannot find file containing module: 'data5x5'\n data5x5 pellet_data(.col_out(col_pellet),\n ^~~~~~~\n%Error: data/full_repos/permissive/176151176/control_master.v:117: Cannot find file containing module: 'pellet_shaper'\n pellet_shaper pellet_shape(.shape(shape_pellet_bus),\n ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176151176/control_master.v:121: Cannot find file containing module: 'control_pellet'\n control_pellet pellet_control(.done_out(done_init),\n ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176151176/control_master.v:136: Cannot find file containing module: 'counter_ghost'\n counter_ghost g1_count(.toggle(g1_toggle), \n ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176151176/control_master.v:154: Cannot find file containing module: 'data5x5'\n data5x5 g1_data(.col_out(col_g1),\n ^~~~~~~\n%Error: data/full_repos/permissive/176151176/control_master.v:167: Cannot find file containing module: 'control_ghost'\n control_ghost g1_control(.clk(clock_div),\n ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176151176/control_master.v:186: Cannot find file containing module: 'data5x5'\n data5x5 g2_data(.col_out(col_g2),\n ^~~~~~~\n%Error: data/full_repos/permissive/176151176/control_master.v:199: Cannot find file containing module: 'control_ghost'\n control_ghost g2_control(.clk(clock_div),\n ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176151176/control_master.v:218: Cannot find file containing module: 'data5x5'\n data5x5 g3_data(.col_out(col_g3),\n ^~~~~~~\n%Error: data/full_repos/permissive/176151176/control_master.v:231: Cannot find file containing module: 'control_ghost'\n control_ghost g3_control(.clk(clock_div),\n ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176151176/control_master.v:251: Cannot find file containing module: 'counter_ghost'\n counter_ghost g4_count(.toggle(g4_toggle), \n ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/176151176/control_master.v:269: Cannot find file containing module: 'data5x5'\n data5x5 g4_data(.col_out(col_g4),\n ^~~~~~~\n%Error: data/full_repos/permissive/176151176/control_master.v:282: Cannot find file containing module: 'control_ghost'\n control_ghost g4_control(.clk(clock_div),\n ^~~~~~~~~~~~~\n%Error: Exiting due to 19 error(s)\n"
module control_game(curr_state, plot_en, clock, reset_n, go, erase, loc, load, new_init, dead, init_done);

	input clock, reset_n, go, new_init, dead, init_done;
	
	output reg plot_en, erase, load;
	output [3:0] curr_state;
	output [5:0] loc;
	
	localparam WAIT = 4'b0000, LOAD = 4'b0001, COMP = 4'b0010, ERASE_PELLET = 4'b0011, ERASE_PAC = 4'b0100, 
				  ERASE_G1 = 4'b0101, PELLET = 4'b0110, PAC = 4'b0111, G1 = 4'b1000, INIT_RAND = 4'b1001,
				  ERASE_G2 = 4'b1010, G2 = 4'b1011, ERASE_G3 = 4'b1100, G3 = 4'b1101, ERASE_G4 = 4'b1110,
				  G4 = 4'b1111, 
				  LOC_MAX = 6'b100100;
	
	reg [3:0] current_state, next_state;
	
	initial current_state = WAIT;
	
	reg count5x5_en;
	
	counter5x5 c0(.q(loc), .clock(clock), .reset_n(reset_n), .enable(count5x5_en));
	
	always @(*) begin
		case(current_state)
			WAIT: next_state = go ? (new_init ? INIT_RAND : ERASE_PELLET) : WAIT;
			INIT_RAND: next_state = init_done ? ERASE_PELLET : INIT_RAND;
			ERASE_PELLET: next_state = (loc == LOC_MAX) ? ERASE_PAC : ERASE_PELLET;
			ERASE_PAC: next_state = (loc == LOC_MAX) ? ERASE_G2 : ERASE_PAC;
			ERASE_G2: next_state = (loc == LOC_MAX) ? ERASE_G3 : ERASE_G2;
			ERASE_G3: next_state = (loc == LOC_MAX) ? ERASE_G4 : ERASE_G3;
			ERASE_G4: next_state = (loc == LOC_MAX) ? ERASE_G1 : ERASE_G4;
			ERASE_G1: next_state = (loc == LOC_MAX) ? (dead ? ERASE_PELLET : LOAD) : ERASE_G1;
			LOAD: next_state = PELLET;
			PELLET: next_state = (loc == LOC_MAX) ? PAC : PELLET;
		   PAC: next_state = (loc == LOC_MAX) ? G2 : PAC;
			G2: next_state = (loc == LOC_MAX) ? G3 : G2;
			G3: next_state = (loc == LOC_MAX) ? G4 : G3;
			G4: next_state = (loc == LOC_MAX) ? G1 : G4;
			G1: next_state = (loc == LOC_MAX) ? COMP : G1;
			COMP: next_state = dead ? ERASE_PELLET : WAIT;
		endcase
	end
	
	always @(*) begin
		count5x5_en = 1'b0;
		erase = 1'b0;
		plot_en = 1'b0;
		load = 1'b0;
		case(current_state)
			WAIT:;
			ERASE_PAC, ERASE_PELLET, ERASE_G1, ERASE_G2, ERASE_G3, ERASE_G4: begin
				count5x5_en = 1'b1;
				plot_en = 1'b1;
				erase = 1'b1;
			end 
			LOAD: load = 1'b1;
			PELLET, PAC, G1, G2, G3, G4: begin
				count5x5_en = 1'b1;
				plot_en = 1'b1;
			end
			COMP:;
		endcase
	end
	
	always @(posedge clock) begin
		if(!reset_n) current_state <= WAIT;
		else current_state <= next_state;
	end
	
	assign curr_state = current_state;
	
endmodule
module control_game(curr_state, plot_en, clock, reset_n, go, erase, loc, load, new_init, dead, init_done);


	input clock, reset_n, go, new_init, dead, init_done;
	
	output reg plot_en, erase, load;
	output [3:0] curr_state;
	output [5:0] loc;
	
	localparam WAIT = 4'b0000, LOAD = 4'b0001, COMP = 4'b0010, ERASE_PELLET = 4'b0011, ERASE_PAC = 4'b0100, 
				  ERASE_G1 = 4'b0101, PELLET = 4'b0110, PAC = 4'b0111, G1 = 4'b1000, INIT_RAND = 4'b1001,
				  ERASE_G2 = 4'b1010, G2 = 4'b1011, ERASE_G3 = 4'b1100, G3 = 4'b1101, ERASE_G4 = 4'b1110,
				  G4 = 4'b1111, 
				  LOC_MAX = 6'b100100;
	
	reg [3:0] current_state, next_state;
	
	initial current_state = WAIT;
	
	reg count5x5_en;
	
	counter5x5 c0(.q(loc), .clock(clock), .reset_n(reset_n), .enable(count5x5_en));
	
	always @(*) begin
		case(current_state)
			WAIT: next_state = go ? (new_init ? INIT_RAND : ERASE_PELLET) : WAIT;
			INIT_RAND: next_state = init_done ? ERASE_PELLET : INIT_RAND;
			ERASE_PELLET: next_state = (loc == LOC_MAX) ? ERASE_PAC : ERASE_PELLET;
			ERASE_PAC: next_state = (loc == LOC_MAX) ? ERASE_G2 : ERASE_PAC;
			ERASE_G2: next_state = (loc == LOC_MAX) ? ERASE_G3 : ERASE_G2;
			ERASE_G3: next_state = (loc == LOC_MAX) ? ERASE_G4 : ERASE_G3;
			ERASE_G4: next_state = (loc == LOC_MAX) ? ERASE_G1 : ERASE_G4;
			ERASE_G1: next_state = (loc == LOC_MAX) ? (dead ? ERASE_PELLET : LOAD) : ERASE_G1;
			LOAD: next_state = PELLET;
			PELLET: next_state = (loc == LOC_MAX) ? PAC : PELLET;
		   PAC: next_state = (loc == LOC_MAX) ? G2 : PAC;
			G2: next_state = (loc == LOC_MAX) ? G3 : G2;
			G3: next_state = (loc == LOC_MAX) ? G4 : G3;
			G4: next_state = (loc == LOC_MAX) ? G1 : G4;
			G1: next_state = (loc == LOC_MAX) ? COMP : G1;
			COMP: next_state = dead ? ERASE_PELLET : WAIT;
		endcase
	end
	
	always @(*) begin
		count5x5_en = 1'b0;
		erase = 1'b0;
		plot_en = 1'b0;
		load = 1'b0;
		case(current_state)
			WAIT:;
			ERASE_PAC, ERASE_PELLET, ERASE_G1, ERASE_G2, ERASE_G3, ERASE_G4: begin
				count5x5_en = 1'b1;
				plot_en = 1'b1;
				erase = 1'b1;
			end 
			LOAD: load = 1'b1;
			PELLET, PAC, G1, G2, G3, G4: begin
				count5x5_en = 1'b1;
				plot_en = 1'b1;
			end
			COMP:;
		endcase
	end
	
	always @(posedge clock) begin
		if(!reset_n) current_state <= WAIT;
		else current_state <= next_state;
	end
	
	assign curr_state = current_state;
	
endmodule