-- ************************************************** -- Kathleen Williams -- Enhanced Traffic Light Controller -- KatieCo Systems Engineering -- April 29th, 2001 -- Specify Later -- ************************************************** library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity katieco is port(clk,car,car1,car2,boat,train,reset,ts,tl,turntime,delay: in std_logic; buzzer,trainlights,boatlights,L1G,L1Y,L1R,L2G,L2Y,L2R,R1G,R1Y,R1R,R2G,R2Y,R2R,H1G,H1Y,H1R,H2G,H2Y,H2R,FG,FY,FR,ST: out std_logic); end katieco; architecture structure of katieco is TYPE states is (s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s18,s19,s20,s21,s21a,s22,s22a,s23,s24,s25,s26,s27,s27a,s27b,s27c,s27d,s29a,s29b,s29c,s29d,s29e); SIGNAL current: states := s0; begin -- next state process next_state: PROCESS (clk) begin if (clk='1' and clk'event) THEN CASE current is when s0 => if ((car='1' and tl='1') or (car='1' and tl='1' and car1='1') or (car='1' and tl='1' and car2='1')) then current <= s11; end if; if (tl='1' and car1='1' and car2='0' and car='0') then current <= s1; end if; if (tl='1' and car1='0' and car2='1' and car='0') then current <= s6; end if; if (tl='1' and car1='1' and car2='1' and car='0') then current <= s11; end if; if (boat='1') then current <= s25; end if; if (train='1') then current <= s24; end if; if (train='1' and boat='1') then current <= s26; end if; if (reset='1') then current <= s0; end if; when s1 => if (ts='1') then current <= s2; end if; if (reset='1') then current <= s0; end if; when s2 => if (delay='1') then current <= s3; end if; if (reset='1') then current <= s0; end if; when s3 => if (reset='1') then current <= s0; elsif (turntime='1') then current <= s4; end if; when s4 => if (ts='1') then current <= s5; end if; if (reset='1') then current <= s0; end if; when s5 => if (delay='1') then current <= s0; end if; if (reset='1') then current <= s0; end if; when s6 => if (ts='1') then current <= s7; end if; if (reset='1') then current <= s0; end if; when s7 => if (delay='1') then current <= s8; end if; if (reset='1') then current <= s0; end if; when s8 => if (turntime='1' or boat='1') then current <= s9; end if; if (reset='1') then current <= s0; end if; when s9 => if (ts='1') then current <= s10; end if; if (reset='1') then current <= s0; end if; when s10 => if (delay='1' or reset='1') then current <= s0; end if; when s11 => if (ts='1') then current <= s12; end if; if (reset='1') then current <= s0; end if; when s12 => if (delay='1' and car1='1' and car2='1') then current <= s13; end if; if (car='1' and delay='1') then current <= s18; end if; if (not car='1' and not car1='1' and not car2='1' and delay='1') then current <= s0; end if; if (boat='1' and delay='1') then current <= s22; end if; if (train='1' and delay='1') then current <= s21; end if; if (boat='1' and train='1' and delay='1') then current <= s23; end if; if (reset='1') then current <= s0; end if; when s13 => if (turntime='1' or train='1' or boat='1') then current <= s14; end if; if (reset='1') then current <= s0; end if; when s14 => current <= s15; if (reset='1') then current <= s0; end if; when s15 => if (delay='1' or reset='1') then current <= s0; end if; when s18 => if (tl='1' or train='1' or boat='1') then current <= s19; end if; if (reset='1') then current <= s0; end if; when s19 => if (ts='1') then current <= s20; end if; if (reset='1') then current <= s0; end if; when s20 => if (delay='1' and car1='0' and car2='0') then current <= s0; end if; if (car1='1' and car2='0' and delay='1') then current <= s3; end if; if (car2='1' and car1='0' and delay='1') then current <= s8; end if; if (car1='1' and car2='1' and delay='1') then current <= s13; end if; if (train='1') then current <= s21; end if; if (boat='1') then current <= s22; end if; if (boat='1' and train='1') then current <= s23; end if; if (reset='1') then current <= s0; end if; when s21 => if (train='1') then current <= s21a; end if; if (train='1' and car2='1' and tl='1') then current <= s27; end if; if (train='1' and boat='1') then current <= s23; end if; if (train='0') then current <= s0; end if; if (train='0' and boat='1') then current <= s25; end if; if (reset='1') then current <= s0; end if; when s21a => current <= s21; when s22 => if (boat='1') then current <= s22a; end if; if (boat='0') then current <= s0; end if; if (boat='1' and car1='1' and train='0') then current <= s29a; end if; if (boat='0' and train='1') then current <= s24; end if; if (boat='1' and train='1') then current <= s26; end if; if (reset='1') then current <= s0; end if; when s22a => current <= s22; when s23 => if (not boat='1' and train='1') then current <= s21; end if; if (not train='1' and boat='1') then current <= s22; end if; if ((not boat='1' and not train='1') or reset='1') then current <= s0; end if; when s24 => if (ts='1') then current <= s21; end if; if (reset='1') then current <= s0; end if; when s25 => if (ts='1') then current <= s22; if (ts='1' and boat='1' and train='1') then current <= s26; end if; end if; if (reset='1') then current <= s0; end if; when s26 => if (ts='1') then current <= s23; end if; if (reset='1') then current <= s0; end if; when s27 => if (ts='1' and train='1') then current <= s27a; end if; if (ts='1' and train='0') then current <= s7; end if; if (reset='1') then current <= s0; end if; when s27a => if (delay='1') then current <= s27b; end if; if (reset='1') then current <= s0; end if; when s27b => if (turntime ='1') then current <= s27c; end if; if (reset='1') then current <= s0; end if; when s27c => if (ts='1') then current <= s27d; end if; if (reset='1') then current <= s0; end if; when s27d => if (delay='1') then current <= s21; end if; if (delay='1' and train='0') then current <= s0; end if; if (reset='1') then current <= s0; end if; when s29a => if (ts='1') then current <= s29b; end if; if (reset='1') then current <= s0; end if; when s29b => if (delay='1') then current <= s29c; end if; if (reset='1') then current <= s29d; end if; when s29c => if (turntime='1') then current <= s29d; end if; if (reset='1') then current <= s0; end if; when s29d => if (ts='1') then current <= s29e; end if; if (reset='1') then current <= s0; end if; when s29e => if (delay='1') then current <= s22; end if; if (reset='1') then current <= s0; end if; end CASE; end if; end process next_state; -- output process output: PROCESS (current) begin CASE current is when s0 => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '1'; R1Y <= '0'; R1R <= '0'; R2G <= '1'; R2Y <= '0'; R2R <= '0'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s1 => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '0'; H2Y <= '1'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '1'; R1Y <= '0'; R1R <= '0'; R2G <= '0'; R2Y <= '1'; R2R <= '0'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s2 => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '0'; H2Y <= '0'; H2R <= '1'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '1'; R1Y <= '0'; R1R <= '0'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s3 => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '0'; H2Y <= '0'; H2R <= '1'; L1G <= '1'; L1Y <= '0'; L1R <= '0'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '1'; R1Y <= '0'; R1R <= '0'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s4 => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '0'; H2Y <= '0'; H2R <= '1'; L1G <= '0'; L1Y <= '1'; L1R <= '0'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '1'; R1Y <= '0'; R1R <= '0'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s5 => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '0'; H2Y <= '0'; H2R <= '1'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '1'; R1Y <= '0'; R1R <= '0'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s6 => H1G <= '0'; H1Y <= '1'; H1R <= '0'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '1'; R1R <= '0'; R2G <= '1'; R2Y <= '0'; R2R <= '0'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s7 => H1G <= '0'; H1Y <= '0'; H1R <= '1'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '1'; R2Y <= '0'; R2R <= '0'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s8 => H1G <= '0'; H1Y <= '0'; H1R <= '1'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '1'; L2Y <= '0'; L2R <= '0'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '1'; R2Y <= '0'; R2R <= '0'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s9 => H1G <= '0'; H1Y <= '0'; H1R <= '1'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '1'; L2R <= '0'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '1'; R2Y <= '0'; R2R <= '0'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s10 => H1G <= '0'; H1Y <= '0'; H1R <= '1'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '1'; R2Y <= '0'; R2R <= '0'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s11 => H1G <= '0'; H1Y <= '1'; H1R <= '0'; H2G <= '0'; H2Y <= '1'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '1'; R1R <= '0'; R2G <= '0'; R2Y <= '1'; R2R <= '0'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s12 => H1G <= '0'; H1Y <= '0'; H1R <= '1'; H2G <= '0'; H2Y <= '0'; H2R <= '1'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s13 => H1G <= '0'; H1Y <= '0'; H1R <= '1'; H2G <= '0'; H2Y <= '0'; H2R <= '1'; L1G <= '1'; L1Y <= '0'; L1R <= '0'; L2G <= '1'; L2Y <= '0'; L2R <= '0'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s14 => H1G <= '0'; H1Y <= '0'; H1R <= '1'; H2G <= '0'; H2Y <= '0'; H2R <= '1'; L1G <= '0'; L1Y <= '1'; L1R <= '0'; L2G <= '0'; L2Y <= '1'; L2R <= '0'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s15 => H1G <= '0'; H1Y <= '0'; H1R <= '1'; H2G <= '0'; H2Y <= '0'; H2R <= '1'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s18 => H1G <= '0'; H1Y <= '0'; H1R <= '1'; H2G <= '0'; H2Y <= '0'; H2R <= '1'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '1'; FY <= '0'; FR <= '0'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s19 => H1G <= '0'; H1Y <= '0'; H1R <= '1'; H2G <= '0'; H2Y <= '0'; H2R <= '1'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '1'; FR <= '0'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s20 => H1G <= '0'; H1Y <= '0'; H1R <= '1'; H2G <= '0'; H2Y <= '0'; H2R <= '1'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s21 => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '1'; R1Y <= '0'; R1R <= '0'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '1'; boatlights <= '0'; buzzer <='0'; when s21a => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '1'; R1Y <= '0'; R1R <= '0'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s22 => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '1'; R2Y <= '0'; R2R <= '0'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '1'; buzzer <='0'; when s22a => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '1'; R2Y <= '0'; R2R <= '0'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s23 => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '1'; boatlights <= '1'; buzzer <='1'; when s24 => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '1'; R1Y <= '0'; R1R <= '0'; R2G <= '0'; R2Y <= '1'; R2R <= '0'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s25 => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '1'; R1R <= '0'; R2G <= '1'; R2Y <= '0'; R2R <= '0'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s26 => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '1'; R1R <= '0'; R2G <= '0'; R2Y <= '1'; R2R <= '0'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '0'; buzzer <='0'; when s27 => H1G <= '0'; H1Y <= '1'; H1R <= '0'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '1'; R1R <= '0'; R2G <= '0'; R2Y <= '0'; R2R <= '0'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '1'; boatlights <= '0'; buzzer <='0'; when s27a => H1G <= '0'; H1Y <= '0'; H1R <= '1'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '1'; boatlights <= '0'; buzzer <='0'; when s27b => H1G <= '0'; H1Y <= '0'; H1R <= '1'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '1'; L2Y <= '0'; L2R <= '0'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '1'; boatlights <= '0'; buzzer <='0'; when s27c => H1G <= '0'; H1Y <= '0'; H1R <= '1'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '1'; L2R <= '0'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '1'; boatlights <= '0'; buzzer <='0'; when s27d => H1G <= '0'; H1Y <= '0'; H1R <= '1'; H2G <= '1'; H2Y <= '0'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '1'; boatlights <= '0'; buzzer <='0'; when s29a => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '0'; H2Y <= '1'; H2R <= '0'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '0'; R1R <= '0'; R2G <= '0'; R2Y <= '1'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '1'; buzzer <='0'; when s29b => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '0'; H2Y <= '0'; H2R <= '1'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '0'; R1R <= '0'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '1'; buzzer <='0'; when s29c => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '0'; H2Y <= '0'; H2R <= '1'; L1G <= '1'; L1Y <= '0'; L1R <= '0'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '0'; R1R <= '0'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '1'; buzzer <='0'; when s29d => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '0'; H2Y <= '0'; H2R <= '1'; L1G <= '0'; L1Y <= '1'; L1R <= '0'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '0'; R1R <= '1'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '1'; buzzer <='0'; when s29e => H1G <= '1'; H1Y <= '0'; H1R <= '0'; H2G <= '0'; H2Y <= '0'; H2R <= '1'; L1G <= '0'; L1Y <= '0'; L1R <= '1'; L2G <= '0'; L2Y <= '0'; L2R <= '1'; R1G <= '0'; R1Y <= '0'; R1R <= '0'; R2G <= '0'; R2Y <= '0'; R2R <= '1'; FG <= '0'; FY <= '0'; FR <= '1'; trainlights <= '0'; boatlights <= '1'; buzzer <='0'; end CASE; end PROCESS output; st <= '1' when (current = s0 and tl = '1' and car1 = '1' and car2 = '0') or (current = s0 and tl = '1' and car1 = '0' and car2 = '1') or (current = s0 and tl = '1' and car1 = '1' and car2 = '1') or (current = s0 and train='1') or (current = s0 and boat='1') or (current = s0 and train='1' and boat='1') or (current = s1 and ts = '1') or (current = s1 and reset = '1') or (current = s2 and delay = '1') or (current = s2 and reset = '1') or (current = s3 and turntime = '1') or (current = s3 and train = '1') or (current = s3 and reset = '1') or (current = s4 and ts = '1') or (current = s4 and reset = '1') or (current = s5 and delay = '1') or (current = s5 and reset = '1') or (current = s6 and ts = '1') or (current = s6 and reset = '1') or (current = s7 and delay = '1') or (current = s7 and reset = '1') or (current = s8 and turntime = '1') or (current = s8 and boat='1') or (current = s8 and reset = '1') or (current = s9 and ts = '1') or (current = s9 and reset = '1') or (current = s10 and delay = '1') or (current = s10 and reset = '1') or (current = s11 and ts = '1') or (current = s11 and reset = '1') or (current = s12 and delay = '1') or (current = s12 and reset = '1') or (current = s13 and turntime = '1') or (current = s13 and train='1') or (current = s13 and boat='1') or (current = s13 and reset = '1') or (current = s14 and ts = '1') or (current = s14 and reset = '1') or (current = s15 and delay = '1') or (current = s15 and reset = '1') or (current = s18 and tl = '1') or (current = s18 and train = '1') or (current = s18 and reset = '1') or (current = s19 and ts = '1') or (current = s19 and reset = '1') or (current = s20 and train = '1') or (current = s20 and reset = '1') or (current = s21 and train = '1' and car2='1' and tl='1') or (current = s21 and reset = '1') or (current = s21a and reset = '1') or (current = s22 and reset = '1') or (current = s22a and reset = '1') or (current = s23 and reset = '1') or (current = s27d and delay='1') or (current = s24 and ts = '1' and train='1') or (current = s24 and ts = '1') or (current = s24 and reset = '1') or (current = s25 and reset = '1') or (current = s26 and ts = '1') or (current = s26 and reset = '1') or (current = s27 and ts = '1') or (current = s27 and reset = '1') or (current = s27a and delay = '1') or (current = s27a and reset = '1') or (current = s27b and turntime = '1') or (current = s27b and reset = '1') or (current = s27c and ts = '1') or (current = s27c and reset = '1') or (current = s27d and reset = '1') or (current = s25 and reset = '1') or (current = s29a and reset = '1') or (current = s29b and reset = '1') or (current = s29c and reset = '1') or (current = s29d and reset = '1') or (current = s29e and reset = '1') or (current = s29a and ts = '1') or (current = s29b and delay = '1') or (current = s29c and turntime = '1') or (current = s29d and ts = '1') or (current = s29e and delay = '1') or (current = s25 and ts = '1') else '0'; end structure;