版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、河南机电高等专科学校可编程逻辑器件原理与应用课程设计报告数字秒表设计专业班级: 医电131 学 号: 130411116 姓 名: 徐长伟 时 间: 2015年6月 成 绩: 数字秒表设计摘要:本次设计的目的就是在掌握EDA实验开发系统的初步使用基础上,了解EDA技术,对计算机系统中时钟控制系统进一步了解,掌握状态机工作原理,同时了解计算机时钟脉冲是怎么产生和工作的。在掌握所学的计算机组成与结构课程理论知识时,通过对数字秒表的设计,进行理论与实际的结合,提高与计算机有关设计能力,提高分析、解决计算机技术实际问题的能力。通过课程设计深入理解计算机结构与控制实现的技术,达到课程设计的目标。关键词:
2、FPGA;数字秒表;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
5、所示。图表 3-1本次的设计仿真选用以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 ispor
9、t(clk,clrm,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 clk'event and clk='1'then if
10、stop='0'thenif cnt0="1001" thenco<='1'cnt0:="0000"elsif cnt0<"1001" 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
11、;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_vector(3 downto 0);beginif clr='1' thencnt1:="0000"cnt0:="0000"elsif clk'
12、;event and clk='1' thenif cnt1="0101" and cnt0="1000" thenco<='1'cnt0:="1001"elsif cnt0<"1001" thencnt0:=cnt0+1;co<='0'elsecnt0:="0000"if cnt1<"0101" thencnt1:=cnt1+1;elsecnt1:="0000"co<='
13、;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 isbe
14、ginprocess(clk)variable cnt1,cnt0:std_logic_vector(3 downto 0);beginif clr='1' thencnt1:="0000"cnt0:="0000"elsif clk'event and clk='1' thenif en='1' thenif cnt1="0101" and cnt0="1000" thenco<='1'cnt0:="1001"elsi
15、f cnt0<"1001" thencnt0:=cnt0+1;elsecnt0:="0000"if cnt1<"0101" 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_logic_1164.all;entity nz isport(clk:i
16、n 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 clk'event and clk='1' then if (h1=time(23 downto 20) and h0=time(19 downto 16) and m1=time(15 downto
17、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_unsigned.all;entity time2 isport(clk,clr,stop,en,led:in std_logic; time:
18、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_vector(3 downto 0); co:out std_logic);end component;component SECOND port(cl
19、k,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 HOUR port(clk,en,clr,led:in std_logic; h1,h0:out std_logic_vector(3 down
20、to 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:std_logic;signal a1,a0,b1,b0,d1,d0,dm0:std_logic_vector(3 downto 0);begi
21、n hou1<=a1;hou0<=a0;m1<=b1;m0<=b0;s1<=d1;s0<=d0;sm0<=dm0; u1:MINSECONDb port map(clk=>clk,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,min
22、0=>b0,en=>en,co=>c2); u4:HOUR port map(clk=>c2,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_un
23、signed.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 isbeginprocess(clk,clrm)variable cnt0:std_logic_vector(3 downto 0); beginif clrm='1' thencnt0:="0000"elsif clk'
24、;event and clk='1'then if stop='0'thenif cnt0="1001" thenco<='1'cnt0:="0000"elsif cnt0<"1001" 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.al
25、l;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_vector(3 downto 0);beginif clr='1' thencnt1:="0000"cn
26、t0:="0000"elsif clk'event and clk='1' thenif cnt1="0101" and cnt0="1000" thenco<='1'cnt0:="1001"elsif cnt0<"1001" thencnt0:=cnt0+1;co<='0'elsecnt0:="0000"if cnt1<"0101" thencnt1:=cnt1+1;else
27、cnt1:="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 isport(clk,en,clr:in std_logic; min1,min0:out std_logic_vector(3 downto 0); co:out std_logic);end MINUTE
28、;architecture MIN of MINUTE isbeginprocess(clk)variable cnt1,cnt0:std_logic_vector(3 downto 0);beginif clr='1' thencnt1:="0000"cnt0:="0000"elsif clk'event and clk='1' thenif en='1' thenif cnt1="0101" and cnt0="1000" thenco<='
29、1'cnt0:="1001"elsif cnt0<"1001" thencnt0:=cnt0+1;elsecnt0:="0000"if cnt1<"0101" 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_logic_1
30、164.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&
31、quot;elsif clk'event and clk='1' thenif en='1' thenif led='1' thenif cnt1="0010" and cnt0="0011" thencnt1:="0000"cnt0:="0000"elsif cnt0<"1001" 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 cnt0<&q
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 感恩节幼儿讲话稿15篇
- 微观世界纪录片观后感
- 解决方案企业突发环境事件应急预案管理d
- 2016河北道法试卷+答案+解析
- 初级会计实务-2021年5月16日下午初级会计职称考试《初级会计实务》真题
- 初级会计经济法基础-初级会计《经济法基础》模拟试卷33
- 2024年中国智慧工厂行业市场集中度、竞争格局及投融资动态分析报告(智研咨询)
- 二零二五年度企业应收账款债权转让及资金周转协议4篇
- 二零二五年度高端个人咨询服务合同2篇
- 基于深度学习的室外火灾烟雾目标检测
- 福建省泉州市晋江市2024-2025学年七年级上学期期末生物学试题(含答案)
- 2025年春新人教版物理八年级下册课件 第十章 浮力 第4节 跨学科实践:制作微型密度计
- 2024-2025学年人教版数学六年级上册 期末综合试卷(含答案)
- 收养能力评分表
- 三年级上册体育课教案
- 山东省桓台第一中学2024-2025学年高一上学期期中考试物理试卷(拓展部)(无答案)
- 中华人民共和国保守国家秘密法实施条例培训课件
- 管道坡口技术培训
- 2024年全国统一高考英语试卷(新课标Ⅰ卷)含答案
- 2024年认证行业法律法规及认证基础知识 CCAA年度确认 试题与答案
- 皮肤储存新技术及临床应用
评论
0/150
提交评论