⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clk_div.vhd

📁 Clock division document
💻 VHD
字号:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

library altera;
use altera.altera_syn_attributes.all;

entity clk_div is
    Port ( clk : in std_logic;
           reset : buffer bit
          );
end clk_div;

architecture Behavioral of clk_div is

signal count: std_logic_vector(20 downto 0);	  -- count is used to reduce the system frequency
signal cnt: std_logic_vector(3 downto 0);	  
signal s_clk: std_logic;	  
 
begin		 

U1:process(reset,clk)
begin
if (reset = '1') then
    count <= (others => '0'); 
elsif (clk'event and clk = '1') then
    if (count = "1010") then     -- counter has been set to divide the frequency by 65K
		count <= (others => '0');
    	s_clk<='0';
	else
		count <= count + '1';
     	s_clk<='1';
	end if;
end if;
end process;

end Behavioral;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -