SHARE
TWEET

Untitled

a guest Oct 21st, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.std_logic_unsigned.all;
  4.  
  5. entity comp is
  6. port ( clk50: in std_logic;
  7.         d1,d2: buffer std_logic_vector(6 downto 0);
  8.         s: out std_logic_vector(7 downto 0)
  9.         );
  10.         end comp;
  11. architecture arch of comp is
  12. signal comp: std_logic_vector(23 downto 0);
  13. signal clk1: std_logic;
  14. signal u,d: std_logic_vector(3 downto 0);
  15. begin
  16.     process(clk50)
  17. begin
  18.     if(rising_edge(clk50))
  19.         then comp<= comp+1;
  20.         if(comp="10111110101111000010000000")
  21.         then --clk1<=not clk1;
  22.         comp<="00000000000000000000000000";
  23.         end if;
  24.     end if;
  25.     end process;
  26. clk1<=comp(23);    
  27. process(clk1)
  28.  
  29. begin
  30.         if(rising_edge(clk1))
  31.         then
  32.             if(u="1001" and d="1001") then
  33.             u<="0000";
  34.             d<="0000";
  35.         else u<=u+1;
  36.         if(u="1001")then
  37.             d<=d+1;
  38.             u<="0000";
  39.         end if;
  40.             end if;
  41.         end if;
  42. end process;
  43.  
  44. process(u)
  45. begin
  46. case u is
  47.             when"0000"=>s<= not"10111111";
  48.             when"0001"=>s<= not"10000110";
  49.             when"0010"=>s<= not"11011011";
  50.             when"0011"=>s<= not"11001111";
  51.             when"0100"=>s<= not"11100110";
  52.             when"0101"=>s<= not"11101101";
  53.             when"0110"=>s<= not"11111101";
  54.             when"0111"=>s<= not"10000111";
  55.             when"1000"=>s<= not"11111111";
  56.             when"1001"=>s<= not"11101111";
  57.             when others => null;
  58.  end case;
  59.  end process;
  60.  
  61.  process(d)
  62. begin
  63. case d is
  64.             when"0000"=>s<= not"10111111";
  65.             when"0001"=>s<= not"10000110";
  66.             when"0010"=>s<= not"11011011";
  67.             when"0011"=>s<= not"11001111";
  68.             when"0100"=>s<= not"11100110";
  69.             when"0101"=>s<= not"11101101";
  70.             when"0110"=>s<= not"11111101";
  71.             when"0111"=>s<= not"10000111";
  72.             when"1000"=>s<= not"11111111";
  73.             when"1001"=>s<= not"11101111";
  74.             when others => null;
  75.  end case;
  76.  end process;
  77.  
  78.    
  79.  
  80. end arch;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top