Guest User

Untitled

a guest
Feb 24th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3.  
  4. entity blink is
  5. Port ( clk : in STD_LOGIC;
  6. reset : in STD_LOGIC;
  7. o : out STD_LOGIC);
  8. end blink;
  9.  
  10. architecture Behavioral of blink is
  11.  
  12. signal aux : std_logic;
  13. signal trigger_aux : std_logic;
  14. signal q_aux : std_logic_vector(3 downto 0);
  15.  
  16. component counter
  17. generic(size: integer := 4;
  18. trigger_value: integer);
  19. port(clk, reset, enable : in std_logic;
  20. q : out std_logic_vector(size-1 downto 0);
  21. trigger: out std_logic );
  22. end component;
  23.  
  24. begin
  25.  
  26. count : counter
  27. generic map(size => 26, trigger_value => 50000000)
  28. port map(clk => clk, enable => '1', reset => reset, trigger => trigger_aux);
  29.  
  30. toggle: process(clk, reset)
  31. begin
  32. if reset = '0' then
  33. aux <= '0';
  34. elsif clk'event and clk = '1' then
  35. if trigger_aux = '1' then
  36. aux <= not aux;
  37. else
  38. aux <= aux;
  39. end if;
  40. end if;
  41. end process;
  42. o <= aux;
  43.  
  44. end Behavioral;
Add Comment
Please, Sign In to add comment