data/full_repos/permissive/105729488/state_machine.v
1: b'%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:91: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s VARREF \'LA_RUE_YELLOW_st\' generates 4 bits.\n                                                                       : ... In instance state_machine\n      state_c = LA_RUE_YELLOW_st;\n              ^\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:96: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s VARREF \'LA_RUE_YELLOW_st\' generates 4 bits.\n                                                                       : ... In instance state_machine\n      state_c = LA_RUE_YELLOW_st;\n              ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:95: Operator GT expects 28 bits on the RHS, but RHS\'s CONST \'4\'h6\' generates 4 bits.\n                                                                       : ... In instance state_machine\n     else if (count > 4\'b0110) begin\n                    ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:90: Operator GTE expects 28 bits on the RHS, but RHS\'s CONST \'4\'h3\' generates 4 bits.\n                                                                       : ... In instance state_machine\n     if ((count >= 4\'b0011) & (count <= 4\'b0110) & la_rue_sensor_ff == 1\'b0) begin\n                ^~\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:90: Operator LTE expects 28 bits on the RHS, but RHS\'s CONST \'4\'h6\' generates 4 bits.\n                                                                       : ... In instance state_machine\n     if ((count >= 4\'b0011) & (count <= 4\'b0110) & la_rue_sensor_ff == 1\'b0) begin\n                                     ^~\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:119: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s VARREF \'PED_WALK_st\' generates 4 bits.\n                                                                        : ... In instance state_machine\n      state_c = PED_WALK_st;\n              ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:124: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s VARREF \'ORCHARD_GREEN_st\' generates 4 bits.\n                                                                        : ... In instance state_machine\n      state_c = ORCHARD_GREEN_st;\n              ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:129: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s VARREF \'LA_RUE_GREEN_st\' generates 4 bits.\n                                                                        : ... In instance state_machine\n      state_c = LA_RUE_GREEN_st;\n              ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:117: Operator GT expects 28 bits on the RHS, but RHS\'s CONST \'4\'h3\' generates 4 bits.\n                                                                        : ... In instance state_machine\n    if (count > 4\'b0011) begin\n              ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:152: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s VARREF \'ORCHARD_YELLOW_st\' generates 4 bits.\n                                                                        : ... In instance state_machine\n      state_c = ORCHARD_YELLOW_st;\n              ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:151: Operator GTE expects 28 bits on the RHS, but RHS\'s CONST \'4\'h3\' generates 4 bits.\n                                                                        : ... In instance state_machine\n     if (count >= 4\'b0011 & orchard_sensor_ff == 1\'b0) begin\n               ^~\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:160: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s VARREF \'ORCHARD_YELLOW_st\' generates 4 bits.\n                                                                        : ... In instance state_machine\n      state_c = ORCHARD_YELLOW_st;\n              ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:166: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s VARREF \'ORCHARD_YELLOW_st\' generates 4 bits.\n                                                                        : ... In instance state_machine\n      state_c = ORCHARD_YELLOW_st;\n              ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:165: Operator GT expects 28 bits on the RHS, but RHS\'s CONST \'4\'h6\' generates 4 bits.\n                                                                        : ... In instance state_machine\n     else if (count > 4\'b0110) begin\n                    ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:159: Operator GTE expects 28 bits on the RHS, but RHS\'s CONST \'4\'h1\' generates 4 bits.\n                                                                        : ... In instance state_machine\n     if (count >= 4\'b0001 & count <= 4\'b0110 & orchard_sensor_ff == 1\'b0) begin  \n               ^~\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:159: Operator LTE expects 28 bits on the RHS, but RHS\'s CONST \'4\'h6\' generates 4 bits.\n                                                                        : ... In instance state_machine\n     if (count >= 4\'b0001 & count <= 4\'b0110 & orchard_sensor_ff == 1\'b0) begin  \n                                  ^~\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:188: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s VARREF \'LA_RUE_GREEN_st\' generates 4 bits.\n                                                                        : ... In instance state_machine\n     state_c = LA_RUE_GREEN_st;  \n             ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:191: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s VARREF \'PED_WALK_st\' generates 4 bits.\n                                                                        : ... In instance state_machine\n      state_c = PED_WALK_st;\n              ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:194: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s VARREF \'ORCHARD_GREEN_st\' generates 4 bits.\n                                                                        : ... In instance state_machine\n      state_c = ORCHARD_GREEN_st;\n              ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:186: Operator GT expects 28 bits on the RHS, but RHS\'s CONST \'4\'h3\' generates 4 bits.\n                                                                        : ... In instance state_machine\n    if (count > 4\'b0011) begin\n              ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:218: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s VARREF \'PED_DONT_WALK_st\' generates 4 bits.\n                                                                        : ... In instance state_machine\n     state_c = PED_DONT_WALK_st;\n             ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:219: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s ADD generates 4 bits.\n                                                                        : ... In instance state_machine\n     flash_count_c = flash_count + 4\'b0001;\n                   ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:217: Operator GT expects 28 bits on the RHS, but RHS\'s CONST \'4\'h8\' generates 4 bits.\n                                                                        : ... In instance state_machine\n    if (count > 4\'b1000) begin  \n              ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:243: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s VARREF \'PED_OFF_st\' generates 4 bits.\n                                                                        : ... In instance state_machine\n     state_c = PED_OFF_st;\n             ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:244: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s ADD generates 4 bits.\n                                                                        : ... In instance state_machine\n     flash_count_c = flash_count + 4\'b0001;\n                   ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:242: Operator GT expects 28 bits on the RHS, but RHS\'s CONST \'4\'h1\' generates 4 bits.\n                                                                        : ... In instance state_machine\n    if (count > 4\'b0001) begin\n              ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:269: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s ADD generates 4 bits.\n                                                                        : ... In instance state_machine\n     flash_count_c = flash_count + 4\'b0001;\n                   ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:270: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s VARREF \'PED_DONT_WALK_st\' generates 4 bits.\n                                                                        : ... In instance state_machine\n     state_c = PED_DONT_WALK_st;\n             ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:281: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s VARREF \'LA_RUE_GREEN_st\' generates 4 bits.\n                                                                        : ... In instance state_machine\n      state_c = LA_RUE_GREEN_st;\n              ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:284: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s CONST \'4\'h0\' generates 4 bits.\n                                                                        : ... In instance state_machine\n      flash_count_c = 4\'b0000;\n                    ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:288: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s VARREF \'ORCHARD_GREEN_st\' generates 4 bits.\n                                                                        : ... In instance state_machine\n      state_c = ORCHARD_GREEN_st;\n              ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:291: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s CONST \'4\'h0\' generates 4 bits.\n                                                                        : ... In instance state_machine\n      flash_count_c = 4\'b0000;\n                    ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:278: Operator GT expects 28 bits on the RHS, but RHS\'s CONST \'4\'h1\' generates 4 bits.\n                                                                        : ... In instance state_machine\n    else if (count > 4\'b0001 & flash_count >= 4\'b0101) begin\n                   ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:278: Operator GTE expects 4 bits on the LHS, but LHS\'s VARREF \'flash_count\' generates 3 bits.\n                                                                        : ... In instance state_machine\n    else if (count > 4\'b0001 & flash_count >= 4\'b0101) begin\n                                           ^~\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:268: Operator GT expects 28 bits on the RHS, but RHS\'s CONST \'4\'h1\' generates 4 bits.\n                                                                        : ... In instance state_machine\n    if (count > 4\'b0001 & flash_count < 4\'b0101) begin\n              ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:268: Operator LT expects 4 bits on the LHS, but LHS\'s VARREF \'flash_count\' generates 3 bits.\n                                                                        : ... In instance state_machine\n    if (count > 4\'b0001 & flash_count < 4\'b0101) begin\n                                      ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:74: Operator CASE expects 4 bits on the Case expression, but Case expression\'s VARREF \'state\' generates 3 bits.\n                                                                       : ... In instance state_machine\n  case (state) \n  ^~~~\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:309: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s CONST \'4\'h0\' generates 4 bits.\n                                                                        : ... In instance state_machine\n   state_c = 4\'b0000;\n           ^\n%Warning-WIDTH: data/full_repos/permissive/105729488/state_machine.v:315: Operator ASSIGN expects 3 bits on the Assign RHS, but Assign RHS\'s CONST \'4\'h0\' generates 4 bits.\n                                                                        : ... In instance state_machine\n   flash_count_c = 4\'b0000;\n                 ^\n%Error: Exiting due to 39 warning(s)\n'
module state_machine(

	clk, reset_n, la_rue_sensor, orchard_sensor, pedestrian_sensor, 
	la_rue_green, la_rue_yellow, la_rue_red, 
	orchard_green, orchard_yellow, orchard_red,
	pedestrian_walk, pedestrian_stop, count, count_c, state, state_c, x, x_c
	
);

	input reset_n;
	input clk;
	input la_rue_sensor, orchard_sensor, pedestrian_sensor;
	

	output reg la_rue_green, la_rue_yellow, la_rue_red;
	output reg orchard_green, orchard_yellow, orchard_red;
	output reg pedestrian_walk, pedestrian_stop;
	

	

	reg [2:0] flash_count, flash_count_c;
	reg pedestrian_queue, pedestrian_queue_c;
	
	reg la_rue_sensor_ff, orchard_sensor_ff, pedestrian_sensor_ff;
	reg la_rue_sensor_ff_c, orchard_sensor_ff_c, pedestrian_sensor_ff_c;
	

	output reg [2:0] state;
	output reg [2:0] state_c;
	

	output reg [27:0] count;
	output reg [27:0] count_c;
	
	output reg [27:0] x;
	output reg [27:0] x_c;
	

	parameter LA_RUE_GREEN_st = 4'b0000;
	parameter LA_RUE_YELLOW_st = 4'b0001;
	parameter PED_WALK_st = 4'b0010;
	parameter PED_DONT_WALK_st = 4'b0011;
	parameter PED_OFF_st = 4'b0100;
	parameter ORCHARD_GREEN_st = 4'b0101;
	parameter ORCHARD_YELLOW_st = 4'b0110;
	
	always @(*) begin
		

		state_c = state;
		flash_count_c = flash_count;
		
		la_rue_sensor_ff_c = la_rue_sensor;
		orchard_sensor_ff_c = orchard_sensor;
		pedestrian_sensor_ff_c = pedestrian_sensor_ff; 
		


		x_c = x + 28'b1;
		

		if (x == 28'd24999999) begin
			x_c = 28'd0;
			count_c = count + 28'b1;
		end
		
		if (pedestrian_sensor == 0) begin
			pedestrian_sensor_ff_c = 1'b1;
		end

		

		case (state) 
			
			LA_RUE_GREEN_st: begin
			
				la_rue_green = 1'b1;
				la_rue_yellow = 1'b0;
				la_rue_red = 1'b0;
				
				orchard_green = 1'b0;
				orchard_yellow = 1'b0;
				orchard_red = 1'b1;
				
				pedestrian_walk = 1'b0;
				pedestrian_stop = 1'b1;
			
				if (orchard_sensor_ff == 1'b1 | pedestrian_sensor_ff == 1'b1) begin
					if ((count >= 4'b0011) & (count <= 4'b0110) & la_rue_sensor_ff == 1'b0) begin
						state_c = LA_RUE_YELLOW_st;
						count_c = 28'b0;
						x_c = 28'b0;
					end
					else if (count > 4'b0110) begin
						state_c = LA_RUE_YELLOW_st;
						count_c = 28'b0;
						x_c = 28'b0;
					end
				end
				
			end
			
			LA_RUE_YELLOW_st: begin
			
				la_rue_green = 1'b0;
				la_rue_yellow = 1'b1;
				la_rue_red = 1'b0;
				
				orchard_green = 1'b0;
				orchard_yellow = 1'b0;
				orchard_red = 1'b1;
				
				pedestrian_walk = 1'b0;
				pedestrian_stop = 1'b1;
				
				if (count > 4'b0011) begin
					if (pedestrian_sensor_ff == 1'b1) begin
						state_c = PED_WALK_st;
						count_c = 28'b0;
						x_c = 28'b0;
					end
					else if (pedestrian_sensor_ff == 1'b0 & orchard_sensor_ff == 1'b1) begin
						state_c = ORCHARD_GREEN_st;
						count_c = 28'b0;
						x_c = 28'b0;
					end
					else begin
						state_c = LA_RUE_GREEN_st;
						count_c = 28'b0;
						x_c = 28'b0;
					end
				end
				
			end
			
			ORCHARD_GREEN_st: begin
			
				la_rue_green = 1'b0;
				la_rue_yellow = 1'b0;
				la_rue_red = 1'b1;
				
				orchard_green = 1'b1;
				orchard_yellow = 1'b0;
				orchard_red = 1'b0;
				
				pedestrian_walk = 1'b0;
				pedestrian_stop = 1'b1;
				
				if (la_rue_sensor_ff == 1'b0 & pedestrian_sensor_ff == 1'b0) begin
					if (count >= 4'b0011 & orchard_sensor_ff == 1'b0) begin
						state_c = ORCHARD_YELLOW_st;
						count_c = 28'b0;
						x_c = 28'b0;
					end
				end
				
				else if (la_rue_sensor_ff == 1'b1 | pedestrian_sensor_ff == 1'b1) begin
					if (count >= 4'b0001 & count <= 4'b0110 & orchard_sensor_ff == 1'b0) begin
						state_c = ORCHARD_YELLOW_st;
						count_c = 28'b0;
						x_c = 28'b0;
					end
					
					else if (count > 4'b0110) begin
						state_c = ORCHARD_YELLOW_st;
						count_c = 28'b0;
						x_c = 28'b0;
					end
					
				end
				
			end
			
			ORCHARD_YELLOW_st: begin
			
				la_rue_green = 1'b0;
				la_rue_yellow = 1'b0;
				la_rue_red = 1'b1;
				orchard_green = 1'b0;
				orchard_yellow = 1'b1;
				orchard_red = 1'b0;
				pedestrian_walk = 1'b0;
				pedestrian_stop = 1'b1;
				
				if (count > 4'b0011) begin
					
					state_c = LA_RUE_GREEN_st;
					
					if (la_rue_sensor_ff == 1'b0 & pedestrian_sensor_ff == 1'b1) begin
						state_c = PED_WALK_st;
					end
					else if (orchard_sensor_ff == 1'b1 & pedestrian_sensor_ff == 1'b0 & la_rue_sensor_ff == 1'b0) begin
						state_c = ORCHARD_GREEN_st;
					end
					
					count_c = 28'b0;
					x_c = 28'b0;
					
				end
			
			end
			
			PED_WALK_st: begin
			
				la_rue_green = 1'b0;
				la_rue_yellow = 1'b0;
				la_rue_red = 1'b1;
				
				orchard_green = 1'b0;
				orchard_yellow = 1'b0;
				orchard_red = 1'b1;
				
				pedestrian_walk = 1'b1;
				pedestrian_stop = 1'b0;
			
				if (count > 4'b1000) begin
					state_c = PED_DONT_WALK_st;
					flash_count_c = flash_count + 4'b0001;
					count_c = 28'b0;
					x_c = 28'b0;
				end
			
			
			end
			
			PED_DONT_WALK_st: begin
			
				la_rue_green = 1'b0;
				la_rue_yellow = 1'b0;
				la_rue_red = 1'b1;
				
				orchard_green = 1'b0;
				orchard_yellow = 1'b0;
				orchard_red = 1'b1;
				
				pedestrian_walk = 1'b0;
				pedestrian_stop = 1'b1;
				
				
				
				if (count > 4'b0001) begin
					state_c = PED_OFF_st;
					flash_count_c = flash_count + 4'b0001;
					count_c = 28'b0;
					x_c = 28'b0;
					
				end
				
			end
			
			PED_OFF_st: begin
			
				la_rue_green = 1'b0;
				la_rue_yellow = 1'b0;
				la_rue_red = 1'b1;
				
				orchard_green = 1'b0;
				orchard_yellow = 1'b0;
				orchard_red = 1'b1;
				
				pedestrian_walk = 1'b0;
				pedestrian_stop = 1'b0;
				
				


				if (count > 4'b0001 & flash_count < 4'b0101) begin
					flash_count_c = flash_count + 4'b0001;
					state_c = PED_DONT_WALK_st;
					count_c = 28'b0;
					x_c = 28'b0;
					
				end
				
				

				else if (count > 4'b0001 & flash_count >= 4'b0101) begin
				
					if (orchard_sensor_ff == 1'b0) begin
						state_c = LA_RUE_GREEN_st;
						count_c = 28'b0;
						x_c = 28'b0;
						flash_count_c = 4'b0000;
						pedestrian_sensor_ff_c = 1'b0;
					end
					else begin
						state_c = ORCHARD_GREEN_st;
						count_c = 28'b0;
						x_c = 28'b0;
						flash_count_c = 4'b0000;
						pedestrian_sensor_ff_c = 1'b0;
					end
					
				end
				
			end
			
		endcase
		
		
		

		

		if (reset_n == 0) begin


			state_c = 4'b0000;
			
			x_c = 28'd0;
			
			count_c = 28'd0;
			
			flash_count_c = 4'b0000;
			
			orchard_sensor_ff_c = 1'b0;
			la_rue_sensor_ff_c = 1'b0;
			
			pedestrian_sensor_ff_c = 1'b0;
			
		end
		
	end
	


	always @(posedge clk) begin
		state <= #1 state_c;
		count <= #1 count_c;
		x <= #1 x_c;
		flash_count <= #1 flash_count_c;
		
		orchard_sensor_ff <= #1 orchard_sensor_ff_c;
		la_rue_sensor_ff <= #1 la_rue_sensor_ff_c;
		pedestrian_sensor_ff <= #1 pedestrian_sensor_ff_c;
		
	end
	
	
endmodule
module state_machine(

	clk, reset_n, la_rue_sensor, orchard_sensor, pedestrian_sensor, 
	la_rue_green, la_rue_yellow, la_rue_red, 
	orchard_green, orchard_yellow, orchard_red,
	pedestrian_walk, pedestrian_stop, count, count_c, state, state_c, x, x_c
	
);


	input reset_n;
	input clk;
	input la_rue_sensor, orchard_sensor, pedestrian_sensor;
	

	output reg la_rue_green, la_rue_yellow, la_rue_red;
	output reg orchard_green, orchard_yellow, orchard_red;
	output reg pedestrian_walk, pedestrian_stop;
	

	

	reg [2:0] flash_count, flash_count_c;
	reg pedestrian_queue, pedestrian_queue_c;
	
	reg la_rue_sensor_ff, orchard_sensor_ff, pedestrian_sensor_ff;
	reg la_rue_sensor_ff_c, orchard_sensor_ff_c, pedestrian_sensor_ff_c;
	

	output reg [2:0] state;
	output reg [2:0] state_c;
	

	output reg [27:0] count;
	output reg [27:0] count_c;
	
	output reg [27:0] x;
	output reg [27:0] x_c;
	

	parameter LA_RUE_GREEN_st = 4'b0000;
	parameter LA_RUE_YELLOW_st = 4'b0001;
	parameter PED_WALK_st = 4'b0010;
	parameter PED_DONT_WALK_st = 4'b0011;
	parameter PED_OFF_st = 4'b0100;
	parameter ORCHARD_GREEN_st = 4'b0101;
	parameter ORCHARD_YELLOW_st = 4'b0110;
	
	always @(*) begin
		

		state_c = state;
		flash_count_c = flash_count;
		
		la_rue_sensor_ff_c = la_rue_sensor;
		orchard_sensor_ff_c = orchard_sensor;
		pedestrian_sensor_ff_c = pedestrian_sensor_ff; 
		


		x_c = x + 28'b1;
		

		if (x == 28'd24999999) begin
			x_c = 28'd0;
			count_c = count + 28'b1;
		end
		
		if (pedestrian_sensor == 0) begin
			pedestrian_sensor_ff_c = 1'b1;
		end

		

		case (state) 
			
			LA_RUE_GREEN_st: begin
			
				la_rue_green = 1'b1;
				la_rue_yellow = 1'b0;
				la_rue_red = 1'b0;
				
				orchard_green = 1'b0;
				orchard_yellow = 1'b0;
				orchard_red = 1'b1;
				
				pedestrian_walk = 1'b0;
				pedestrian_stop = 1'b1;
			
				if (orchard_sensor_ff == 1'b1 | pedestrian_sensor_ff == 1'b1) begin
					if ((count >= 4'b0011) & (count <= 4'b0110) & la_rue_sensor_ff == 1'b0) begin
						state_c = LA_RUE_YELLOW_st;
						count_c = 28'b0;
						x_c = 28'b0;
					end
					else if (count > 4'b0110) begin
						state_c = LA_RUE_YELLOW_st;
						count_c = 28'b0;
						x_c = 28'b0;
					end
				end
				
			end
			
			LA_RUE_YELLOW_st: begin
			
				la_rue_green = 1'b0;
				la_rue_yellow = 1'b1;
				la_rue_red = 1'b0;
				
				orchard_green = 1'b0;
				orchard_yellow = 1'b0;
				orchard_red = 1'b1;
				
				pedestrian_walk = 1'b0;
				pedestrian_stop = 1'b1;
				
				if (count > 4'b0011) begin
					if (pedestrian_sensor_ff == 1'b1) begin
						state_c = PED_WALK_st;
						count_c = 28'b0;
						x_c = 28'b0;
					end
					else if (pedestrian_sensor_ff == 1'b0 & orchard_sensor_ff == 1'b1) begin
						state_c = ORCHARD_GREEN_st;
						count_c = 28'b0;
						x_c = 28'b0;
					end
					else begin
						state_c = LA_RUE_GREEN_st;
						count_c = 28'b0;
						x_c = 28'b0;
					end
				end
				
			end
			
			ORCHARD_GREEN_st: begin
			
				la_rue_green = 1'b0;
				la_rue_yellow = 1'b0;
				la_rue_red = 1'b1;
				
				orchard_green = 1'b1;
				orchard_yellow = 1'b0;
				orchard_red = 1'b0;
				
				pedestrian_walk = 1'b0;
				pedestrian_stop = 1'b1;
				
				if (la_rue_sensor_ff == 1'b0 & pedestrian_sensor_ff == 1'b0) begin
					if (count >= 4'b0011 & orchard_sensor_ff == 1'b0) begin
						state_c = ORCHARD_YELLOW_st;
						count_c = 28'b0;
						x_c = 28'b0;
					end
				end
				
				else if (la_rue_sensor_ff == 1'b1 | pedestrian_sensor_ff == 1'b1) begin
					if (count >= 4'b0001 & count <= 4'b0110 & orchard_sensor_ff == 1'b0) begin
						state_c = ORCHARD_YELLOW_st;
						count_c = 28'b0;
						x_c = 28'b0;
					end
					
					else if (count > 4'b0110) begin
						state_c = ORCHARD_YELLOW_st;
						count_c = 28'b0;
						x_c = 28'b0;
					end
					
				end
				
			end
			
			ORCHARD_YELLOW_st: begin
			
				la_rue_green = 1'b0;
				la_rue_yellow = 1'b0;
				la_rue_red = 1'b1;
				orchard_green = 1'b0;
				orchard_yellow = 1'b1;
				orchard_red = 1'b0;
				pedestrian_walk = 1'b0;
				pedestrian_stop = 1'b1;
				
				if (count > 4'b0011) begin
					
					state_c = LA_RUE_GREEN_st;
					
					if (la_rue_sensor_ff == 1'b0 & pedestrian_sensor_ff == 1'b1) begin
						state_c = PED_WALK_st;
					end
					else if (orchard_sensor_ff == 1'b1 & pedestrian_sensor_ff == 1'b0 & la_rue_sensor_ff == 1'b0) begin
						state_c = ORCHARD_GREEN_st;
					end
					
					count_c = 28'b0;
					x_c = 28'b0;
					
				end
			
			end
			
			PED_WALK_st: begin
			
				la_rue_green = 1'b0;
				la_rue_yellow = 1'b0;
				la_rue_red = 1'b1;
				
				orchard_green = 1'b0;
				orchard_yellow = 1'b0;
				orchard_red = 1'b1;
				
				pedestrian_walk = 1'b1;
				pedestrian_stop = 1'b0;
			
				if (count > 4'b1000) begin
					state_c = PED_DONT_WALK_st;
					flash_count_c = flash_count + 4'b0001;
					count_c = 28'b0;
					x_c = 28'b0;
				end
			
			
			end
			
			PED_DONT_WALK_st: begin
			
				la_rue_green = 1'b0;
				la_rue_yellow = 1'b0;
				la_rue_red = 1'b1;
				
				orchard_green = 1'b0;
				orchard_yellow = 1'b0;
				orchard_red = 1'b1;
				
				pedestrian_walk = 1'b0;
				pedestrian_stop = 1'b1;
				
				
				
				if (count > 4'b0001) begin
					state_c = PED_OFF_st;
					flash_count_c = flash_count + 4'b0001;
					count_c = 28'b0;
					x_c = 28'b0;
					
				end
				
			end
			
			PED_OFF_st: begin
			
				la_rue_green = 1'b0;
				la_rue_yellow = 1'b0;
				la_rue_red = 1'b1;
				
				orchard_green = 1'b0;
				orchard_yellow = 1'b0;
				orchard_red = 1'b1;
				
				pedestrian_walk = 1'b0;
				pedestrian_stop = 1'b0;
				
				


				if (count > 4'b0001 & flash_count < 4'b0101) begin
					flash_count_c = flash_count + 4'b0001;
					state_c = PED_DONT_WALK_st;
					count_c = 28'b0;
					x_c = 28'b0;
					
				end
				
				

				else if (count > 4'b0001 & flash_count >= 4'b0101) begin
				
					if (orchard_sensor_ff == 1'b0) begin
						state_c = LA_RUE_GREEN_st;
						count_c = 28'b0;
						x_c = 28'b0;
						flash_count_c = 4'b0000;
						pedestrian_sensor_ff_c = 1'b0;
					end
					else begin
						state_c = ORCHARD_GREEN_st;
						count_c = 28'b0;
						x_c = 28'b0;
						flash_count_c = 4'b0000;
						pedestrian_sensor_ff_c = 1'b0;
					end
					
				end
				
			end
			
		endcase
		
		
		

		

		if (reset_n == 0) begin


			state_c = 4'b0000;
			
			x_c = 28'd0;
			
			count_c = 28'd0;
			
			flash_count_c = 4'b0000;
			
			orchard_sensor_ff_c = 1'b0;
			la_rue_sensor_ff_c = 1'b0;
			
			pedestrian_sensor_ff_c = 1'b0;
			
		end
		
	end
	


	always @(posedge clk) begin
		state <= #1 state_c;
		count <= #1 count_c;
		x <= #1 x_c;
		flash_count <= #1 flash_count_c;
		
		orchard_sensor_ff <= #1 orchard_sensor_ff_c;
		la_rue_sensor_ff <= #1 la_rue_sensor_ff_c;
		pedestrian_sensor_ff <= #1 pedestrian_sensor_ff_c;
		
	end
	
	
endmodule