Está en la página 1de 1

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity divider is --Inicio de la entidad


Port ( reloj : in std_logic; --Una entrada para el reloj
div_clk : out std_logic); --salida la señal de reloj con el divisor
end divider; --Fin de la entidad

architecture Behavioral of divider is --Inicio de la arquitectura


begin
process (reloj) --Inicio de un proceso que recibe la señal de reloj
variable cuenta: std_logic_vector (27 downto 0):=X"0000000"; --variable
cuenta de 28 bits
begin
if rising_edge (reloj) then --Si hay un flanco de subida
if cuenta=X"4000000" then --Si la cuenta ya llegó a 0100 0000
0000 0000 0000 0000 0000
cuenta:=X"0000000"; --Se reinicia la cuenta
else
cuenta:= cuenta+1; --Sino se le suma uno a la cuenta
end if;
end if;
div_clk <= cuenta (25);
end process; --Fin del proceso
end Behavioral; --Fin de la arquitectura

También podría gustarte