数字秒表设计终结版综述_第1页
数字秒表设计终结版综述_第2页
数字秒表设计终结版综述_第3页
数字秒表设计终结版综述_第4页
数字秒表设计终结版综述_第5页
已阅读5页,还剩16页未读 继续免费阅读

付费下载

下载本文档

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

文档简介

1、河南机电高等专科学校可编程逻辑器件原理与应用课程设计报告数字秒表设计专业班级: 医电 131 学 号: 130411116 姓 名: 徐长伟 时 间: 2015 年 6 月 成 绩:时间:成绩:数字秒表设计摘要:本次设计的目的就是在掌握 EDA 实验开发系统的初步使用基础上,了解 EDA技术,对计算机系统中时钟控制系统进一步了解,掌握状态机工作原理,同时了 解计算机时钟脉冲是怎么产生和工作的。在掌握所学的计算机组成与结构课程理论 知识时,通过对数字秒表的设计,进行理论与实际的结合,提高与计算机有关设计 能力,提高分析、解决计算机技术实际问题的能力。通过课程设计深入理解计算机 结构与控制实现的技

2、术,达到课程设计的目标。关键词:FPGA数; 字秒表; VHDL目录1. 概述32. 设计要求 32.1 实验任务及要求 33. 总体构思 33.1 系统总体框图 44. 各单元电路的设计和实现 4.4.1 数字秒表的电路逻辑图 44.2 时序波形图如下: 44.3 顶层程序框图如下: 45. 功能仿真及其结果 5.5.1 分频模块 55.2 计数模块 55.3 势能控制模块 55.4 显示控制模块 56. 编译、下载及调试 7.6.1 各功能模块 VHDL 程序十分之一秒 77. 总结2.0.1. 概述超高速硬件描述语言 VHDL是数字系统进行抽象的行为与功能描述道具体的 内部线路结构描述,

3、 利用 EDA工具可以在电子设计的各个阶段各个层系进行计算 机模拟验证,保证设计过程中的正确性,可大大降低设计成本,缩短设计周期。 本文介绍的数字秒表设计, 。利用基于 VHDL的 EDA设计工具, 采用大规模可编程 逻辑器件 FPGA,通过设计芯片来实现系统功能。应用 VHDL语言设计数字系统,很多设计工作可以在计算机上完成,从而缩 短了系统的开发时间,提高了工作效率。本文介绍一种以 FPGA为核心,以 VHDL 为开发工具的数字秒表,并给出源程序和仿真结果。2. 设计要求2.1 实验任务及要求设计用于体育比赛用的数字秒表,要求:1. 及时精度大雨 1/1000 秒,计数器能显示 1/100

4、0 秒时间,提供给计时器内 部定时的始终频率为 12MHz;计数器的最长计时时间为 1 小时,为此需要一个 7 位的显示器,显示的最长时间为 59分 59.999 秒。2、设计有复位和起 / 停开关。(1)、复位开关用来使计时器清零,并做好计时准备。(2)、起/停开关的使用方法与传统的机械式计数器相同,即按一下起/ 停开关,启动计时器开始计时,再按一下起 / 停开关计时终止。(3)、复位开关可以在任何情况下使用,即使在计时过程中,只要按一下复 位开关,计时进程理科终止,并对计时器清零。3、采用层次设计方法设计符合上述功能要求的数字秒表。4、对电路进行功能仿真,通过波形确认电路设计是否正确。5、

5、完成电路传布设计后,通过实验箱下载验证设计的正确性。3. 总体构思3.1 系统总体框图数字秒表主要有分频器、计数模块、 功能控制模块、 势能控制模块和显示输出模图表 3-13-1 所示。本次的设计仿真选用以 EP1C6Q240芯片为核心的 FPGA开发板,该开发板提供了较完善的外围周边 为本次设计提供了硬件条件 状态的时间输出, 通过势能控制模块和显示输出模块驱动 7 时间。4. 各单元电路的设计和实现4.1 数字秒表的电路逻辑图路和信号接口, 并提供了一块 4位 7段数码管的扩展板,在设计中,功能控制模块根据控制选择不同的功能数应的图表4.2时序波形图如下:图表 4-24.3 顶层程序框图如

6、下:图表 4-35. 功能仿真及其结果5.1通过分频模块 3 次分频,将系统的时钟信开发板提供的系统时钟为 50 MHz,号分为 100 Hz和1 000 Hz分别提供给计数模块和势能控制模块作为时钟控制信。该模块部分 VHDL源程序如下: 态显示 4 位数据,在数据输入信号方面要做到和势能控制信号同频率输出, 才能 保证数码显示不会出错或显示移位。该模块部分 VHDL源程序如下:计数模块中,时钟信号是 100 Hz 作为秒表的百分秒输入,百分秒为 100 进 制计数器,其进位输出作为秒的计数时钟,秒为 60 进制计数器。控制信号输入 端的 begin-stop 和 reset 信号控制计数器

7、的开始、 停止和至零 源程序如下,方针结果如图 5-1 所示: 图表 5-1该模块部分 VHDL5.3 势能控制模块本次设计选用的开发板数码管扩展板的数码显示采用的是4 个数码管动态扫描输出,一般只要每个扫描频率超过人的眼睛视觉暂留频率24 Hz以上就可以达到点亮单个显示而不闪烁,扫描频率采用 1 kHz 信号。通过势能控制,每个的显示频率为 250 Hz,满足显示要求。该模块部分 VHDL源程序如下:5.4 显示控制模块本次设计选用的开发板在 4 位数码管输入方面只提供 1 个数据接口,用来动同时通过控制信号示系统处在不同的功能状态:系统时间运行状态,系统时 间至零状态,时钟正常显示状态。

8、利用功能转换信号实现 3个功能状态之间的转 换,并产生相应的控制信号去控制显示输出模块不同状态的正确显示。 其部分源 程序如下:各部分模块完成后,用Quartus 对程序编译、仿真、得到的仿真波形如图5-2 所示。图表 5-2本系统采用的 FPGA芯片为 Altera 公司的 EP1C6Q24,0用 VHDL和 Quartus 软件工具开发,设计输入完成后,进行整体的编译和逻辑仿真,然后进行转换、 延时仿真生成配置文件,最后下载至 FPGA器件,完成结果功能配置,实现其硬 件功能。6. 编译、下载及调试6.1 各功能模块 VHDL程序十分之一秒library ieee;use ieee.std

9、_logic_1164.all;use ieee.std_logic_unsigned.all;entity MINSECONDb isport(clk,clrm,stop:in std_logic;secm0:out std_logic_vector(3 downto 0); co:out std_logic);end MINSECONDb;architecture SEC of MINSECONDb is beginprocess(clk,clrm)variable cnt0:std_logic_vector(3 downto 0); beginif clrm=1 thencnt0:=00

10、00;elsif clkevent and clk=1thenif stop=0thenif cnt0=1001 then co=1; cnt0:=0000;elsif cnt01001 then cnt0:=cnt0+1; co=0;end if;else cnt0:=cnt0;end if;end if;secm0=cnt0;end process;end SEC;秒library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all; entity SECOND is port(clk,clr:in std_lo

11、gic;sec1,sec0:out std_logic_vector(3 downto 0); co:out std_logic);end SECOND;architecture SEC of SECOND is beginprocess(clk,clr)variable cnt1,cnt0:std_logic_vector(3 downto 0); beginif clr=1 then cnt1:=0000;cnt0:=0000;elsif clkevent and clk=1 then if cnt1=0101 and cnt0=1000 then co=1;cnt0:=1001; els

12、if cnt01001 thencnt0:=cnt0+1; co=0;else cnt0:=0000;if cnt10101 then cnt1:=cnt1+1;elsecnt1:=0000;co=0;end if;end if;end if;sec1=cnt1;sec0=cnt0;end process;end SEC;分library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity MINUTE is port(clk,en,clr:in std_logic;min1,min0:out std_

13、logic_vector(3 downto 0); co:out std_logic);end MINUTE;architecture MIN of MINUTE isbegin process(clk) variable cnt1,cnt0:std_logic_vector(3 downto 0);beginif clr=1 then cnt1:=0000;cnt0:=0000;elsif clkevent and clk=1 thenif en=1 thenif cnt1=0101 and cnt0=1000 then co=1; cnt0:=1001; elsif cnt01001 th

14、en cnt0:=cnt0+1;else cnt0:=0000;if cnt10101 thencnt1:=cnt1+1;co=0;else cnt1:=0000;end if;end if;end if;end if;min1=cnt1;min0=cnt0;end process;end MIN;闹钟library ieee;use ieee.std_logic_1164.all;entity nz isport(clk:in std_logic;time:in std_logic_vector(23 downto 0);h1,h0,m1,m0,s1,s0:in std_logic_vect

15、or(3 downto 0); qlk:out std_logic);end nz;architecture sss_arc of nz isbegin process(clk) beginif clkevent and clk=1 thenif (h1=time(23 downto 20) and h0=time(19 downto 16) and m1=time(15 downto 12) andm0=time(11 downto 8) and s1=time(7 downto 4)and s0=time(3 downto 0)thenqlk=1;else qlk=0;end if;end

16、 if;end process;end sss_arc; 顶层程序 library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity time2 is port(clk,clr,stop,en,led:in std_logic;time:in std_logic_vector(23 downto 0);qlk:out std_logic;hou1,hou0,m1,m0,s1,s0,sm0:out std_logic_vector(3 downto 0);end time2;architecture b

17、av of time2 is component MINSECONDb port(clk,clrm,stop:in std_logic;secm0:out std_logic_vector(3 downto 0);co:out std_logic);end component;component SECONDport(clk,clr:in std_logic;sec1,sec0:out std_logic_vector(3 downto 0);co:out std_logic);end component;component MINUTE port(clk,en,clr:in std_logi

18、c;min1,min0:out std_logic_vector(3 downto 0);co:out std_logic);end component;component HOURport(clk,en,clr,led:in std_logic;h1,h0:out std_logic_vector(3 downto 0);end component;component nzport(clk:in std_logic;time:in std_logic_vector(23 downto 0);h1,h0,m1,m0,s1,s0:in std_logic_vector(3 downto 0);q

19、lk:out std_logic);end component;signal c:std_logic;signal c1:std_logic;signal c2:std_logic;signal a1,a0,b1,b0,d1,d0,dm0:std_logic_vector(3 downto 0);beginhou1=a1;hou0=a0;m1=b1;m0=b0;s1=d1;s0=d0;sm0clk,clrm=clr,stop=stop,secm0=dm0,co=c); u2:SECONDport map(clk=c,clr=clr,sec1=d1,sec0=d0,co=c1);u3:MINUT

20、Eport map(clk=c1,clr=clr,min1=b1,min0=b0,en=en,co=c2);u4:HOURport map(clk=c2,clr=clr,h1=a1,h0=a0,en=en,led=led); u5:nzportmap(clk=clk,h1=a1,h0=a0,m1=b1,m0=b0,s1=d1,s0=d0,qlk=qlk, time=time);end bav;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity MINSECONDb isport(clk,

21、clrm,stop:in std_logic;secm0:out std_logic_vector(3 downto 0);co:out std_logic);end MINSECONDb;architecture SEC of MINSECONDb is beginprocess(clk,clrm)variable cnt0:std_logic_vector(3 downto 0);beginif clrm=1 thencnt0:=0000;elsif clkevent and clk=1thenif stop=0thenif cnt0=1001 thenco=1;cnt0:=0000;el

22、sif cnt01001 thencnt0:=cnt0+1;co=0;end if;else cnt0:=cnt0;end if;end if;secm0=cnt0;end process;end SEC;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity SECOND isport(clk,clr:in std_logic;sec1,sec0:out std_logic_vector(3 downto 0);co:out std_logic);end SECOND;architectu

23、re SEC of SECOND isbeginprocess(clk,clr)variable cnt1,cnt0:std_logic_vector(3 downto 0);beginif clr=1 thencnt1:=0000;cnt0:=0000;elsif clkevent and clk=1 thenif cnt1=0101 and cnt0=1000 thenco=1;cnt0:=1001;elsif cnt01001 thencnt0:=cnt0+1;co=0;elsecnt0:=0000;if cnt10101 thencnt1:=cnt1+1;elsecnt1:=0000;

24、co=0;end if;end if;end if;sec1=cnt1;sec0=cnt0;end process;end SEC;library ieee;use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all;entity MINUTE is port(clk,en,clr:in std_logic;min1,min0:out std_logic_vector(3 downto 0); co:out std_logic);end MINUTE;architecture MIN of MINUTE isbeginprocess

25、(clk)variable cnt1,cnt0:std_logic_vector(3 downto 0); beginif clr=1 then cnt1:=0000;cnt0:=0000;elsif clkevent and clk=1 thenif en=1 thenif cnt1=0101 and cnt0=1000 then co=1;cnt0:=1001;elsif cnt01001 thencnt0:=cnt0+1;else cnt0:=0000;if cnt10101 then cnt1:=cnt1+1;co=0;else cnt1:=0000;end if;end if;end

26、 if;end if;min1=cnt1;min0=cnt0;end process;end MIN;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity HOUR is port(clk,en,clr,led:in std_logic;h1,h0:out std_logic_vector(3 downto 0); end HOUR;architecture hour_arc of HOUR isbeginprocess(clk)variable cnt1,cnt0:std_logic_v

27、ector(3 downto 0); beginif clr=1 thencnt1:=0000;cnt0:=0000;elsif clkevent and clk=1 thenif en=1 thenif led=1 thenif cnt1=0010 and cnt0=0011 then cnt1:=0000;cnt0:=0000;elsif cnt01001 then cnt0:=cnt0+1;elsif cnt0=1001 then cnt1:=cnt1+1;cnt0:=0000;end if;elseif cnt1=0001 and cnt0=0001 then cnt1:=0000;cnt0:=0000;elsif cnt01001 then cnt0:=cnt0+1;elsif cnt0=1001 thencnt1:=cnt1+1; cnt0:=0000; e

温馨提示

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

评论

0/150

提交评论