SHARE
TWEET

Untitled

a guest Oct 21st, 2019 66 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,s2: 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="100110001001011010000000")
  21.         then --++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++clk1<=not clk1;
  22.         comp<=  "000000000000000000000000";
  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.         u<= u+1;
  33.         if(u="1001") then
  34.             u<= "0000";
  35.             d<=d+1;
  36.             if(d="1001")
  37.             then
  38.                 d<="0000";
  39.                 end if
  40.                 end if;
  41.                 end if;
  42.        
  43.             --if(u="1001" and d="1001") then
  44.             --u<="0000";
  45.             --d<="0000";
  46.         --else u<=u+1;
  47.         --if(u="1001")then
  48.         --  d<=d+1;
  49.         --  u<="0000";
  50.         --end if;
  51.         --  end if;
  52.     --  end if;
  53. end process;
  54.  
  55. process(u)
  56. begin
  57. case u is
  58.             when"0000"=>s<= not"10111111";
  59.             when"0001"=>s<= not"10000110";
  60.             when"0010"=>s<= not"11011011";
  61.             when"0011"=>s<= not"11001111";
  62.             when"0100"=>s<= not"11100110";
  63.             when"0101"=>s<= not"11101101";
  64.             when"0110"=>s<= not"11111101";
  65.             when"0111"=>s<= not"10000111";
  66.             when"1000"=>s<= not"11111111";
  67.             when"1001"=>s<= not"11101111";
  68.             when others => null;
  69.  end case;
  70.  end process;
  71.  
  72.  process(d)
  73. begin
  74. case d is
  75.             when"0000"=>s2<= not"10111111";
  76.             when"0001"=>s2<= not"10000110";
  77.             when"0010"=>s2<= not"11011011";
  78.             when"0011"=>s2<= not"11001111";
  79.             when"0100"=>s2<= not"11100110";
  80.             when"0101"=>s2<= not"11101101";
  81.             when"0110"=>s2<= not"11111101";
  82.             when"0111"=>s2<= not"10000111";
  83.             when"1000"=>s2<= not"11111111";
  84.             when"1001"=>s2<= not"11101111";
  85.             when others => null;
  86.  end case;
  87.  end process;
  88.  
  89.    
  90.  
  91. 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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top