EDA数字时钟设计_第1页
EDA数字时钟设计_第2页
EDA数字时钟设计_第3页
EDA数字时钟设计_第4页
EDA数字时钟设计_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Quartus数字时钟设计 1. 设计功能1. 可以快速设置时钟起始值;2. 在59分50秒时开始报时,七声低音,一声高音,报完刚好整点。二.功能实现1.顶层设计(采用BDF文件图形设计,文件名:timer.bdf)2. 秒计时器模块设计library ieee;use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all;entity second1 isport(clk1s:in std_logic; reset:in std_logic; sec2,sec1:buffe

2、r std_logic_vector(3 downto 0);-秒的十位和个位 seco: out std_logic); -秒计时器的进位输出end;architecture A of second1 is begin process(clk1s,reset) begin if reset = 0 then sec2 = 0000; sec1 = 0000; -清零秒计时器 seco = 0; elsif clk1sevent and clk1s =1 then if (sec1 = 1001 and sec2 = 0101) then sec2 = 0000;sec1 =0000; -在5

3、9秒时回零 seco = 1; -进位 elsif (sec1 =1001) then sec1 =0000; sec2 = sec2+1; seco = 0; else sec1 = sec1+1; seco = 0; end if; end if;end process;end;3.分计时器模块设计library ieee;use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all;entity minute1 isport(clkm,clk1s,setm:in std

4、_logic; -秒进位输入,1HZ校分时钟输入信号,校分控制信号 min2,min1:buffer std_logic_vector(3 downto 0); -分计时器的十位和个位 minco:out std_logic);end;architecture A of minute1 is signal clkx:std_logic; begin Pclkm:process(clkm,clk1s,setm) begin -根据是否校分选择计时时钟 if setm =1 then clkx = clk1s; -利用clk1s信号对分的初值进行快速设置 else clkx =clkm; -利用秒

5、的进位信号正常计时 end if;end process;Pcontm:process(clkx) begin if clkxevent and clkx =1 then if (min1 = 1001 and min2 = 0101) then min1 =0000;min2 =0000;minco =1; -59分时回零并进位 elsif (min1 = 1001) then min1 =0000;min2 = min2+1; minco = 0; else min1 = min1+1;minco =0; end if; end if;end process;end;4.时计时器模块设计l

6、ibrary ieee;use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all;entity hour1 is port(clkh,clk1s,seth:in std_logic; hou2,hou1:buffer std_logic_vector(3 downto 0) ); -时的十位和个位end;architecture A of hour1 is signal clky:std_logic; begin Pclkh:process(clkh,clk1s,seth

7、) Begin -根据是否校时选择计时时钟 if seth =1 then clky =clk1s; -利用clk1s信号对时的初值进行快速设置 else clky = clkh; -利用分的进位信号正常计时 end if; end process;Pconth:process(clky) begin if clkyevent and clky =1 then if (hou1=0011 and hou2 =0010 ) then hou1 = 0000;hou2 = 0000; -23时回零 elsif (hou1 =1001) then hou1 = 0000; hou2 = hou2+1

8、; else hou1 flag500:=1; when 0010 = flag500:=1; when 0100 = flag500:=1; when 0110 = flag500:=1; when 0111 = flag500:=1; when 1000 = flag500:=1; when 1001 = flag500:=1; -50,52,54,56,58,59秒时低频率报时 when others = flag500:=0;flag1k:=0; end case; else flag500:=0;flag1k:=0; end if; if (min1 =0000 and min2=0000 and sec1=0000 and sec2=0000) then flag1k:=1; -整点时高频率报时 end if; end if;if flag500=1 then alarm =clk500; elsif flag1k=1 then alarm =clk1k; else alarm =0;end if;end process;end;三.仿真结果1. 秒计时器仿真结果2. 分计时器仿真结果3. 时计时器仿真结果4. 报时模块仿真

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论