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

📄 div.vhd

📁 CPLD原始代码程序
💻 VHD
字号:
--分配器
--**************库定义、 包定义********************
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--**************实体定义********************
Entity div is
generic(duty:integer:=5);--类属参数说明语句
	--端口说明	
 port(clk	:	in	std_logic;--时钟输入
		q	:   out std_logic--分频输出	   
	);
end div;
--**************构造体定义********************
Architecture div10 of div is
  constant period : integer:=10;--常数定义,分频数
  signal count : integer range 0 to period-1;--信号定义,计数作用
 begin
process(clk)--进程,由clk这个信号启动
  begin
	if rising_edge(clk) then --上升沿驱动,还有另一种写法,见其他例程 
		if count<duty then
			q<='0';
			count<=count+1;
		elsif count<period-1 then 
			q<='1';
			count<=count+1;
		else
			count<=0;
		end if;
	end if;
end process;
end div10;

⌨️ 快捷键说明

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