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

📄 count.vhd

📁 FPGA的串口通信程序
💻 VHD
字号:
--放大电路中x9511控制信号要求有一定的宽度,故要求发送的控制信号在脉宽上有一定的限制
--the parameter clkout determined the width of the ctrl signal
library ieee ;
use ieee.std_logic_1164.all ;
use ieee.std_logic_arith.all ;

entity count is
port 
(
	  clkin	 	: in std_logic ;
	  clkout	: out std_logic
) ;
end count ;

architecture rtl of count is

signal count: unsigned (21 downto 0);

begin

process(clkin)
begin
if clkin'event and clkin = '1' then
if std_logic_vector(count) = "1010000000000000000000"  then
	 count <= "0000000000000000000000";
else count <= count + "0000000000000000000001";		--计数
end if;
end if;
end process;

process(clkin)
begin
if clkin'event and clkin = '1' then
if count(21) = '1' then
	 clkout <= '0';
else clkout <= '1';									--得出控制信号
end if;
end if;
end process;

end;

⌨️ 快捷键说明

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