Advertisement
salla

divisor_clk

Jul 29th, 2019
444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.82 KB | None | 0 0
  1. -- DIVISOR DE CLOCK
  2. -- 50MHz -> 1Hz
  3.  
  4. library IEEE;
  5. use IEEE.std_logic_1164.all;
  6. use IEEE.std_logic_unsigned.all;
  7. ------------------------------------------------------
  8. entity divisor_clk is
  9. port (clk_in: in std_logic;
  10.            q: out std_logic);
  11. end divisor_clk;
  12. ------------------------------------------------------
  13. architecture behavioral of divisor_clk is
  14. signal clk_div: std_logic;
  15. begin
  16. process(clk_in) -- Modelagem Comportamental
  17.     variable count: integer:= 1;                                              
  18. begin                                                      
  19.     if(clk_in'event and clk_in='1') then
  20.         count:= count+1;
  21.         if(count = 25000000) then
  22.             clk_div <= not clk_div;
  23.             count:= 1;
  24.         end if;
  25.     end if;
  26. end process;
  27.  
  28. q <= clk_div;
  29.  
  30. end behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement