Advertisement
crsandu

Untitled

May 20th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.95 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;       
  3. use ieee.std_logic_arith.all;  
  4. use ieee.std_logic_unsigned.all;
  5.  
  6. entity NUMARATOR is
  7.     port(
  8.         CE: in std_logic;
  9.         CLK: in std_logic;
  10.         DATA_in: in std_logic_vector(3 downto 0);
  11.         PL: in std_logic;
  12.        
  13.         RESET: in std_logic;
  14.        
  15.         TC: out std_logic;
  16.         DATA_out: out std_logic_vector(3 downto 0));
  17. end NUMARATOR;
  18.  
  19. architecture NUMARATOR_arch of NUMARATOR is
  20. begin
  21.     NUMARATOR_10: process(CLK, RESET, PL)
  22.         variable count: std_logic_vector(3 downto 0) := (others => '0');
  23.     begin  
  24.         TC <= '0';
  25.         if(RESET = '0') THEN
  26.             count := (others => '0');
  27.         ELSIF (PL = '0') THEN
  28.             count := DATA_in;
  29.         ELSIF (rising_edge(CLK)) THEN
  30.             IF(CE = '1') THEN
  31.                 IF(count = "1001") THEN
  32.                     count := (others => '0');  
  33.                 ELSE
  34.                     count := count+1;
  35.                 END IF;
  36.             END IF;
  37.         END IF;
  38.         IF(count = "1001") THEN
  39.             TC <= '1';
  40.         END IF;
  41.         DATA_out <= count;
  42.     end process NUMARATOR_10;
  43. end NUMARATOR_arch;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement