Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --LED SHOW
- library IEEE;
- use IEEE.STD_LOGIC_1164.ALL;
- use IEEE.STD_LOGIC_UNSIGNED.ALL;
- entity LedShow is
- Port ( inRST : in STD_LOGIC;
- iCLK : in STD_LOGIC;
- oLED : out STD_LOGIC_VECTOR (7 downto 0);
- inLEFT : in STD_LOGIC;
- inRIGHT : in STD_LOGIC;
- inBLINK : in STD_LOGIC);
- end LedShow;
- architecture Behavioral of LedShow is
- signal sCNT : std_logic_vector(24 downto 0);
- signal sTC : std_logic;
- signal sSHR : std_logic_vector(7 downto 0);
- begin
- --Brojac
- process(inRST, iCLK) begin
- if(inRST='0') then
- sCNT <= (others => '0');
- elsif(iCLK'event and iCLK='1') then
- if(sCNT=23999999) then
- sCNT <= (others => '0');
- else
- sCNT <= sCNT+1;
- end if;
- end if;
- end process;
- --Terminal count
- sTC <= '1' when sCNT=0 else '0';
- --Pomeracki registar
- process(inRST, iCLK,sSHR) begin
- if(inRST='0') then
- sSHR <= "00000001";
- elsif(iCLK'event and iCLK='1') then
- if(sTC='1') then
- if(inRIGHT='1') then
- sSHR <= sSHR(0) & sSHR(7 downto 1);
- elsif(inLEFT='1') then
- sSHR <= sSHR(7 downto 1) & sSHR(0);
- elsif(inBLINK='1') then
- sSHR <= not sSHR;
- end if;
- end if;
- end if;
- oLED(7 downto 0) <= sSHR;
- end process;
- end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement