利用VHDL语言设计的数字钟.doc_第1页
利用VHDL语言设计的数字钟.doc_第2页
利用VHDL语言设计的数字钟.doc_第3页
利用VHDL语言设计的数字钟.doc_第4页
利用VHDL语言设计的数字钟.doc_第5页
免费预览已结束,剩余6页可下载查看

下载本文档

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

文档简介

SIPIVT PLD技术课程设计 一、题目:数字钟二、设计目的掌握各类计数器和分频器以及它们相连的设计方法;掌握多个数码管的原理与方法;掌握CPLD技术的层次化设计的方法;掌握使用VHDL语言的设计思想;对整个系统的设计有一个了解。三、设计系统环境(1)一台PC机;(2)一套GW48型EDA实验开发系统硬件;(3)X+PLUS 集成化的开发系统硬件。 四、设计要求(1) 能进行正常的时、分、秒计时功能,分别由6个数码管显示24h、60min、60s。(2) 按下sa键时,计时器迅速递增,并按24h循环,计时满23h后回00。(3) 按下sb键时,计时器迅速递增,并按60min循环,计时满59min后回00。(4)输入的时钟信号为3MHz。五、总体框图六、模块及模块功能(1) 模块CNT60_2 该模块为60进制计数器,计时输出为秒的数值,在计时到59时送出进位信号CO,因为硬件有延时,所以模块CNT60_2在此模块变为00时加1,符合实际。A、模块 B、程序libraryieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt60_2 isport(clk:in std_logic; s1,s0:out std_logic_vector(3 downto 0); co:out std_logic);end cnt60_2;architecture behav of cnt60_2 isbeginprocess(clk)variable cnt1,cnt0:std_logic_vector(3 downto 0);beginif clkevent and clk=1 then if cnt1=0101 and cnt0=1000 then co=1; cnt0:=1001;elsif cnt01001 then cnt0:=cnt0+1;else cnt0:=0000; if cnt10101 then cnt1:=cnt1+1;else cnt1:=0000; co=0;end if;end if;end if;s1=cnt1;s0=cnt0;end process;end behav;C、流程图 D、波形仿真(2)模块CNT60_1 该模块为60进制计数器,计时输出为分的数值,在EN信号有效且时钟到来时,计数器加1。在sb按下时,EN信号有效,计数值以秒的速度增加,从而实现对分钟的设置。A、 模块B、程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt60_1 isport(en,clk:in std_logic; min1,min0:out std_logic_vector(3 downto 0); co:out std_logic);end cnt60_1;architecture behav of cnt60_1 isbeginprocess(clk)variable cnt1,cnt0:std_logic_vector(3 downto 0);beginif clkevent and clk=1 thenif en=1 then if cnt1=0101 and cnt0=1000 then co=1; cnt0:=1001; elsif cnt01001 then cnt0:=cnt0+1;else cnt0:=0000; if cnt10101 then cnt1:=cnt1+1;else cnt1:=0000; co=0;end if;end if;end if;end if;min1=cnt1;min0=cnt0;end process;end behav;C、流程图D、波形仿真(2) 模块CNT24 该模块为24进制计数器,计时输出为小时的数值,在EN信号有效且时钟到来时,计数器加1。在sa按下时,EN信号有效,计数值以秒的速度增加,从而实现对时钟的设置。A、模块 B、程序libraryieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt24 isport(en,clk:in std_logic; h1,h0:out std_logic_vector(3 downto 0);end cnt24;architecture behav of cnt24 isbeginprocess(clk)variable cnt1,cnt0:std_logic_vector(3 downto 0);beginif clkevent and clk=1 thenif en=1 then if cnt1=0010 and cnt0=0011 then cnt0:=0000; cnt1:=0000; elsif cnt01001 then cnt0:=cnt0+1;else cnt0:=0000; cnt1:=cnt1+1; end if;end if;end if;h1=cnt1;h0=cnt0;end process;end behav;C、流程图D、波形仿真(3) 模块FPQ 该模块的输入为3MHz方波,输出为1kHz的方波。A、模块B、程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fpq isport(clk:in std_logic; q:out std_logic);end fpq;architecture behav of fpq is signal x:std_logic;begin process(clk) variable cnt:integer range 0 to 1499999;beginif clkevent and clk=1 thenif cnt1499999 thencnt:=cnt+1;elsecnt:=0;x=not x; end if;end if;q=x;end process;end behav;B、 流程图七、管脚分配(选择模式7) 输入:clk 84 输出:s00 27sa 16 s01 28sb 9 s02 29s03 30s10 35s11 36s12 37s13 38min00 39min01 47min02 48min03 49min10 50min11 51min12 52min13 53h00 54h01 58h02 59h03 60h10 61h11 62h12 64h13 65八、调试使用说明(1) 输入60进制计数器(秒)、60进制计数器(分)、24进制计数器、3MHz1kHz 分频器四个程序,并编译、波形仿;然后生成器件。(2) 画原理图:找到第一步生成的器件,并将它们调入原理图编辑

温馨提示

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

最新文档

评论

0/150

提交评论