基于VHDL的数字秒表设计.docx

上传人:b****7 文档编号:9455326 上传时间:2023-02-04 格式:DOCX 页数:15 大小:222.41KB
下载 相关 举报
基于VHDL的数字秒表设计.docx_第1页
第1页 / 共15页
基于VHDL的数字秒表设计.docx_第2页
第2页 / 共15页
基于VHDL的数字秒表设计.docx_第3页
第3页 / 共15页
基于VHDL的数字秒表设计.docx_第4页
第4页 / 共15页
基于VHDL的数字秒表设计.docx_第5页
第5页 / 共15页
点击查看更多>>
下载资源
资源描述

基于VHDL的数字秒表设计.docx

《基于VHDL的数字秒表设计.docx》由会员分享,可在线阅读,更多相关《基于VHDL的数字秒表设计.docx(15页珍藏版)》请在冰豆网上搜索。

基于VHDL的数字秒表设计.docx

基于VHDL的数字秒表设计

河南农业大学

课程设计报告

 

设计题目:

基于VHDL的数字秒表的设计

学院:

专业:

电子信息科学与技术

班级:

学号:

姓名:

电子邮件:

日期:

成绩:

指导教师:

…………………………装………………………………订………………………………线………………………………………………………………

河南农业大学

理学院

课程设计任务书

 

学生姓名指导教师

学生学号专业班级

题目基于VHDL的数字秒表设计

任务与要求

设计一个数字秒表,主要由显示译码器、分频器、十进制计数器、六进制计数器组成。

在整个秒表中最关键的是如何获得一个精确的100HZ计时脉冲,除此之外,整个秒表还需有一个启动信号和一个归零信号,以便秒表能随意停止及启动。

秒表共有6个输出显示,分别为百分之一秒、十分之一秒、秒、十秒、分、十分,所以共有6个计数器与之相对应,6个计数器的输出全都为BCD码输出,这样便于和显示译码器的连接。

合作人:

分工方案:

开始日期2012年12月3日完成日期2012年月9日

课程设计所在地点

一、数字闹钟设计要求:

1.四个十进制计数器:

分别用来对百分之一秒、十分之一秒、秒和分进行计数;

2.两个六进制计数器:

用来分别对十秒和十分进行计数;

3.分频器;用来产生100Hz计时脉冲;

4.显示译码器:

完成对显示译码的控制。

3、能够完成清零、启动、保持(可以使用键盘或拨码开关置数)功能。

4、时、分、秒、百分之一秒显示准确。

二、实验目的:

1、初步了解可编程逻辑器件(PLD)的基本原理;

2、熟练掌握MAX+PlusⅡ图形编辑器、文本编辑器等不同的输入设计方法,掌握EDA的自顶向下(ToptoDown)的模块化设计思想;

3、了解VHDL语言的语法、句法及结构,能看懂VHDl语言编写的程序,并能熟练运用MAX+PlusⅡ软件对各个程序模块进行波形仿真;

4、熟悉顶层电路的原理图输入法,能应用EDA设计思想进行较复杂系统的分析和设计。

三、设计方案:

按照EDA自顶向下的设计理念,该数字秒表可以分为分频器模块、计数器模块、数据选择和数码管选择模块模块、数码管驱动模块,其顶层电路如下图所示。

四、各个模块的功能:

1、分频器模块:

将2.5MHz的时钟信号转换成100Hz的计时脉冲,使秒表正常工作;

2、计数器模块:

这是本秒表设计的基本功能,对时间进行计数并在显示屏显示当前时间,这个模块中,分别有十进制计数器和六进制计数器,共用四个十进制,分别表示数字秒表的百分之一秒、十分之一秒、秒和分,两个六进制,分别表示数字秒表的十秒和十分;

3、数据选择和数码管选择模块:

通过每个计数器输入的dain信号对数码管进行选择,

4、数码管驱动模块:

通过对输入的信号进行编码,完成对7段数码管的驱动,使数码管显示出对应的数字;

五、系统的各组成部分的原理框图及功能

1、分频器的原理框图:

2、六进制计数器的原理框图:

3、十进制计数器的原理框图:

4、选择模块的原理框图:

5、译码显示电路的原理框图:

 

其中各部分功能如下:

1、分频器将2.5MHz脉冲变成100Hz。

2、六进制计数器能够实现6进制循环计数。

3、十进制计数器能够实现10进制循环计数。

4、选择模块通过每个计数器输入的dain信号对数码管进行选择

5、译码显示电路通过对输入的信号进行编码,完成对7段数码管的驱动,使数码管显示出对应的数字。

六、系统的主要模块VHDL源程序:

1、分频器源程序clkgen:

libraryieee;

useieee.std_logic_1164.all;

entityclkgenis

port(clk:

instd_logic;

newclk:

outstd_logic);

endentityclkgen;

architectureartofclkgenis

signalcnter:

integerrange0to10#24999#;

begin

process(clk)is

begin

ifclk'eventandclk='1'then

ifcnter=10#24999#thencnter<=0;

elsecnter<=cnter+1;

endif;

endif;

endprocess;

process(cnter)is

begin

ifcnter=10#24999#thennewclk<='1';

elsenewclk<='0';

endif;

endprocess;

endarchitectureart;

2、六进制计数器源程序count6:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitycount6is

port(clk,clr,start:

instd_logic;

daout:

outstd_logic_vector(3downto0);

cout:

bufferstd_logic);

endcount6;

architecturebehaveofcount6is

signaltemp:

std_logic_vector(3downto0);

begin

process(clk,clr)

begin

ifclr='1'thentemp<="0000";

cout<='0';

elsifclk'eventandclk='1'then

ifstart='1'then

iftemp="0101"thentemp<="0000";

cout<='1';

elsetemp<=temp+1;cout<='0';

endif;

elsifstart='0'thentemp<=temp;cout<=cout;

endif;

endif;

endprocess;

daout<=temp;

endbehave;

3、十进制计数器源程序count10:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitycount10is

port(clk,clr,start:

instd_logic;

daout:

outstd_logic_vector(3downto0);

cout:

bufferstd_logic);

endcount10;

architecturebehaveofcount10is

signaltemp:

std_logic_vector(3downto0);

begin

process(clk,clr)

begin

ifclr='1'thentemp<="0000";

cout<='0';

elsifclk'eventandclk='1'then

ifstart='1'then

iftemp="1001"thentemp<="0000";

cout<='1';

elsetemp<=temp+1;cout<='0';

endif;

elsifstart='0'thentemp<=temp;cout<=cout;

endif;

endif;

endprocess;

daout<=temp;

endbehave;

4、数据选择和数码管选择模块模块源程序seltime:

libraryieee;

useieee.std_logic_1164.all;

USEieee.std_logic_UNSIGNED.all;

entityseltimeis

  port(clr,clk:

instd_logic;

       dain0,dain1,dain2,dain3,dain4,dain5:

instd_logic_vector(3downto0);

       sel:

outstd_logic_vector(2downto0);

       daout:

outstd_logic_vector(3downto0));

endseltime;

architectureaofseltimeis

  signaltemp:

integerrange0to5;

begin

   process(clk)

      begin

        if(clr='1')then

              daout<="0000";

              sel<="000";

              temp<=0;

        elsif(clk='1'andclk'event)then  

             iftemp=5thentemp<=0;

             elsetemp<=temp+1;

             endif;          

               casetempis

                   when0=>sel<="000";daout<=dain0;

                   when1=>sel<="001";daout<=dain1;

                   when2=>sel<="010";daout<=dain2;

                   when3=>sel<="011";daout<=dain3;

                   when4=>sel<="100";daout<=dain4;

                   when5=>sel<="101";daout<=dain5;

               endcase;

        endif;

   endprocess;

enda;

5、数码管驱动源程序ym:

libraryieee;

useieee.std_logic_1164.all;

entityymis

port(num:

instd_logic_vector(3downto0);

led:

outstd_logic_vector(6downto0));

endym;

architectureaofymis

begin

process(num)

begin

casenumis

when"0000"=>led<="0111111";

when"0001"=>led<="0000110";

when"0010"=>led<="1011011";

when"0011"=>led<="1001111";

when"0100"=>led<="1100110";

when"0101"=>led<="1101101";

when"0110"=>led<="1111101";

when"0111"=>led<="0100111";

when"1000"=>led<="1111111";

when"1001"=>led<="1101111";

whenothers=>led<="0000000";

endcase;

endprocess;

enda;

6、数字秒表的源程序chengpin

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_arith.all;

useieee.std_logic_unsigned.all;

entitychengpinis

port(

stop,clk,clk2,start:

instd_logic;

sel:

outstd_logic_vector(2downto0);

a,b,c,d,e,f,g:

outstd_logic;

);

endchengpin;

architecturecofchengpinis

componentcount10

port(

clk,clr,start:

instd_logic;

daout:

outstd_logic_vector(3downto0);

cout:

outstd_logic);

endcomponent;

componentcount6

port(

clk,clr,start:

instd_logic;

daout:

outstd_logic_vector(3downto0);

cout:

outstd_logic);

endcomponent;

componentseltime

port(

clr,clk:

instd_logic;

dain1:

instd_logic_vector(3downto0);

dain2:

instd_logic_vector(3downto0);

dain3:

instd_logic_vector(3downto0);

dain4:

instd_logic_vector(3downto0);

dain5:

instd_logic_vector(3downto0);

dain6:

instd_logic_vector(3downto0);

sel:

outstd_logic_vector(2downto0);

daout:

outstd_logic_vector(3downto0));

endcomponent;

componentclkgen

port(clk:

instd_logic;

newclk:

outstd_logic);

endcomponent;

componentym

port(num:

instd_logic_vector(3downto0);

led:

outstd_logic_vector(6downto0));

endcomponent;

componentcfq

port(

clk,d:

instd_logic;

y:

outstd_logic);

endcfq;

begin

signalcount_cout:

std_logic_vector(6downto0);

signaldaout1,daout2,daout3,daout4,daout5,daout6,daout7:

std_logic_vector(3downto0);

signalledout:

std_logic_vector(6downto0);

begin

a=>ledout(0);b=>ledout

(1);c=>ledout

(2);d=>ledout(3);e=>ledout(4);f=>ledout(5);g=>ledout(6);

u1:

count10portmap(clk,stop,start,daout1,count_cout(0));

u2:

count10portmap(count_cout(0),stop,start,daout2,count_cout

(1));

u3:

count10portmap(count_cout

(1),stop,start,daout3,count_cout

(2));

u4:

count6portmap(count_cout

(2),stop,start,daout4,count_cout(3));

u5:

count10portmap(count_cout(3),stop,start,daout5,count_cout(4));

u6:

count6portmap(count_cout(4),stop,start,daout6,count_cout(5));

u7:

cfqportmap(clk2,count_cout(5),count_cout(6));

u7:

seltimeportmap(stop,clk,daout1,daout2,daout3,daout4,daout5,daout6,sel,daout7);

u8:

ymportmap(daout7,ledout);

u9:

clkgenportmap(clk,newclk);

endc;

六、程序功能仿真图:

1、count6仿真图如下示:

 

2、count10仿真图如下示:

 

3、seltime仿真图如下示:

4、ym仿真图如下示:

七、心得和体会

通过这次课程设计使我懂得了理论与实际相结合是很重要的,只有理论知识是远远不够的,只有把所学的理论知识与实践相结合起来,从理论中得出结论,才能真正为社会服务,从而提高自己的实际动手能力和独立思考的能力。

总的来说,这次设计的数字秒表还是比较成功的,虽然在实际的过程中曾经遇到了大量的问题,但是经过自己的努力,都给妥善解决了,这样的积累对于现在大学生来说是十分宝贵的。

希望以后能有更多的动手实践机会,在硬件中发现自己的不足,弥补自己的不足,最终成为一个合格的大学生。

最后,特别感谢老师对我的帮助。

八、参考文献

[1]谭会生、张昌凡.EDA技术及应用.西安电子科技大学出版社,2006

[2]东方人华.MAX+PLUS

入门与提高.清华大学出版社,2004

EDA设计实习成绩评定表

评定项目

内容

满分

评分

总分

学习态度

学习认真,态度端正,遵守纪律

10

答疑和设计情况

认真查阅资料,勤学好问,提出的问题有一定的深度,分析解决问题的能力教强。

40

说明书质量

设计方案正确、表达清楚;设计思路、实验(论证)方法科学合理;达到课程设计任务书规定的要求;图、表、文字表达准确规范,上交及时。

40

回答问题情况

回答问题准确,基本概念清楚,有理有据,有一定深度。

10

总成绩

采用五级分制或百分制。

五级分制:

优、良、中、及格、不及格

指导教师评语:

 

签名:

年月日

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 求职职场 > 简历

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1