首页 > 其他 > 详细

8位数控分频器

时间:2019-11-30 15:57:32      阅读:179      评论:0      收藏:0      [点我收藏+]

数控分频器的功能就是当在输入端给定不同输入数据时,将对输入的时钟信号实现不同的分频比,即可实现设置数的分频计数器。

程序:

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity dvf is
port(
clk:in std_logic;
d:in std_logic_vector(7 downto 0);
four:out std_logic
);
end;
architecture one of dvf is
signal full:std_logic;
begin
p_reg:process(clk)
variable cnt8:std_logic_vector(7 downto 0);
begin
if clk‘event and clk=‘1‘ then
if cnt8="11111111" then
cnt8:=d;
full<=‘1‘;
else cnt8:=cnt8+1;
full<=‘0‘;
end if;
end if;
end process p_reg;
p_div:process(full)
variable cnt2:std_logic;
begin
if full‘event and full=‘1‘ then
cnt2:=not cnt2;
if cnt2=‘1‘then four<=‘1‘;
else four<=‘0‘;
end if;
end if;
end process p_div;
end;

RTL原图:

技术分享图片

 

 其仿真图:

技术分享图片

 

 

8位数控分频器

原文:https://www.cnblogs.com/lhkhhk/p/11962570.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!