clk_div.vhd

来自「用VKDL语言编写的PWM控制程序很有用本例只做了5路PWM」· VHDL 代码 · 共 50 行

VHD
50
字号
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity clk_div is
port(clk:in std_logic;
	clk1:out std_logic;
	clk16:out std_logic;
	clk512:out std_logic);
end;
architecture one of clk_div is
signal clk1_1:std_logic;
signal clk2_2:std_logic;
signal clk3_3:std_logic;
begin
process(clk)
variable count:integer range 0 to 4;-----10
begin
if clk'event and clk='1'then
	if count=4 then
		clk1_1<=not clk1_1;
		count:=0;
	else
		count:=count+1;
		end if;
end if;
end process;
-------------------------------
process(clk)
variable count:integer range 0 to 2;------6
begin
if clk'event and clk='1'then
	if count=2 then
		clk2_2<=not clk2_2;
		count:=0;
	else
		count:=count+1;
		end if;
end if;
end process;
-----------------------------------
process(clk)
begin
if clk'event and clk='1'then
		clk3_3<=not clk3_3;
		end if;
end process;
clk1<=clk1_1;
clk16<=clk2_2;
clk512<=clk3_3;
end;

⌨️ 快捷键说明

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