基于VHDL的数字时钟论文_第1页
基于VHDL的数字时钟论文_第2页
基于VHDL的数字时钟论文_第3页
基于VHDL的数字时钟论文_第4页
基于VHDL的数字时钟论文_第5页
已阅读5页,还剩13页未读 继续免费阅读

下载本文档

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

文档简介

1、摘要 随着基于CPLD的EDA技术的发展和应用领域的扩大与深入,EDA技术在电子信息、通信、自动控制用计算机等领域的重要性日益突出。作为一个学电子信息专业的学生,我们必须不断地了解更多的新产品信息,这就更加要求我们对EDA有个全面的认识。本程序设计的是基于VHDL的数字时钟。采用EDA作为开发工具,VHDL语言为硬件描述语言,QUARTUS II作为程序运行平台,所开发的程序通过调试运行、波形仿真验证,初步实现了设计目标。本程序使用的硬件描述语言VHDL,可以大大降低了硬件数字系统设计的入门级别,让人感觉就是C语言的亲近。ABSTRACTWith the EDA-based CPLD deve

2、lopment and application of technology to expand the field of depth, EDA technology in electronic information, communications, automatic control with the importance of computer and other fields have become increasingly prominent. As a professional electronics and information science students, we must

3、 continue to learn more about the new product information, which requires us to more EDA has a comprehensive understanding of。The program design is a simple flower design。The use of EDA as a development tool, VHDL language for hardware description language, MAX + PLUS II program runs as a platform f

4、or the development of procedures by running through the debugging, waveform simulation, the initial realization of the design goals。This procedure used in hardware description language VHDL, the hardware can significantly reduce the number of entry-level system design, give people the impression tha

5、t a close relative of C language. 目 录第一章概论- 1 -1.1课程背景:- 1 -1.2课程目标- 2 -第二章电子钟的设计要求和工作原理- 2 -2.1设计要求- 2 -2.2 系统设计方案概述及工作原理- 2 -2.3 数字电子钟设计源程序- 2 -第三章开发工具简介- 3 -3. 1EDA技术- 3 -3. 2硬件描述语言VHDL- 3 -3. 3 VHDL的设计流程- 4 -第四章时钟设计模块- 6 -4.1时钟分频模块- 6 -4.2 计时模块- 6 -4.3显示模块- 6 -4.3.1 计时位选择电路- 9 -4.3.2 七段显示译码电路- 1

6、1 -第五章 波形仿真- 12 -第六章 本次课程设计的心得体会- 14 -致谢- 15 -参考文献- 16 - 引言 数字钟是一种用数字电路技术实现时、分、秒计时的装置,与机械式时钟相比具有更高的准确性和直观性,且无机械装置,具有更更长的使用寿命,因此得到了广泛的使用。数字钟从原理上讲是一种典型的数字电路,其中包括了组合逻辑电路和时序电路。因此,我们此次设计与制做数字钟就是为了了解数字钟的原理,从而学会制作数字钟.而且通过数字钟的制作进一步的了解各种在制作中用到的中小规模集成电路的作用及实用方法.且由于数字钟包括组合逻辑电路和时叙电路.通过它可以进一步学习与掌握各种组合逻辑电路与时序电路的原

7、理与使用方法. 第一章概论 1 .1课程背景 FPGA系统设计初级班培训课程主要帮助学员尽快掌握 CPLD/FPGA 的开发流程和设计方法,以工程实践为例,循序渐进的学习FPGA的集成开发环境,开发流程以及硬件电路设计等知识。每次课程都配有相关实战训练,每个实战训练题目都可以在红色飓风II代的FPGA硬件平台上进行下载验证。通过实战,学员可以更好的理解消化课堂知识,工程实践水平会得到迅速提高。 1.2 课程目标 迅速掌握和使用CPLD/FPGA数字系统开发工具、开发流程,能够独立进行初步的FPGA系统设计。经过培训,学员可以掌握HDL语言的初步开发能力,并且解决FPGA产品开发过程中的常见问题

8、,掌握基于FPGA的嵌入式系统(NIOSII)的设计和调试方法。 第2章开发工具简介 3. 1EDA技术EDA是电子设计自动化(Electronic Design Automation)缩写,是90年代初从CAD(计算机辅助设计)、CAM(计算机辅助制造)、CAT(计算机辅助测试)和CAE(计算机辅助工程)的概念发展而来的。EDA技术是以计算机为工具,根据硬件描述语言HDL( Hardware Description language)完成的设计文件,自动地完成逻辑编译、化简、分割、综合及优化、布局布线、仿真以及对于特定目标芯片的适配编译和编程下载等工作。典型的EDA工具中必须包含两个特殊的软

9、件包,即综合器和适配器。综合器的功能就是将设计者在EDA平台上完成的针对某个系统项目的HDL、原理图或状态图形描述,针对给定的硬件系统组件,进行编译、优化、转换和综合,最终获得我们欲实现功能的描述文件。综合器在工作前,必须给定所要实现的硬件结构参数,它的功能就是将软件描述与给定的硬件结构用一定的方式联系起来。也就是说,综合器是软件描述与硬件实现的一座桥梁。综合过程就是将电路的高级语言描述转换低级的、可与目标器件FPGA/CPLD相映射的网表文件。适配器的功能是将由综合器产生的王表文件配置与指定的目标器件中,产生最终的下载文件,如JED文件。适配所选定的目标器件(FPGA/CPLD芯片)必须属于

10、在综合器中已指定的目标器件系列。硬件描述语言HDL是相对于一般的计算机软件语言,如:C、PASCAL而言的。HDL语言使用与设计硬件电子系统的计算机语言,它能描述电子系统的逻辑功能、电路结构和连接方式。设计者可利用HDL程序来描述所希望的电路系统,规定器件结构特征和电路的行为方式;然后利用综合器和适配器将此程序编程能控制FPGA和CPLD内部结构,并实现相应逻辑功能的的门级或更底层的结构网表文件或下载文件。目前,就FPGA/CPLD开发来说,比较常用和流行的HDL主要有ABEL-HDL、AHDL和VHDL。3. 2硬件描述语言VHDLVHDL的英文全名是Very-High-Speed Inte

11、grated Circuit Hardware Description Language,诞生于1982年。1987年底,VHDL被IEEE和美国国防部确认为标准硬件描述语言 。自IEEE公布了VHDL的标准版本,IEEE-1076(简称87版)之后,各EDA公司相继推出了自己的VHDL设计环境,或宣布自己的设计工具可以和VHDL接口。此后VHDL在电子设计领域得到了广泛的接受,并逐步取代了原有的非标准的硬件描述语言。1993年,IEEE对VHDL进行了修订,从更高的抽象层次和系统描述能力上扩展VHDL的内容,公布了新版本的VHDL,即IEEE标准的1076-1993版本,(简称93版)。现在

12、,VHDL和Verilog作为IEEE的工业标准硬件描述语言,又得到众多EDA公司的支持,在电子工程领域,已成为事实上的通用硬件描述语言。有专家认为,在新的世纪中,VHDL于Verilog语言将承担起大部分的数字系统设计任务。VHDL主要用于描述数字系统的结构,行为,功能和接口。除了含有许多具有硬件特征的语句外,VHDL的语言形式和描述风格与句法是十分类似于一般的计算机高级语言。VHDL的程序结构特点是将一项工程设计,或称设计实体(可以是一个元件,一个电路模块或一个系统)分成外部(或称可是部分,及端口)和内部(或称不可视部分),既涉及实体的内部功能和算法完成部分。在对一个设计实体定义了外部界面

13、后,一旦其内部开发完成后,其他的设计就可以直接调用这个实体。这种将设计实体分成内外部分的概念是VHDL系统设计的基本点。应用VHDL进行工程设计的优点是多方面的。(1) 与其他的硬件描述语言相比,VHDL具有更强的行为描述能力,从而决定了他成为系统设计领域最佳的硬件描述语言。强大的行为描述能力是避开具体的器件结构,从逻辑行为上描述和设计大规模电子系统的重要保证。(2) VHDL丰富的仿真语句和库函数,使得在任何大系统的设计早期就能查验设计系统的功能可行性,随时可对设计进行仿真模拟。 (3) VHDL语句的行为描述能力和程序结构决定了他具有支持大规模设计的分解和已有设计的再利用功能。符合市场需求

14、的大规模系统高效,高速的完成必须有多人甚至多个代发组共同并行工作才能实现。(4)对于用VHDL完成的一个确定的设计,可以利用EDA工具进行逻辑综合和优化,并自动的把VHDL描述设计转变成门级网表。(4) VHDL对设计的描述具有相对独立性,设计者可以不懂硬件的结构,也不必管理最终设计实现的目标器件是什么,而进行独立的设计。3. 3 VHDL的设计流程 (1) 设计输入根据电路设计所提出的要求,将程序输入到VHDL编辑器中去编辑。 (2) 功能级模拟用VHDL,模拟器对编辑后的程序进行模拟,如果达不到设计要求,则可以重新修改程序,直到通过功能模拟。 (3) 逻辑综合与优化 将通过功能模拟的程序放

15、到VHDL编译器中,进行逻辑综合与优化。 (4) 门级模拟对电路用VHDL。仿真器仿真。可对门级电路的延时、定时状态、驱动能力等进行仿真。如不符合要求,可重复步骤(3),再门级模拟,直到符合要求止。 (5) 版图生成 用相应的软件处理后,就可以拿去制版。第三章 数字电子钟的工作原理2.1 系统设计方案顶层原理图2.2 秒和分钟计数器-功 能:60进制计数器-接 口:clk -时钟输入- qout1-个位BCD输出- qout2-十位BCD输出- carry-进位信号输出-library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_un

16、signed.all;use ieee.std_logic_arith.all;entity fen60 is port(clk : in std_logic; rst : in std_logic; qout1 : out std_logic_vector(3 downto 0); qout2 : out std_logic_vector(3 downto 0); carry : out std_logic);end fen60;architecture behave of fen60 issignal tem1:std_logic_vector(3 downto 0);signal tem

17、2:std_logic_vector(3 downto 0);begin process(clk,rst) begin if(rst='0')then tem1<="0000" tem2<="0000" elsif clk'event and clk='1' then if tem1="1001" then tem1<="0000" if tem2="0101" then tem2<="0000" carry&l

18、t;='1' else tem2<=tem2+1; carry<='0' end if; else tem1<=tem1+1; end if; end if; qout1<=tem1; qout2<=tem2; end process;end behave; 2.3 小时计数器-实体名:fen24-功 能:24进制计数器-接 口:clk -时钟输入- qout1-个位BCD输出- qout2-十位BCD输出- carry-进位信号输出-library ieee;use ieee.std_logic_1164.all;use ieee

19、.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity fen24 is port(clk : in std_logic; rst : in std_logic; qout1 : out std_logic_vector(3 downto 0); qout2 : out std_logic_vector(3 downto 0); carry : out std_logic);end fen24;architecture behave of fen24 issignal tem1:std_logic_vector(3 downto

20、0);signal tem2:std_logic_vector(3 downto 0);begin process(clk,rst) begin if(rst='0')then tem1<="0010" tem2<="0001" elsif clk'event and clk='1' then if (tem2="0010" and tem1="0011") then tem1<="0000" tem2<="0000&qu

21、ot; carry<='1' else carry<='0' if tem1="1001" then tem1<="0000" if tem2="1001" then tem2<="0000" else tem2<=tem2+1; end if; else tem1<=tem1+1; end if; end if; end if; qout1<=tem1; qout2<=tem2; end process;end behave; 2.4

22、 六选一的控制电路-实体名:sel-功 能:实现六个数码显示管扫描显示-接 口:clk -时钟输入- qin1-第一个数码显示管要显示内容输入- qin2-第二个数码显示管要显示内容输入- qin3-第三个数码显示管要显示内容输入- qin4-第四个数码显示管要显示内容输入- qin5-第五个数码显示管要显示内容输入- qin6-第六个数码显示管要显示内容输入- sel -位选信号输出-library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;ent

23、ity sel isport(clk : in std_logic; rst : in std_logic; qin1 : in std_logic_vector(3 downto 0); qin2 : in std_logic_vector(3 downto 0); qin3 : in std_logic_vector(3 downto 0); qin4 : in std_logic_vector(3 downto 0); qin5 : in std_logic_vector(3 downto 0); qin6 : in std_logic_vector(3 downto 0); qout

24、: out std_logic_vector(3 downto 0); sel : out std_logic_vector(7 downto 0);end sel;architecture behave of sel isbegin process(clk,rst) variable cnt:integer range 0 to 7; begin if(rst='0')then cnt:=0; sel<="11111110" qout<="0000" elsif clk'event and clk='1

25、9; then if cnt=7 then cnt:=0; else cnt:=cnt+1; end if; case cnt is when 0=>qout<=qin1; sel <="11111110" when 1=>qout<=qin2; sel <="11111101" when 2=>qout<="1111" sel <="11111011" when 3=>qout<=qin3; sel <="11110111"

26、; when 4=>qout<=qin4; sel <="11101111" when 5=>qout<="1111" sel <="11011111" when 6=>qout<=qin5; sel <="10111111" when 7=>qout<=qin6; sel <="01111111" when others=>qout<="0000" sel <="111111

27、11" end case; end if; end process;end behave; 2.5 7段译码显示-实体名:decode47-功 能:实现数码显示管的编码显示-接 口:qin -BCD码输入- qout-七段码输出-library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity decode47 isport(qin : in std_logic_vector(3 downto 0); qout : out std_l

28、ogic_vector(7 downto 0);end decode47;architecture behave of decode47 isbegin with qin select qout<="00000011" when "0000", -显示0 "10011111" when "0001", -显示1 "00100101" when "0010", -显示2 "00001101" when "0011", -显示3 &q

29、uot;10011001" when "0100", -显示4 "01001001" when "0101", -显示5 "01000001" when "0110", -显示6 "00011111" when "0111", -显示7 "00000001" when "1000", -显示8 "00011001" when "1001", -显示9 "00

30、010001" when "1010", -显示A "11000001" when "1011", -显示B "01100011" when "1100", -显示C "10000101" when "1101", -显示D "01100001" when "1110", -显示E "11111101" when "1111", -显示- "00000011

31、" when others;end behave;2.6 1HZ的秒信号-实体名:fen1-功 能:对输入时钟进行40000000分频,得到1Hz信号-接 口:clk -时钟输入- qout-秒输出信号-library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity fen1 isport(clk:in std_logic; rst:in std_logic; qout:out std_logic);end fen1;archite

32、cture behave of fen1 isconstant counter_len:integer:=39999999;begin process(clk,rst) variable cnt:integer range 0 to counter_len; begin if(rst='0')then cnt:=0; elsif clk'event and clk='1' then if cnt=counter_len then cnt:=0; else cnt:=cnt+1; end if; case cnt is when 0 to counter_

33、len/2=>qout<='0' when others =>qout<='1' end case; end if; end process;end behave;2.7 6个数码管的动态扫描时钟产生100HZ的时钟信号,控制6个数码管的同时显示-实体名:fen100-功 能:对输入时钟进行24000分频,得到100Hz信号,- 作为数码显示管位扫描信号-接 口:clk -时钟输入- qout-100Hz输出信号-library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity fen100 isport(clk:in std_logic; rst:in std_logic; qout:out std_logic);end fen100;architecture behave of fen100 isconstant counter_len:integer:=23999;begin process(clk,rst) variable cnt:integer range 0 to coun

温馨提示

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

评论

0/150

提交评论