EDA课程设计基于VHDL语言的数字时钟设计.docx

上传人:b****8 文档编号:9324167 上传时间:2023-02-04 格式:DOCX 页数:19 大小:626.28KB
下载 相关 举报
EDA课程设计基于VHDL语言的数字时钟设计.docx_第1页
第1页 / 共19页
EDA课程设计基于VHDL语言的数字时钟设计.docx_第2页
第2页 / 共19页
EDA课程设计基于VHDL语言的数字时钟设计.docx_第3页
第3页 / 共19页
EDA课程设计基于VHDL语言的数字时钟设计.docx_第4页
第4页 / 共19页
EDA课程设计基于VHDL语言的数字时钟设计.docx_第5页
第5页 / 共19页
点击查看更多>>
下载资源
资源描述

EDA课程设计基于VHDL语言的数字时钟设计.docx

《EDA课程设计基于VHDL语言的数字时钟设计.docx》由会员分享,可在线阅读,更多相关《EDA课程设计基于VHDL语言的数字时钟设计.docx(19页珍藏版)》请在冰豆网上搜索。

EDA课程设计基于VHDL语言的数字时钟设计.docx

EDA课程设计基于VHDL语言的数字时钟设计

一、设计要求

1、稳定的显示时、分、秒。

2、当电路发生走时误差时,要求电路有校时功能。

3、电路有整点报时功能。

报时声响为四低一高,最后一响高音正好为整点。

二、设计原理及框图

1、设计原理

系统框图由六个模块组成,分别为:

秒、分、时计数模块,整点报时模块,LED动态显示扫描模块,调时控制模块组成。

其工作原理是:

基准脉冲输入信号同时加到秒、分、时、分隔符的脉冲输入端,采用并行计数的方式,秒的进位接到分的使能端上,秒的使能借到分隔符的使能上,分得接到时的使能端上,完成秒、分、时和分隔符的循环计数。

整点报时是根据分的A、B输出同时为0时,整点报时模块输出高电平控制报时。

LED显示扫描模块根据输入的扫描信号CKDSP轮流选通秒、分、时、分隔符的8位八段数码管,LED显示译码器完成计数器输出的BCD的译码。

2、结构框图

三、设计过程

1、模块化设计

(1)秒计时模块

秒计时模块由一个60位计数器为主体构成,其输入输出端口组成为:

Clk:

计时时钟信号

Reset:

异步清零信号

Setmin:

分钟设置信号

Enmin:

使能输出信号

Daout[6:

0]:

BCD码输出

(2)分计时模块

分计时模块由一个60位计数器为主体构成,其输入输出端口组成为:

Clk、clk1:

计时时钟信号

Reset:

异步清零信号

Sethour:

小时设置信号

Enmin:

使能输出信号

Daout[6:

0]:

BCD码输出

(3)时计时模块

时计时模块由24位计数器为主体构成,其输入输出端口组成为:

Clk:

计时时钟信号

Reset:

异步清零信号

Daout[6:

0]:

BCD码输出

(4)显示模块

系统时间输出由六个七段数码管显示。

显示的数据是各计时模块给出的

BCD码。

(5)调时控制模块

该模块主要用于调节时、分显示,用于“对表”。

(6)整点报时模块

在时钟整点的时候产生扬声器驱动信号。

由时钟计时模块中分钟的进行信号进行控制。

当contr_en为高电平时,将输入信号clk送到输出端speak用于驱动扬声器,同时在clk的控制下,输出端lamp[2..0]进行循环移位。

输出控制模块有扬声器控制器子模块组成。

2、顶层文件生成

前面已经完成了电子时钟电路的各个组成部分的设计,下面把这些组成部分组装起来,形成

完整的总体设计。

该电子时钟的命名为clock,其外部端口如右图所示。

各个输入/输出端口的作用如下:

(1)clk为外部时钟信号,其频率为1Hz,reset为异步清零信号.

(2)sethour和setmin分别为调时调分脉冲输入信号,当en_set为高电平时,

每来一个sethour脉冲或setmin脉冲,时、分输出将分别加1;

(3)second[6...0]为秒的个位和十位BCD码输出,min[6…0]为分钟的个位和十位BCD码输出,hour[6...0]为小时的个位和十位BCD码输出,它们最终中用来驱动七段数码管,lamp[2...0]为花样显示输出信号,speak为整点报时扬声器驱动信号

四、仿真调试过程

1、各模块时序仿真图

(1)秒计数器仿真图

(2)分计数器仿真图

(3)时计数器仿真图

(4)整点报时仿真图

(5)调时调分仿真图

(6)LED显示译码仿真图

2、仿真过程中遇到的问题

(1)由于距离学习EDA技术课程的时间较长,遗忘了部分课程内容,对仿真软件不熟悉造成多次仿真失败。

就此问题我认真复习了所学的EDA相关课程,按照课本上介绍的步骤重新进行了仿真,问题得以解决。

(2)因为仿真过程中对各部分时序波形应采取什么样的激励波形不清楚,给仿真过程带来了较大的麻烦。

通过查阅相关资料,阅读网上一些比较成熟的论文,确定了仿真过程中的相关参数。

五、设计体会及收获

本次课程设计我做出的数字时钟能够正确的进行整点报时,显示时间,但是对于调时调分功能不能正确显示。

经过努力,简易电子时钟的设计基本上算是完成了,在整个设计中,我最大的体会就是:

对学过的知识遗忘太多。

在本次的课程设计中,我发现了很多问题,同时做起来也很难不顺手,看着简单的电路,要动手把它设计出来实非易事,主要原因对相关应用软件的不熟悉,这就要求我们在以后的学习中,应该注意复习的重要性,对学过的知识要时常复习,加深记忆,更重要的是我们要学会把从书本上学到的知识和实际电路联系起来,这不论对我们以后的学习还是就业,都会起到很大的促进和帮助。

我相信,通过这次的课程设计,在下一阶段的学习中我们会更加努力,力争把这门课学好学精。

同时通过本次课程设计,巩固了我们以前学过的专业知识,通过这次的程序设计,使我们对数字系统结构也有了更进一步的了解与认识,同时对数据库软件EDA技术,VHDL语言等系列知识都有了一定的了解与认识。

使用EDA技术开发页面的能力也有了提高,也使我们把理论与实践从正真意义上结合了起来,考验了我们的动手能力和查阅相关资料的能力,还有组织材料的能力。

通过此次实践,我们从中可以找出自己知识的不足与欠缺,以便我们在日后的学习中得以改进与提高。

经过本次设计使我们对大学四年期间所学习到的知识得以进一步实践,这将对我们走出校园,走向社会,走向工作岗位奠定坚实的基础。

附录

1、秒计数单元代码

LIBRARYieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

ENTITYsecondIS

PORT(

clk,reset,setmin:

INSTD_LOGIC;

enmin:

OUTSTD_LOGIC;

daout:

outstd_logic_vector(6downto0));

ENDentitysecond;

ARCHITECTUREfunOFsecondIS

SIGNALcount:

STD_LOGIC_VECTOR(6downto0);

SIGNALenmin_1,enmin_2:

STD_LOGIC;

BEGIN

daout<=count;

enmin_2<=(setminandclk);

enmin<=(enmin_1orenmin_2);

process(clk,reset,setmin)

begin

if(reset='0')thencount<="0000000";

elsif(clk'eventandclk='1')then

if(count(3downto0)="1001")then

if(count<16#60#)then

if(count="1011001")then

enmin_1<='1';count<="0000000";

else

count<=count+7;

endif;

else

count<="0000000";

endif;

elsif(count<16#60#)then

count<=count+1;

enmin_1<='0'after100ns;

else

endif;

endif;

endprocess;

endfun;

2、分计数单元代码

LIBRARYieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

ENTITYminuteIS

PORT(

clk,clk1,reset,sethour:

INSTD_LOGIC;

enhour:

OUTSTD_LOGIC;

daout:

outstd_logic_vector(6downto0));

ENDentityminute;

ARCHITECTUREfunOFminuteIS

SIGNALcount:

STD_LOGIC_VECTOR(6downto0);

SIGNALenhour_1,enhour_2:

STD_LOGIC;

BEGIN

daout<=count;

enhour_2<=(sethourandclk1);

enhour<=(enhour_1orenhour_2);

process(clk,reset,sethour)

begin

if(reset='0')then

count<="0000000";

elsif(clk'eventandclk='1')then

if(count(3downto0)="1001")then

if(count<16#60#)then

if(count="1011001")then

enhour_1<='1';

count<="0000000";

ELSE

count<=count+7;

endif;

else

count<="0000000";

endif;

elsif(count<16#60#)then

count<=count+1;

enhour_1<='0'after100ns;

else

count<="0000000";

endif;

endif;

endprocess;

ENDfun;

3、时计数单元代码

LIBRARYieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

ENTITYhourIS

PORT(

clk,reset:

INSTD_LOGIC;

daout:

outstd_logic_vector(5downto0));

ENDentityhour;

ARCHITECTUREfunOFhourIS

SIGNALcount:

STD_LOGIC_VECTOR(5downto0);

BEGIN

daout<=count;

process(clk,reset)

begin

if(reset='0')then

count<="000000";

elsif(clk'eventandclk='1')then

if(count(3downto0)="1001")then

if(count<=16#23#)then

count<=count+7;

else

count<="000000";

endif;

elsif(count<16#23#)then

count<=count+1;

else

count<="000000";

endif;

endif;

endprocess;

ENDfun;

4、显示单元代码

LIBRARYieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

ENTITYdeledIS

PORT(num:

INstd_logic_vector(3downto0);

led:

OUTstd_logic_vector(6downto0));

enddeled;

ARCHITECTUREfunOFdeledIS

BEGIN

led<="1111110"whennum="0000"else

"0110000"whennum="0001"else

"1101101"whennum="0010"else

"1111001"whennum="0011"else

"0110011"whennum="0100"else

"1011011"whennum="0101"else

"1011111"whennum="0110"else

"1110000"whennum="0111"else

"1111111"whennum="1000"else

"1111011"whennum="1001"else

"1110111"whennum="1010"else

"0011111"whennum="1011"else

"1001110"whennum="1100"else

"0111101"whennum="1101"else

"1001111"whennum="1110"else

"1000111"whennum="1111";

ENDfun;

5、调时控制单元代码

LIBRARYieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

useieee.std_logic_arith.all;

ENTITYseltimeIS

PORT(

clk1,reset:

INSTD_LOGIC;

sec,min:

INSTD_LOGIC_VECTOR(6downto0);

hour:

instd_logic_vector(5downto0);

daout:

OUTSTD_LOGIC_vector(3downto0);

dp:

OUTstd_LOGIC;

sel:

outstd_logic_vector(2downto0));

ENDseltime;

ARCHITECTUREfunOFseltimeIS

SIGNALcount:

STD_LOGIC_vector(2downto0);

BEGIN

sel<=count;

process(clk1,reset)

begin

if(reset='0')then

count<="000";

elsif(clk1'eventandclk1='1')then

if(count>="101")then

count<="000";

else

count<=count+1;

endif;

endif;

casecountis

when"000"=>daout<=sec(3downto0);dp<='0';

when"001"=>daout(3)<='0';daout(2downto0)<=sec(6downto4);dp<='0';

when"010"=>daout<=min(3downto0);dp<='1';

when"011"=>daout(3)<='0';daout(2downto0)<=min(6downto4);dp<='0';

when"100"=>daout<=hour(3downto0);dp<='1';

whenothers=>daout(3downto2)<="00";

daout(1downto0)<=hour(5downto4);dp<='0';

endcase;

endprocess;

endfun;

6、整点报时单元代码

LIBRARYieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

ENTITYalertIS

PORT(

clk:

INSTD_LOGIC;

dain:

INSTD_LOGIC_VECTOR(6DOWNTO0);

speak:

OUTSTD_LOGIC;

lamp:

OUTSTD_LOGIC_VECTOR(2DOWNTO0));

ENDalert;

ARCHITECTUREfunOFalertIS

signalcoun:

std_logic_vector(1downto0);

signalcount1:

std_logic_vector(1downto0);

BEGIN

speaker:

process(clk)

begin

speak<=count1

(1);

if(clk'eventandclk='1')then

if(dain="0000000")then

if(count1>="10")then

count1<="00";

else

count1<=count1+1;

endif;

endif;

endif;

endprocessspeaker;

lamper:

process(clk)

begin

if(rising_edge(clk))then

if(coun<="10")then

if(coun="00")then

lamp<="001";

elsif(coun="01")then

lamp<="010";

elsif(coun="10")then

lamp<="100";

endif;

coun<=coun+1;

else

coun<="00";

endif;

endif;

endprocesslamper;

ENDfun;

7、顶层代码

libraryieee;

useieee.std_logic_1164.all;

entityclock_topis

port(clk,reset,setmin,sethour,clkdsp:

instd_logic;

speaker:

outstd_logic;

lamp:

outstd_logic_vector(2downto0);

sel:

outstd_logic_vector(2downto0);

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

outstd_logic);

endclock_top;

architectureaofclock_topis

COMPONENTsecond

PORT(

clk,reset,setmin:

INSTD_LOGIC;

daout:

outstd_logic_vector(6downto0);

enmin:

OUTSTD_LOGIC);

ENDCOMPONENT;

COMPONENTminute

PORT(

clk,clk1,reset,sethour:

INSTD_LOGIC;

enhour:

OUTSTD_LOGIC;

daout:

outstd_logic_vector(6downto0));

ENDCOMPONENT;

COMPONENThour

PORT(

clk,reset:

INSTD_LOGIC;

daout:

outstd_logic_vector(5downto0));

ENDCOMPONENT;

COMPONENTalert

PORT(

clk:

INSTD_LOGIC;

dain:

instd_logic_vector(6downto0);

lamp:

outstd_logic_vector(2downto0);

speak:

OUTSTD_LOGIC);

ENDCOMPONENT;

COMPONENTseltime

PORT(

clk1,reset:

INSTD_LOGIC;

sec,min:

instd_logic_vector(6downto0);

hour:

instd_logic_vector(5downto0);

dp:

outstd_logic;

daout:

outstd_logic_vector(3downto0);

sel:

OUTSTD_LOGIC_vector(2downto0));

ENDCOMPONENT;

COMPONENTdeled

PORT(

num:

INSTD_LOGIC_vector(3downto0);

led:

outstd_logic_vector(6downto0));

ENDCOMPONENT;

signalenmin_re,enhour_re:

std_logic;

signalsecond_daout,minute_daout:

std_logic_vector(6downto0);

signalhour_daout:

std_logic_vector(5downto0);

signalseltime_daout:

std_logic_vector(3downto0);

signalledout:

std_logic_vector(6downto0);

begin

a<=ledout(6);b<=ledout(5);c<=ledout(4);d<=ledout(3);

e<=ledout

(2);f<=ledout

(1);g<=ledout(0);

u1:

secondportmap(reset=>reset,

clk=>clk,

setmin=>setmin,

enmin=>enmin_re,

daout=>second_daout);

u2:

minuteportmap(clk=>enmin_re,

clk1=>clk,

reset=>reset,

sethour=>sethour,

enhour=>enhour_re,

daout=>minute_daout);

u3:

hourportmap(clk=>enhour_re,

reset=>reset,

daout=>hour_daout);

u4:

alertportmap(clk=>clk,

dain=>minute_daout,

speak=>speaker,

lamp=>lamp);

u5:

seltimeportmap(clk1=>clkdsp,

reset=>reset,

sec=>second_daout,

min=>minute_daout,

hour=>hour_daout,

daout=>seltime_daout,

dp=>dpout,

sel=>sel);

u6:

deledportmap(num=>seltime_daout,

led=>ledout);

enda;

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

当前位置:首页 > 考试认证 > IT认证

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

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