Guest User

Untitled

a guest
Jun 28th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.91 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3. use IEEE.STD_LOGIC_ARITH.ALL;
  4. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  5.  
  6. entity proj4 is
  7.    port(
  8.        rst_i : in STD_LOGIC;
  9.        clk_i : in STD_LOGIC;
  10.        led_o : inout STD_LOGIC_VECTOR(1 downto 0) :="00";
  11.         led7_an_o : out STD_LOGIC_VECTOR(3 downto 0) --anody
  12.         );
  13. end proj4;
  14.  
  15. architecture Behavioral of proj4 is
  16. begin
  17.  
  18. led7_an_o(3 downto 0) <= "1111"; --wygaszenie anod
  19.  
  20. process    (clk_i, rst_i)
  21.  
  22. begin
  23.    if rst_i = '1' then --zerowanie ( przyciskiem BTN3 )
  24.        led_o <= "00";
  25.  
  26.    elsif rising_edge(clk_i) then   -- licznik graya ( przycisk BTN0 )
  27.        case led_o is
  28.            when "00" => led_o(1 downto 0) <= "01";
  29.            when "01" => led_o(1 downto 0) <= "11";
  30.            when "11" => led_o(1 downto 0) <= "10";
  31.            when others => led_o(1 downto 0) <= "00";
  32.        end case;
  33.  
  34.    end if;
  35.  
  36. end process;
  37. end Behavioral;
Add Comment
Please, Sign In to add comment