山东大学电子设计自动化(EDA)硬件实验-实验7 分频器设计

一:实验要求:(分频输出:1Hz或2Hz的信号)

实验开发板上有一个50MHz的时钟脉冲(此频率过高,接到开发板的LED灯后,无法观察到LED灯一亮一灭的过程) ,设计一个分频器,使得分频后的时钟脉冲接到开发板上的LED灯后,肉眼可以观察到LED灯闪烁。

二:  实验仪器与器材

1.EDA 开发软件

2.微机

3.实验开发系统

4.打印机

5.其他器件与材料

三:实验内容:

1.源代码

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity fenpin is
generic(n:integer:=50000000);
port(clk:in std_logic;
y:out std_logic);
end entity;

architecture info of fenpin is
signal count:integer range n-1 downto 0:=n-1;
begin
process(clk)
begin
	 if (clk'event and clk='1' and clk'last_value='0')
	 then count<=count-1;
	 if count>=n/2
	 then y<='0';
	 else y<='1';
	 end if;
	 if count<=0 then
	 count<=n-1;
	 end if;
	 end if;
end process;
end architecture;

2.编译情况:

3.引脚配置

4.仿真波形:

© 版权声明
THE END
喜欢就支持以下吧
点赞0赞赏 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容