Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. --LED SHOW
  2. library IEEE;
  3. use IEEE.STD_LOGIC_1164.ALL;
  4. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  5.  
  6. entity LedShow is
  7. Port ( inRST : in STD_LOGIC;
  8. iCLK : in STD_LOGIC;
  9. oLED : out STD_LOGIC_VECTOR (7 downto 0);
  10. inLEFT : in STD_LOGIC;
  11. inRIGHT : in STD_LOGIC;
  12. inBLINK : in STD_LOGIC);
  13. end LedShow;
  14.  
  15. architecture Behavioral of LedShow is
  16.  
  17. signal sCNT : std_logic_vector(24 downto 0);
  18. signal sTC : std_logic;
  19. signal sSHR : std_logic_vector(7 downto 0);
  20.  
  21. begin
  22.  
  23. --Brojac
  24. process(inRST, iCLK) begin
  25. if(inRST='0') then
  26. sCNT <= (others => '0');
  27. elsif(iCLK'event and iCLK='1') then
  28. if(sCNT=23999999) then
  29. sCNT <= (others => '0');
  30. else
  31. sCNT <= sCNT+1;
  32. end if;
  33. end if;
  34. end process;
  35.  
  36.  
  37. --Terminal count
  38. sTC <= '1' when sCNT=0 else '0';
  39.  
  40.  
  41. --Pomeracki registar
  42. process(inRST, iCLK,sSHR) begin
  43. if(inRST='0') then
  44. sSHR <= "00000001";
  45. elsif(iCLK'event and iCLK='1') then
  46. if(sTC='1') then
  47. if(inRIGHT='1') then
  48. sSHR <= sSHR(0) & sSHR(7 downto 1);
  49. elsif(inLEFT='1') then
  50. sSHR <= sSHR(7 downto 1) & sSHR(0);
  51. elsif(inBLINK='1') then
  52. sSHR <= not sSHR;
  53. end if;
  54. end if;
  55. end if;
  56. oLED(7 downto 0) <= sSHR;
  57. end process;
  58.  
  59. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement