📄 clk_div.vhd
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity clk_div is
generic(n:integer:=10);
port(clkin :in std_logic;
clk :out std_logic);
end clk_div;
architecture behave of clk_div is
signal clk_temp:std_logic;
signal count:integer range 0 to n;
begin
clk<=clk_temp;
process(clkin)
begin
if(n=1)then
clk_temp<=clkin;
elsif(clkin'event and clkin='1')then
if(n=2)then
clk_temp<=not clk_temp;
elsif(n>2)then
if(count=n)then
count<=0;
else
count<=count+1;
end if;
if(count<n/2)then
clk_temp<='1';
else
clk_temp<='0';
end if;
end if;
end if;
end process;
end behave;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -