entity Ampel is Port ( reset : in STD_LOGIC; clk : in STD_LOGIC; button1 : in STD_LOGIC; lampe1: out STD_LOGIC; colors : inout STD_LOGIC_VECTOR (2 downto 0)); end Ampel; architecture Behavioral of Ampel is signal status: integer:=-1; signal redflag: std_logic; signal blinkflag: std_logic; begin process (clk,reset) begin if button1 = '1' then blinkflag <= '1'; end if; if blinkflag='1' then lampe1<='1'; else lampe1<='0'; end if; if redflag='1' then lampe1<='0'; blinkflag<='0'; end if; end process; process (reset,clk) variable counter: integer :=0; variable sekunde: integer :=0; variable dauer: integer :=0; begin if reset='1' then status <= -1; counter := 0; sekunde := 0; dauer:=2; colors <= "000"; elsif rising_edge(clk) then sekunde:=sekunde+1; if sekunde=dauer then sekunde:=0; case status is when -1=> colors <= "010"; dauer:=4; when 0 => colors <= "100"; dauer:=4; redflag<='1'; when 1 => colors <= "010"; dauer:=1; redflag<='0'; when 2 => colors <= "001"; dauer:=4; when 3 => colors <= "010"; dauer:=1; when others => end case; status <= status+1 mod 4; end if; end if; --end if; end process; end Behavioral;