Verilog Code for Garage

This code is essentially a giant state machine, with smaller state machines within each state.  Each state of the outer state machine corresponds to a parking spot. 
If the parking spot choice is chosen for the certain state, then only that state can run. The inner state is based off of the photosensors.  It waits in a certain state until the sensor 
acknowledges the car and then goes to the next state to turn off all of the path lights.  The state machine is then kept within that last state until the operator switches the reset button
to allow the next driver to choose their parking spot.

Verilog code file:
trialnumber2.qpf


Code:

module trialnumber2(clock, reset, set, DIN0, DIN1, DIN2, DIN3, DIN4, CLK0, CLK1, CLK2, CLK3, CLK4, LE0, LE1, LE2, LE3, LE4, EOC0, EOC1, EOC2, EOC3, DATA_OUT0, DATA_OUT1, DATA_OUT2, DATA_OUT3, IO_CLOCK0, IO_CLOCK1, IO_CLOCK2, IO_CLOCK3, ADDRESS0, ADDRESS1, ADDRESS2, ADDRESS3, CS0, CS1, CS2, CS3, hex, choice); input clock, reset, set; input [3:0] choice; reg [3:0] red_input00, red_input01, red_input02, red_input03, red_input04; // red color choices for led module reg [3:0] red_input10, red_input11, red_input12, red_input13, red_input14; reg [3:0] red_input20, red_input21, red_input22, red_input23, red_input24; reg [3:0] red_input30, red_input31, red_input32, red_input33, red_input34; reg [3:0] red_input40, red_input41, red_input42, red_input43, red_input44; reg [3:0] green_input00, green_input01, green_input02, green_input03, green_input04; // green color choices for led module reg [3:0] green_input10, green_input11, green_input12, green_input13, green_input14; reg [3:0] green_input20, green_input21, green_input22, green_input23, green_input24; reg [3:0] green_input30, green_input31, green_input32, green_input33, green_input34; reg [3:0] green_input40, green_input41, green_input42, green_input43, green_input44; reg [3:0] blue_input00, blue_input01, blue_input02, blue_input03, blue_input04; //blue color choices for led module reg [3:0] blue_input10, blue_input11, blue_input12, blue_input13, blue_input14; reg [3:0] blue_input20, blue_input21, blue_input22, blue_input23, blue_input24; reg [3:0] blue_input30, blue_input31, blue_input32, blue_input33, blue_input34; reg [3:0] blue_input40, blue_input41, blue_input42, blue_input43, blue_input44; output DIN0, DIN1, DIN2, DIN3, DIN4; //Data in for LED Driver chip output LE0, LE1, LE2, LE3, LE4; //Load enable for LED Driver chip output CLK0, CLK1, CLK2, CLK3, CLK4; //Slower clock for LED Driver chip input EOC0, EOC1, EOC2, EOC3; //End of Conversion sensor chip input DATA_OUT0, DATA_OUT1, DATA_OUT2, DATA_OUT3; //Data from sensor chip output IO_CLOCK0, IO_CLOCK1, IO_CLOCK2, IO_CLOCK3; //Slower clock for sensor chip output CS0, CS1, CS2, CS3; //Chip Select for sensor chip output ADDRESS0, ADDRESS1, ADDRESS2, ADDRESS3; //Address choice to sensor chip output reg [6:0] hex; wire [3:0] red0, red1, red2, red3; wire [3:0] blue0, blue1, blue2, blue3; wire [3:0] green0, green1, green2, green3; reg [3:0] address_select0, address_select1, address_select2, address_select3; wire [3:0]p_s; parking_lot pl0(address_select0, reset, clock, EOC0, IO_CLOCK0, DATA_OUT0, ADDRESS0, CS0, red0, green0, blue0); parking_lot pl1(address_select1, reset, clock, EOC1, IO_CLOCK1, DATA_OUT1, ADDRESS1, CS1, red1, green1, blue1); parking_lot pl2(address_select2, reset, clock, EOC2,IO_CLOCK2, DATA_OUT2, ADDRESS2, CS2, red2, green2, blue2); parking_lot pl3(address_select3, reset, clock, EOC3, IO_CLOCK3, DATA_OUT3, ADDRESS3, CS3, red3, green3, blue3); OnCommandLEDs ocl0(set, clock, reset, DIN0, CLK0, LE0, red_input00, red_input01, red_input02, red_input03, red_input04, blue_input00, blue_input01, blue_input02, blue_input03, blue_input04, green_input00, green_input01, green_input02, green_input03, green_input04); OnCommandLEDs ocl1(set, clock, reset, DIN1, CLK1, LE1, red_input10, red_input11, red_input12, red_input13, red_input14, blue_input10, blue_input11, blue_input12, blue_input13, blue_input14, green_input10, green_input11, green_input12, green_input13, green_input14); OnCommandLEDs ocl2(set, clock, reset, DIN2, CLK2, LE2, red_input20, red_input21, red_input22, red_input23, red_input24, blue_input20, blue_input21, blue_input22, blue_input23, blue_input24, green_input20, green_input21, green_input22, green_input23, green_input24); OnCommandLEDs ocl3(set, clock, reset, DIN3, CLK3, LE3, red_input30, red_input31, red_input32, red_input33, red_input34, blue_input30, blue_input31, blue_input32, blue_input33, blue_input34, green_input30, green_input31, green_input32, green_input33, green_input34); OnCommandLEDs ocl4(set, clock, reset, DIN4, CLK4, LE4, red_input40, red_input41, red_input42, red_input43, red_input44, blue_input40, blue_input41, blue_input42, blue_input43, blue_input44, green_input40, green_input41, green_input42, green_input43, green_input44); //term jhmfg(clock, terminal, p_s); select graahhhh(clock, p_s, choice); reg [4:0] count; reg[4:0] S, NS, nextstate,s; reg clk_out; //State Parameters parameter prestart = 4'd0, start=4'd1, space = 4'd2, spot0=4'd3, prespot1 =4'd4, spot1 = 4'd5, prespot2 = 4'd6, spot3=4'd7, statezero=4'd8, stateone=4'd9, statetwo=4'd10, statethree=4'd11, statefour=4'd12, statefive=4'd13, statesix=4'd14, stateseven=4'd15, stateeight=4'd16, statenine=4'd17, stateten=4'd18, stateeleven=4'd19, prestart2=4'd20, the_start = 4'd21, innercase_start = 4'd22; // Clock control always @(posedge clock) begin // Clock high if(clk_out == 1'b0 && count > 5'b01001) begin clk_out <= 1'b1; count <= 5'b0; end // Clock low else if(clk_out == 1'b1 && count > 5'b01001) begin clk_out <= 1'b0; count <= 5'b0; end else begin count <= count + 1'b1; end end always@(posedge clk_out or negedge reset) begin if(reset == 1'b0) begin S <= the_start; s <=innercase_start; end else begin S <= NS; s <=nextstate; end end always @ (S, blue_input41, green_input41, red_input41, red3, blue3, green3, blue_input12, green_input12, red_input12, blue_input11, green_input11, red_input11, blue_input10, red_input10, green_input10, red_input14, green_input14, blue_input14, red0, green0, blue0, red_input03, blue_input03, green_input03, red_input04, blue_input04, green_input04, red_input13, blue_input13, green_input13, s, p_s) begin case(S) the_start:begin NS = prestart; hex = 7'b1111111; end prestart: begin NS = statezero; hex = 7'b0011100; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input41 = 4'b0000; blue_input41 = 4'b0000; green_input41 = 4'b0000; red_input42 = 4'b0000; blue_input42 = 4'b0000; green_input42 = 4'b0000; red_input43 = 4'b0000; blue_input43 = 4'b0000; green_input43 = 4'b0000; red_input44 = 4'b0000; blue_input44 = 4'b0000; green_input44 = 4'b0000; red_input30 = 4'b0000; blue_input30 = 4'b0000; green_input30 = 4'b0000; red_input31 = 4'b0000; blue_input31 = 4'b0000; green_input31 = 4'b0000; red_input34 = 4'b0000; blue_input34 = 4'b0000; green_input34 = 4'b0000; red_input33 = 4'b0000; blue_input33 = 4'b0000; green_input33 = 4'b0000; red_input21 = 4'b0000; blue_input21 = 4'b0000; green_input21 = 4'b0000; red_input22 = 4'b0000; blue_input22 = 4'b0000; green_input22 = 4'b0000; red_input23 = 4'b0000; blue_input23 = 4'b0000; green_input23 = 4'b0000; red_input24 = 4'b0000; blue_input24 = 4'b0000; green_input24 = 4'b0000; end statezero:begin if(p_s==4'b0000)begin NS=statezero; case(s) innercase_start: begin nextstate = start; end start:begin nextstate = space; red_input03 = 4'b1111; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b1111; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b1111; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b1111; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b1111; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b1111; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b1111; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input41 = 4'b1111; blue_input41 = 4'b0000; green_input41 = 4'b0000; hex = 7'b0000001; end space: begin nextstate = spot0; hex = 7'b000111; end spot0:begin if (red_input12==4'b0000 && green_input12==4'b0000 && blue_input12==4'b0000) begin nextstate = prespot1; end else begin nextstate = spot0; end address_select0 =4'b0100; red_input12 = red0; blue_input12 = blue0; green_input12 = green0; hex = 7'b0000100; end prespot1: begin nextstate = spot1; hex = 7'b1111100; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input41 = 4'b1111; blue_input41 = 4'b0000; green_input41 = 4'b0000; end spot1:begin nextstate = spot1; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input41 = 4'b0000; blue_input41 = 4'b0000; green_input41 = 4'b0000; hex = 7'b0001000; end endcase end else begin NS=stateone; end end stateone:begin if(p_s ==4'b0001)begin NS=stateone; case(s) innercase_start:begin nextstate = start; end start:begin nextstate = space; red_input03 = 4'b1111; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b1111; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b1111; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b1111; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b1111; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b1111; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b1111; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input42 = 4'b1111; blue_input42 = 4'b0000; green_input42 = 4'b0000; hex = 7'b0000001; end space: begin nextstate = spot0; hex = 7'b000111; end spot0:begin if (red_input12==4'b0000 && green_input12==4'b0000 && blue_input12==4'b0000) begin nextstate = prespot1; end else begin nextstate = spot0; end address_select0 =4'b0100; red_input12 = red0; blue_input12 = blue0; green_input12 = green0; hex = 7'b0000100; end prespot1: begin nextstate = spot1; hex = 7'b1111100; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input42 = 4'b1111; blue_input42 = 4'b0000; green_input42 = 4'b0000; end spot1:begin nextstate = spot1; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input42 = 4'b0000; blue_input42 = 4'b0000; green_input42 = 4'b0000; hex = 7'b0001000; end endcase end else begin NS=statetwo; end end statetwo:begin if(p_s==4'b0010)begin NS=statetwo; case(s) innercase_start:begin nextstate = start; end start:begin nextstate = space; red_input03 = 4'b1111; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b1111; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b1111; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b1111; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b1111; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b1111; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input43 = 4'b1111; blue_input43 = 4'b0000; green_input43 = 4'b0000; hex = 7'b0000001; end space: begin nextstate = spot0; hex = 7'b000111; end spot0:begin if (red_input11==4'b0000 && green_input11==4'b0000 && blue_input11==4'b0000) begin nextstate = prespot1; end else begin nextstate = spot0; end address_select0 =4'b0000; red_input11 = red0; blue_input11 = blue0; green_input11 = green0; hex = 7'b0000100; end prespot1: begin nextstate = spot1; hex = 7'b1111100; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input43 = 4'b1111; blue_input43 = 4'b0000; green_input43 = 4'b0000; end spot1:begin nextstate = spot1; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input43 = 4'b0000; blue_input43 = 4'b0000; green_input43 = 4'b0000; hex = 7'b0001000; end endcase end else begin NS=statethree; end end statethree:begin if(p_s==4'b0011)begin NS=statethree; case(s) innercase_start:begin nextstate = start; end start:begin nextstate = space; red_input03 = 4'b1111; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b1111; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b1111; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b1111; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b1111; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b1111; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input44 = 4'b1111; blue_input44 = 4'b0000; green_input44 = 4'b0000; hex = 7'b0000001; end space: begin nextstate = spot0; hex = 7'b000111; end spot0:begin if (red_input11==4'b0000 && green_input11==4'b0000 && blue_input11==4'b0000) begin nextstate = prespot1; end else begin nextstate = spot0; end address_select0 =4'b0000; red_input11 = red0; blue_input11 = blue0; green_input11 = green0; hex = 7'b0000100; end prespot1: begin nextstate = spot1; hex = 7'b1111100; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input44 = 4'b1111; blue_input44 = 4'b0000; green_input44 = 4'b0000; end spot1:begin nextstate = spot1; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input44 = 4'b0000; blue_input44 = 4'b0000; green_input44 = 4'b0000; hex = 7'b0001000; end endcase end else begin NS=statefour; end end statefour:begin if(p_s==4'b0100)begin NS=statefour; case(s) innercase_start:begin nextstate = start; end start:begin nextstate = space; red_input03 = 4'b1111; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b1111; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b1111; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b1111; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b1111; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b1111; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input30 = 4'b1111; blue_input30 = 4'b0000; green_input30 = 4'b0000; hex = 7'b0000001; end space: begin nextstate = spot0; hex = 7'b000111; end spot0:begin if (red_input11==4'b0000 && green_input11==4'b0000 && blue_input11==4'b0000) begin nextstate = prespot1; end else begin nextstate = spot0; end address_select0 =4'b0000; red_input11 = red0; blue_input11 = blue0; green_input11 = green0; hex = 7'b0000100; end prespot1: begin nextstate = spot1; hex = 7'b1111100; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input30 = 4'b1111; blue_input30 = 4'b0000; green_input30 = 4'b0000; end spot1:begin nextstate = spot1; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input30 = 4'b0000; blue_input30 = 4'b0000; green_input30 = 4'b0000; hex = 7'b0001000; end endcase end else begin NS=statefive; end end statefive:begin if(p_s ==4'b0101)begin NS=statefive; case(s) innercase_start:begin nextstate = start; end start:begin nextstate = space; red_input03 = 4'b1111; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b1111; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b1111; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b1111; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b1111; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input31 = 4'b1111; blue_input31 = 4'b0000; green_input31 = 4'b0000; hex = 7'b0000001; end space: begin nextstate = spot0; hex = 7'b000111; end spot0:begin if (red_input10==4'b0000 && green_input10==4'b0000 && blue_input10==4'b0000) begin nextstate = prespot1; end else begin nextstate = spot0; end address_select0 =4'b0001; red_input10 = red0; blue_input10 = blue0; green_input10 = green0; hex = 7'b0000100; end prespot1: begin nextstate = spot1; hex = 7'b1111100; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input31 = 4'b1111; blue_input31 = 4'b0000; green_input31 = 4'b0000; end spot1:begin nextstate = spot1; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input31 = 4'b0000; blue_input31 = 4'b0000; green_input31 = 4'b0000; hex = 7'b0001000; end endcase end else begin NS=statesix; end end statesix:begin if(p_s==4'b0110)begin NS=statesix; case(s) innercase_start:begin nextstate = start; end start:begin nextstate = space; red_input03 = 4'b1111; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b1111; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b1111; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b1111; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input34 = 4'b1111; blue_input34 = 4'b0000; green_input34 = 4'b0000; hex = 7'b0000001; end space: begin nextstate = spot0; hex = 7'b000111; end spot0:begin if (red_input14==4'b0000 && green_input14==4'b0000 && blue_input14==4'b0000) begin nextstate = prespot1; end else begin nextstate = spot0; end address_select0 =4'b0010; red_input14 = red0; blue_input14 = blue0; green_input14 = green0; hex = 7'b0000100; end prespot1: begin nextstate = spot1; hex = 7'b1111100; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input34 = 4'b1111; blue_input34 = 4'b0000; green_input34 = 4'b0000; end spot1:begin nextstate = spot1; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input34 = 4'b0000; blue_input34 = 4'b0000; green_input34 = 4'b0000; hex = 7'b0001000; end endcase end else begin NS=stateseven; end end stateseven:begin if(p_s==4'b0111)begin NS=stateseven; case(s) innercase_start:begin nextstate = start; end start:begin nextstate = space; red_input03 = 4'b1111; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b1111; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b1111; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input33 = 4'b1111; blue_input33 = 4'b0000; green_input33 = 4'b0000; hex = 7'b0000001; end space: begin nextstate = spot0; hex = 7'b000111; end spot0:begin if (red_input13==4'b0000 && green_input13==4'b0000 && blue_input13==4'b0000) begin nextstate = prespot1; end else begin nextstate = spot0; end address_select0 =4'b0011; red_input13 = red0; blue_input13 = blue0; green_input13 = green0; hex = 7'b0000100; end prespot1: begin nextstate = spot1; hex = 7'b1111100; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input33 = 4'b1111; blue_input33 = 4'b0000; green_input33 = 4'b0000; end spot1:begin nextstate = spot1; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input33 = 4'b0000; blue_input33 = 4'b0000; green_input33 = 4'b0000; hex = 7'b0001000; end endcase end else begin NS=stateeight; end end stateeight:begin if(p_s==4'b1000)begin NS=stateeight; case(s) innercase_start:begin nextstate = start; end start:begin nextstate = space; red_input03 = 4'b1111; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b1111; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b1111; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input21 = 4'b1111; blue_input21 = 4'b0000; green_input21 = 4'b0000; hex = 7'b0000001; end space: begin nextstate = spot0; hex = 7'b0000111; end spot0:begin if (red_input13==4'b0000 && green_input13==4'b0000 && blue_input13==4'b0000) begin nextstate = prespot1; end else begin nextstate = spot0; end address_select0 =4'b0011; red_input13 = red0; blue_input13 = blue0; green_input13 = green0; hex = 7'b0000100; end prespot1: begin nextstate = spot1; hex = 7'b1111100; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input21 = 4'b1111; blue_input21 = 4'b0000; green_input21 = 4'b0000; end spot1:begin nextstate = spot1; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input21 = 4'b0000; blue_input21 = 4'b0000; green_input21 = 4'b0000; hex = 7'b0001000; end endcase end else begin NS=statenine; end end statenine:begin if(p_s==4'b1001)begin NS=statefour; case(s) innercase_start:begin nextstate = start; end start:begin nextstate = space; red_input03 = 4'b1111; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b1111; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b1111; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input22 = 4'b1111; blue_input22 = 4'b0000; green_input22 = 4'b0000; hex = 7'b0000001; end space: begin nextstate = spot0; hex = 7'b0000111; end spot0:begin if (red_input13==4'b0000 && green_input13==4'b0000 && blue_input13==4'b0000) begin nextstate = prespot1; end else begin nextstate = spot0; end address_select0 =4'b0011; red_input13 = red0; blue_input13 = blue0; green_input13 = green0; hex = 7'b0000100; end prespot1: begin nextstate = spot1; hex = 7'b1111100; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input22 = 4'b1111; blue_input22 = 4'b0000; green_input22 = 4'b0000; end spot1:begin nextstate = spot1; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input22 = 4'b0000; blue_input22 = 4'b0000; green_input22 = 4'b0000; hex = 7'b0001000; end endcase end else begin NS=stateten; end end stateten:begin if(p_s==4'b1010)begin NS=stateten; case(s) innercase_start:begin nextstate = start; end start:begin nextstate = space; red_input03 = 4'b1111; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b1111; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input23 = 4'b1111; blue_input23 = 4'b0000; green_input23 = 4'b0000; hex = 7'b0000001; end space: begin nextstate = spot0; hex = 7'b0000111; end spot0:begin if (red_input04==4'b0000 && green_input04==4'b0000 && blue_input04==4'b0000) begin nextstate = prespot1; end else begin nextstate = spot0; end address_select0 =4'b0101; red_input04 = red0; blue_input04 = blue0; green_input04 = green0; hex = 7'b0000100; end prespot1: begin nextstate = spot1; hex = 7'b1111100; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input23 = 4'b1111; blue_input23 = 4'b0000; green_input23 = 4'b0000; end spot1:begin nextstate = spot1; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input23 = 4'b0000; blue_input23 = 4'b0000; green_input23 = 4'b0000; hex = 7'b0001000; end endcase end else begin NS=stateeleven; end end stateeleven:begin if(p_s==4'b1011)begin NS=stateeleven; case(s) innercase_start:begin nextstate = start; end start:begin nextstate = space; red_input03 = 4'b1111; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b1111; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input24 = 4'b1111; blue_input24 = 4'b0000; green_input24 = 4'b0000; hex = 7'b0000001; end space: begin nextstate = spot0; hex = 7'b0000111; end spot0:begin if (red_input04==4'b0000 && green_input04==4'b0000 && blue_input04==4'b0000) begin nextstate = prespot1; end else begin nextstate = spot0; end address_select0 =4'b0101; red_input04 = red0; blue_input04 = blue0; green_input04 = green0; hex = 7'b0000100; end prespot1: begin nextstate = spot1; hex = 7'b1111100; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; red_input24 = 4'b1111; blue_input24 = 4'b0000; green_input24 = 4'b0000; end spot1:begin nextstate = spot1; red_input03 = 4'b0000; blue_input03 = 4'b0000; green_input03 = 4'b0000; red_input04 = 4'b0000; blue_input04 = 4'b0000; green_input04 = 4'b0000; red_input13 = 4'b0000; blue_input13 = 4'b0000; green_input13 = 4'b0000; red_input14 = 4'b0000; blue_input14 = 4'b0000; green_input14 = 4'b0000; red_input10 = 4'b0000; blue_input10 = 4'b0000; green_input10 = 4'b0000; red_input11 = 4'b0000; blue_input11 = 4'b0000; green_input11 = 4'b0000; red_input12 = 4'b0000; blue_input12 = 4'b0000; green_input12 = 4'b0000; hex = 7'b0001000; red_input24 = 4'b0000; blue_input24 = 4'b0000; green_input24 = 4'b0000; end endcase end else begin NS=prestart; end end endcase end endmodule




Return