Advertisement
Guest User

a

a guest
May 26th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.89 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4.  
  5. entity CNT20_PLIS is port (  
  6.         CLK     : in std_logic;     --Sinchro signalas
  7.         RST     : in std_logic;     -- Reset signalas
  8.         CNT_CMD : in std_logic;     -- Komanda 
  9.         CNT_C   : out std_logic;    --Pernasa  
  10.         CNT_O   : out std_logic_vector(4 downto  0)
  11.         );
  12. end CNT20_PLIS;
  13.  
  14.  
  15. architecture rtl of CNT20_PLIS is
  16.     signal CNT_A: unsigned (4 downto  0);
  17. begin  
  18.     process(CLK, RST, CNT_CMD)
  19.     begin
  20.    
  21.         if RST = '0' then
  22.             CNT_A <= "00000";
  23.             CNT_C <= '1';  
  24.            
  25.         elsif CLK'event and CLK = '1' and CNT_CMD = '1' then
  26.        
  27.             if CNT_A < 19  then
  28.                 CNT_A <= CNT_A + 1;
  29.                
  30.                 if CNT_A = 18 then
  31.                     CNT_C <= '0';  
  32.                
  33.                 else
  34.                     CNT_C <= '1';
  35.                    
  36.                 end if;
  37.             else     
  38.                 CNT_C <= '1';
  39.                 CNT_A <= "00000";
  40.                
  41.             end if;
  42.         end if;    
  43.     end process;
  44. CNT_O <= not(std_logic_vector(CNT_A)); 
  45. end rtl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement