Advertisement
themkss

Untitled

May 22nd, 2023
684
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.99 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4.  
  5. entity TOP_CNT is port (  
  6.        
  7.         CLK_I   : in std_logic; --Sinchro signalas
  8.         RST_I   : in std_logic; -- Reset signalas
  9.         ENBL_I  : in std_logic; -- Aktyvavimo signalas 
  10.         CNT_CO  : out std_logic --Pernasa
  11.         );
  12. end TOP_CNT;       
  13.  
  14. architecture struct of TOP_CNT is  
  15. signal C,RST_internal,C1,C2,C3 : std_logic;
  16. signal CNT_1_O :  std_logic_vector(4 downto 0);
  17. signal CNT_2_O :  std_logic_vector(5 downto 0);
  18. signal CNT_3_O :  std_logic_vector(5 downto 0);
  19.  
  20. component    CNT25 port (
  21.         CLK : in std_logic; --Sinchro signalas
  22.         RST : in std_logic; -- Reset signalas
  23.         CNT_CMD  : in std_logic; -- Komanda
  24.         CNT_C    : out std_logic; --Pernasa
  25.         CNT_O    : out std_logic_vector(4 downto  0)); 
  26. end component; 
  27.  
  28. component    CNT33 port  (
  29.         CLK : in std_logic; --Sinchro signalas
  30.         RST : in std_logic; -- Reset signalas
  31.         CNT_CMD  : in std_logic; -- Komanda
  32.         CNT_C    : out std_logic; --Kai pasiekia 0  
  33.         CNT_O    : out std_logic_vector(5 downto  0)); 
  34. end component;
  35.  
  36. component    CNT40 port  (
  37.         CLK : in std_logic; --Sinchro signalas
  38.         RST : in std_logic; -- Reset signalas
  39.         CNT_CMD  : in std_logic; -- Komanda
  40.         CNT_C    : out std_logic; --Kai pasiekia 0  
  41.         CNT_O    : out std_logic_vector(5 downto  0)); 
  42. end component;
  43.  
  44.  
  45. begin
  46.     CNT_1:  CNT25   port map (CLK=>CLK_I,  
  47.         RST=>RST_internal, CNT_CMD=>ENBL_I,
  48.         CNT_C=>C1, CNT_O=>CNT_1_O);
  49.     CNT_2:  CNT33  port map (CLK=>C1,      
  50.         RST=>RST_internal, CNT_CMD=>ENBL_I,
  51.         CNT_C=>C2, CNT_O=>CNT_2_O);
  52.     CNT_3:  CNT40   port map (CLK=>C2,  
  53.         RST=>RST_internal, CNT_CMD=>ENBL_I,
  54.         CNT_C=>C3, CNT_O=>CNT_3_O);    
  55.     process(CLK_I,RST_I)
  56.     begin
  57.         if  (RST_I = '1') then
  58.             RST_internal <= '1';  
  59.         elsif CLK_I'event and CLK_I = '1' then     
  60.             if ((CNT_1_O = "01011")
  61.             and (CNT_2_O = "000011")
  62.             and (CNT_3_O = "000010"))  then  
  63.                 RST_internal <= '1';
  64.                 CNT_CO <= '1';
  65.             else
  66.                 RST_internal <= '0';  
  67.                 CNT_CO <= '0'; 
  68.             end if;        
  69.         end if;
  70.     end process;
  71. end struct;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement