版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、河南机电高等专科学校可编程逻辑器件原理与应用课程设计报告数字秒表设计专业班级: 医电131 学 号: 姓 名: 徐长伟 时 间: 2015年6月 成 绩: 数字秒表设计摘要:本次设计的目的就是在掌握EDA实验开发系统的初步使用基础上,了解EDA技术,对计算机系统中时钟控制系统进一步了解,掌握状态机工作原理,同时了解计算机时钟脉冲是怎么产生和工作的。在掌握所学的计算机组成与结构课程理论知识时,通过对数字秒表的设计,进行理论与实际的结合,提高与计算机有关设计能力,提高分析、解决计算机技术实际问题的能力。通过课程设计深入理解计算机结构与控制实现的技术,达到课程设计的目标。关键词:FPGA;数字秒表;
2、VHDL 目录1.概述32.设计要求42.1实验任务及要求43.总体构思43.1系统总体框图44.各单元电路的设计和实现54.1数字秒表的电路逻辑图54.2时序波形图如下:74.3顶层程序框图如下:85.功能仿真及其结果85.1分频模块85.2计数模块95.3势能控制模块105.4显示控制模块116.编译、下载及调试136.1各功能模块VHDL程序十分之一秒137.总结271.概述超高速硬件描述语言VHDL是数字系统进行抽象的行为与功能描述道具体的内部线路结构描述,利用EDA工具可以在电子设计的各个阶段各个层系进行计算机模拟验证,保证设计过程中的正确性,可大大降低设计成本,缩短设计周期。本文介
3、绍的数字秒表设计,。利用基于VHDL的EDA设计工具,采用大规模可编程逻辑器件FPGA,通过设计芯片来实现系统功能。应用VHDL语言设计数字系统,很多设计工作可以在计算机上完成,从而缩短了系统的开发时间,提高了工作效率。本文介绍一种以FPGA为核心,以VHDL为开发工具的数字秒表,并给出源程序和仿真结果。2.设计要求2.1实验任务及要求设计用于体育比赛用的数字秒表,要求:1.及时精度大雨1/1000秒,计数器能显示1/1000秒时间,提供给计时器内部定时的始终频率为12MHz;计数器的最长计时时间为1小时,为此需要一个7位的显示器,显示的最长时间为59分59.999秒。2、设计有复位和起/停开
4、关。 (1)、复位开关用来使计时器清零,并做好计时准备。 (2)、起/停开关的使用方法与传统的机械式计数器相同,即按一下起/停开关,启动计时器开始计时,再按一下起/停开关计时终止。 (3)、复位开关可以在任何情况下使用,即使在计时过程中,只要按一下复位开关,计时进程理科终止,并对计时器清零。3、采用层次设计方法设计符合上述功能要求的数字秒表。4、对电路进行功能仿真,通过波形确认电路设计是否正确。5、完成电路传布设计后,通过实验箱下载验证设计的正确性。3.总体构思3.1系统总体框图数字秒表主要有分频器、计数模块、功能控制模块、势能控制模块和显示输出模块组成。系统框图如图3-1所示。图表 3-1本
5、次的设计仿真选用以EP1C6Q240芯片为核心的FPGA开发板,该开发板提供了较完善的外围周边电路和信号接口,并提供了一块4位7段数码管的扩展板,为本次设计提供了硬件条件。在设计中,功能控制模块根据控制选择不同的功能状态的时间输出,通过势能控制模块和显示输出模块驱动7段数码管显示相应的时间。4.各单元电路的设计和实现4.1数字秒表的电路逻辑图图表 4-14.2时序波形图如下:图表 4-24.3顶层程序框图如下:清零CLR开关ENA时钟CLK十分之一秒秒个位(10进制)秒十位(6进制)分个位(10进制)分十位(6进制)闹钟(预置时间)图表 4-35.功能仿真及其结果5.1分频模块开发板提供的系统
6、时钟为50 MHz,通过分频模块3次分频,将系统的时钟信号分为100 Hz和1 000 Hz分别提供给计数模块和势能控制模块作为时钟控制信号。该模块部分VHDL源程序如下:5.2计数模块计数模块中,时钟信号是100 Hz作为秒表的百分秒输入,百分秒为100进制计数器,其进位输出作为秒的计数时钟,秒为60进制计数器。控制信号输入端的begin-stop和reset信号控制计数器的开始、停止和至零。该模块部分VHDL源程序如下,方针结果如图5-1所示:图表 5-15.3势能控制模块本次设计选用的开发板数码管扩展板的数码显示采用的是4个数码管动态扫描输出,一般只要每个扫描频率超过人的眼睛视觉暂留频率
7、24 Hz以上就可以达到点亮单个显示而不闪烁,扫描频率采用1 kHz信号。通过势能控制,每个的显示频率为250 Hz,满足显示要求。该模块部分VHDL源程序如下:5.4显示控制模块本次设计选用的开发板在4位数码管输入方面只提供1个数据接口,用来动态显示4位数据,在数据输入信号方面要做到和势能控制信号同频率输出,才能保证数码显示不会出错或显示移位。该模块部分VHDL源程序如下: 同时通过控制信号示系统处在不同的功能状态:系统时间运行状态,系统时间至零状态,时钟正常显示状态。利用功能转换信号实现3个功能状态之间的转换,并产生相应的控制信号去控制显示输出模块不同状态的正确显示。其部分源程序如下:各部
8、分模块完成后,用Quartus对程序编译、仿真、得到的仿真波形如图5-2所示。图表 5-2本系统采用的FPGA芯片为Altera公司的EP1C6Q240,用VHDL和Quartus软件工具开发,设计输入完成后,进行整体的编译和逻辑仿真,然后进行转换、延时仿真生成配置文件,最后下载至FPGA器件,完成结果功能配置,实现其硬件功能。6.编译、下载及调试6.1各功能模块VHDL程序十分之一秒library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity MINSECONDb isport(clk,clrm
9、,stop:in std_logic; secm0:out std_logic_vector(3 downto 0); co:out std_logic);end MINSECONDb;architecture SEC of MINSECONDb isbeginprocess(clk,clrm)variable cnt0:std_logic_vector(3 downto 0); beginif clrm=1 thencnt0:=0000;elsif clkevent and clk=1then if stop=0thenif cnt0=1001 thenco=1;cnt0:=0000;els
10、if 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;architec
11、ture 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:=000
12、0;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 isport(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 isbeginproce
13、ss(clk)variable cnt1,cnt0:std_logic_vector(3 downto 0);beginif clr=1 thencnt1:=0000;cnt0:=0000;elsif clkevent and clk=1 thenif en=1 thenif cnt1=0101 and cnt0=1000 thenco=1;cnt0:=1001;elsif cnt01001 thencnt0:=cnt0+1;elsecnt0:=0000;if cnt10101 thencnt1:=cnt1+1;co=0;elsecnt1:=0000;end if;end if;end if;
14、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_vector(3 downto 0); qlk:out std_logic);end nz;architecture sss_arc of nz is begin process(clk) begin if c
15、lkevent and clk=1 then if (h1=time(23 downto 20) and h0=time(19 downto 16) and m1=time(15 downto 12) and m0=time(11 downto 8) and s1=time(7 downto 4)and s0=time(3 downto 0)then qlk=1; else qlk=0; end if; end if;end process;end sss_arc;顶层程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_u
16、nsigned.all;entity time2 isport(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 bav of time2 iscomponent MINSECONDb port(clk,clrm,stop:in std_logic; secm0:out std_logic_vecto
17、r(3 downto 0); co:out std_logic);end component;component SECOND port(clk,clr:in std_logic; sec1,sec0:out std_logic_vector(3 downto 0); co:out std_logic);end component;component MINUTEport(clk,en,clr:in std_logic; min1,min0:out std_logic_vector(3 downto 0); co:out std_logic);end component;component H
18、OUR port(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); qlk:out std_logic);end component; signal c:std_logic;signal c1:std_logic;signal c2:s
19、td_logic;signal a1,a0,b1,b0,d1,d0,dm0:std_logic_vector(3 downto 0);begin hou1=a1;hou0=a0;m1=b1;m0=b0;s1=d1;s0=d0;sm0clk,clrm=clr,stop=stop,secm0=dm0,co=c); u2:SECOND port map(clk=c,clr=clr,sec1=d1,sec0=d0,co=c1); u3:MINUTE port map(clk=c1,clr=clr,min1=b1,min0=b0,en=en,co=c2); u4:HOUR port map(clk=c2
20、,clr=clr,h1=a1,h0=a0,en=en,led=led); u5:nz port map(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,clrm,stop:in std_logic; secm0:out std_logic_vector(3 downto 0); co:out std
21、_logic);end MINSECONDb;architecture SEC of MINSECONDb isbeginprocess(clk,clrm)variable cnt0:std_logic_vector(3 downto 0); beginif clrm=1 thencnt0:=0000;elsif clkevent and clk=1then if stop=0thenif cnt0=1001 thenco=1;cnt0:=0000;elsif cnt01001 thencnt0:=cnt0+1;co=0;end if;else cnt0:=cnt0;end if;end if
22、;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;architecture SEC of SECOND isbeginprocess(clk,clr)variable cnt1,cnt0:std_logic_
23、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;co=0;end if;end if;end if;sec1=cnt1;sec0=cnt0;end process;end SEC;lib
24、rary ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity MINUTE isport(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(clk)variable cnt1,cnt0:std_logic_vector(3 downto 0);beginif clr=1 the
25、ncnt1:=0000;cnt0:=0000;elsif clkevent and clk=1 thenif en=1 thenif cnt1=0101 and cnt0=1000 thenco=1;cnt0:=1001;elsif cnt01001 thencnt0:=cnt0+1;elsecnt0:=0000;if cnt10101 thencnt1:=cnt1+1;co=0;elsecnt1:=0000;end if;end if;end if;end if;min1=cnt1;min0=cnt0;end process;end MIN;library ieee;use ieee.std
26、_logic_1164.all;use ieee.std_logic_unsigned.all;entity HOUR isport(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_vector(3 downto 0);beginif clr=1 thencnt1:=0000;cnt0:=0000;elsif clkevent and
27、clk=1 thenif en=1 thenif led=1 thenif cnt1=0010 and cnt0=0011 thencnt1:=0000;cnt0:=0000;elsif cnt01001 thencnt0:=cnt0+1;elsif cnt0=1001 thencnt1:=cnt1+1;cnt0:=0000;end if;else if cnt1=0001 and cnt0=0001 thencnt1:=0000;cnt0:=0000;elsif cnt01001 thencnt0:=cnt0+1;elsif cnt0=1001 thencnt1:=cnt1+1;cnt0:=0000;
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026贵州峰鑫建设投资(集团)有限公司招聘演艺人员2人备考题库带答案详解(b卷)
- 2026广东惠州博罗县园洲镇九潭卫生院招聘编外工作人员1人备考题库附完整答案详解(名校卷)
- 2026河南周口市公益性岗位补录招聘37人备考题库含答案详解(新)
- 2026新疆博尔塔拉蒙古自治州华棉棉业有限责任公司招聘1人备考题库ab卷附答案详解
- 2026广西贵港桂平市罗秀中心卫生院招聘编外工作人员8人备考题库及参考答案详解(轻巧夺冠)
- 2026内蒙古霍林河机场管理有限责任公司招聘工作人员3人备考题库附完整答案详解(网校专用)
- 2026广东深圳市宝安区教科院实验幼儿园招聘公办幼儿园短期主班教师1人备考题库及完整答案详解【夺冠系列】
- 2026山东日照市教育局直属学校招聘第一批急需紧缺教师29人备考题库(综合卷)附答案详解
- 企业年度预算编制及管理工具包
- 产品定价决策辅助支持工具
- 中烟机械技术中心招聘笔试题库2026
- 矿山运输车队运营管理制度
- 钛厂生产耗材领用制度
- 码头安全员培训内容
- 2026年淮南联合大学单招职业技能测试题库附答案
- (正式版)DB61∕T 2107-2025 《矿产资源规划实施评估技术规范》
- 老年活动中心活动管理规定
- 手术室无菌管理
- 共建鲁班工坊协议书
- 机械基础课件:材料及热处理
- 生产进度跟踪管理模板
评论
0/150
提交评论