data/full_repos/permissive/14349674/animation/GameGod.v
data/verilator_xmls/e8d40f18-ae43-4a7e-9d27-aee6b629012d.xml
module GameGod (clk, start, reset, gameOver, status, initialize, play);


	input clk;
	input start;
	input reset;
	input gameOver;
	



	output [2:0] status;
	output reg initialize;
	output reg play;
	assign status = currState;
	

	localparam 	STATE_INITIAL = 3'b000,
					STATE_START = 3'b001,
					STATE_GAMEOVER = 3'b010,
					STATE_ERR = 3'b011;
	

	reg [2:0] currState;
	reg [2:0] nextState;
	

	always @ (*) begin
		case (currState)
			STATE_INITIAL : begin
				initialize = 1;
				play = 0;
			end
			STATE_START :  begin
				initialize = 0;
				play = 1;
			end
			STATE_GAMEOVER :  begin
				initialize = 0;
				play = 0;
			end
			default :  begin
				initialize = 0;
				play = 0;
			end
		endcase
	end
	

	always @ (posedge clk) begin
		if (reset) 
			currState <= STATE_INITIAL;
		else
			currState <= nextState;
	end
	

	always @ (*) begin
		nextState = currState;
		case (currState)	
			STATE_INITIAL : begin
				if (start)
					nextState = STATE_START;
				else
					nextState = STATE_INITIAL;
			end
			STATE_START : begin
				if (gameOver)
					nextState = STATE_GAMEOVER;
				else
					nextState = STATE_START;		
			end
			STATE_GAMEOVER : begin
				if (reset)
					nextState = STATE_INITIAL;
				else
					nextState = STATE_GAMEOVER;
			end
			default : begin
				nextState = STATE_ERR;
			end
		endcase
	end
	
endmodule
module GameGod (clk, start, reset, gameOver, status, initialize, play);



	input clk;
	input start;
	input reset;
	input gameOver;
	



	output [2:0] status;
	output reg initialize;
	output reg play;
	assign status = currState;
	

	localparam 	STATE_INITIAL = 3'b000,
					STATE_START = 3'b001,
					STATE_GAMEOVER = 3'b010,
					STATE_ERR = 3'b011;
	

	reg [2:0] currState;
	reg [2:0] nextState;
	

	always @ (*) begin
		case (currState)
			STATE_INITIAL : begin
				initialize = 1;
				play = 0;
			end
			STATE_START :  begin
				initialize = 0;
				play = 1;
			end
			STATE_GAMEOVER :  begin
				initialize = 0;
				play = 0;
			end
			default :  begin
				initialize = 0;
				play = 0;
			end
		endcase
	end
	

	always @ (posedge clk) begin
		if (reset) 
			currState <= STATE_INITIAL;
		else
			currState <= nextState;
	end
	

	always @ (*) begin
		nextState = currState;
		case (currState)	
			STATE_INITIAL : begin
				if (start)
					nextState = STATE_START;
				else
					nextState = STATE_INITIAL;
			end
			STATE_START : begin
				if (gameOver)
					nextState = STATE_GAMEOVER;
				else
					nextState = STATE_START;		
			end
			STATE_GAMEOVER : begin
				if (reset)
					nextState = STATE_INITIAL;
				else
					nextState = STATE_GAMEOVER;
			end
			default : begin
				nextState = STATE_ERR;
			end
		endcase
	end
	
endmodule