Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library IEEE;
- use IEEE.STD_LOGIC_1164.all;
- entity kostka is
- port(
- clk: in std_logic;
- button: in std_logic;
- display: out std_logic_vector(6 downto 0)
- );
- end kostka;
- architecture behave of kostka is
- signal display_digit: natural range 0 to 7;
- signal digit: natural range 0 to 7;
- signal interval: natural range 0 to 25000000 := 0;
- begin
- process(clk)
- begin
- if rising_edge(clk) then
- if(digit < 6) then
- digit <= digit + 1;
- else
- digit <= 1;
- end if;
- if(interval > 0) then
- interval <= interval - 1;
- end if;
- if(button = '0' and interval = 0) then
- display_digit <= digit;
- interval <= 25000000;
- end if;
- --if(button = '0') then
- --if(interval = 0) then
- --display_digit <= digit;
- --interval <= 25000000;
- --end if;
- --end if;
- end if;
- end process;
- process(display_digit)
- begin
- case display_digit is
- --when 0 => display <= "0000000";
- when 1 => display <= "1001111"; -- "1"
- when 2 => display <= "0010010"; -- "2"
- when 3 => display <= "0000110"; -- "3"
- when 4 => display <= "1001100"; -- "4"
- when 5 => display <= "0100100"; -- "5"
- when 6 => display <= "0100000"; -- "6"
- when others => display <= "0000000";
- end case;
- end process;
- end behave;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement