You are on page 1of 2

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

ALL; entity clk_div is Port(clk_in:in std_logic; rst:in std_logic; clk_out:out std_logic); end clk_div; architecture Behavioral of clk_div is signal count: integer range 0 to 300000; begin process(clk_in,rst) begin if(rst='1')then count<=0; clk_out<='1'; elsif rising_edge (clk_in) then if count<(150000) then clk_out<='1'; count<=count+1; elsif count< 300000 then clk_out<='0'; count<=count+1; else count<=0; clk_out<='1'; end if;

end if; end process; end Behavioral;

You might also like