vhdl设计数字秒表2.docx
- 文档编号:12668319
- 上传时间:2023-04-21
- 格式:DOCX
- 页数:12
- 大小:525.99KB
vhdl设计数字秒表2.docx
《vhdl设计数字秒表2.docx》由会员分享,可在线阅读,更多相关《vhdl设计数字秒表2.docx(12页珍藏版)》请在冰豆网上搜索。
vhdl设计数字秒表2
数字秒表
摘要:
本文设计一块数字秒表,能够精确反映计时时间,并完成复位,计时功能,由于采用EDA技术进行设计,该方案具有工作速度快,硬件体积小,可靠性高等优点。
关键词:
数字秒表,VHDL,EDA,CPLD
1引言
秒表是人们日常生活的测量仪器,它能够简单的完成计时,清零等功能,从一年一度的校际运动会到NBA,世界杯,奥运会,都能看到秒表的身影。
,秒表计时的最大范围为1小时,精确为0.01,秒表可得到计时时间的分,秒,0.1秒等度量,且各度量单位间可正确进位,当复位清零有效时,秒表清零,并做好计时准备,在任何情况下,只要按下复位开关,秒表都要无条件的进行复位操作,即使在计时情况下都要无条件的清零。
2系统设计
2.1设计要求
设计一块数字秒表能够精确反映计时时间,能完成复位,计时功能。
2.2设计思路
根据设计要求,可以预先设计若干个不同进制的计数器,单元模块,然后将其进行利化组合起来得到数字秒表系统,数字秒表的实现主要依赖于两个计数器模块的设计:
十进制计数器和六进制计数器。
2.3设计模块
2.3.1主控制器设计
2.3.2十进制计数器模块设计
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitycnt10is
port(
clk:
instd_logic;
clr:
instd_logic;
ena:
instd_logic;
q:
outstd_logic_vector(3downto0);
co:
outstd_logic
);
endcnt10;
architecturertlofcnt10is
signaltmp:
std_logic_vector(3downto0);
begin
process(clk,clr,ena)
begin
ifclr='1'then
tmp<="0000";
elsifclk'eventandclk='1'then
ifena='1'then
iftmp="1001"then
tmp<="0000";
else
tmp<=tmp+'1';
endif;
endif;
endif;
endprocess;
process(tmp)
begin
iftmp="0000"then
co<='1';
else
co<='0';
endif;
endprocess;
q<=tmp;
endrtl;
2.3.2六进制计数器模块
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitycnt6is
port(
clk:
instd_logic;
clr:
instd_logic;
ena:
instd_logic;
q:
outstd_logic_vector(3downto0);
co:
outstd_logic
);
endcnt6;
architecturertlofcnt6is
signaltmp:
std_logic_vector(3downto0);
begin
process(clk,clr,ena)
begin
ifclr='1'then
tmp<="0000";
elsifclk'eventandclk='1'then
ifena='1'then
iftmp="0101"then
tmp<="0000";
else
tmp<=tmp+'1';
endif;
endif;
endif;
endprocess;
process(tmp)
begin
iftmp="0000"then
co<='1';
else
co<='0';
endif;
endprocess;
q<=tmp;
endrtl;
2.3.3译码模块
libraryIEEE;
useIEEE.STD_LOGIC_1164.ALL;
useIEEE.STD_LOGIC_ARITH.ALL;
useIEEE.STD_LOGIC_UNSIGNED.ALL;
entitydecoderis
Port(din:
instd_logic_vector(3downto0);--四位二进制码输入
dout:
outstd_logic_vector(6downto0));--输出LED七段码
enddecoder;
architectureBehavioralofdecoderis
begin
process(din)
begin
casedinis
when"0000"=>dout<="0000001";--0
when"0001"=>dout<="1001111";--1
when"0010"=>dout<="0010010";--2
when"0011"=>dout<="0000110";--3
when"0100"=>dout<="1001100";--4
when"0101"=>dout<="0100100";--5
when"0110"=>dout<="0100000";--6
when"0111"=>dout<="0001111";--7
when"1000"=>dout<="0000000";--8
when"1001"=>dout<="0000100";--9
whenothers=>dout<="1111111";
endcase;
endprocess;
endBehavioral;
2.3.4六万分频
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitycnt60000is
port(
clk:
instd_logic;
co:
outstd_logic
);
endcnt60000;
architecturertlofcnt60000is
signaltmp:
std_logic_vector(15downto0);
begin
process(clk,clr,ena)
begin
ifclr='1'then
tmp<="0000000000000000";
elsifclk'eventandclk='1'then
ifena='1'then
iftmp="1110011111100000"then
tmp<="0000000000000000";
else
tmp<=tmp+'1';
endif;
endif;
endif;
endprocess;
process(tmp)
begin
iftmp="0000000000000000"then
co<='1';
else
co<='0';
endif;
endprocess;
endrtl;
2.3.5显示模块
显示模块由6个共阳极数码管组成
2.4设计验证
六进制计数器仿真图
十进制计数器仿真图
系统总仿真图
管脚定义
(1)
管脚定义
(2)
全部管脚定义
2.5印制电路板设计
3结束语
本文采用级联的方法,实现了一个具有计时,复位功能的数字秒表,在系统设计中定义了两个计数器电骡模块,来实现数字秒表。
控器部分采用MAX+PLUSII进行仿真,仿真结果验证了设计的正确性。
致谢
在作者设计的过程中,指导老师陈卫兵给予了大力支持,陈老师认真负责的工作态度,严谨的治学精神和深厚的理论水平使作者受益匪浅。
在此表示感谢!
参考文献
[1]李国洪,沈明山.可编程器件EDA技术与实践[M].北京:
机械工业出版社,2004
[2]王金明.VerilogHDL程序设计教程[M].北京:
人民邮电出版社,2004
[3]潘松、黄继业.EDA技术实用教程[M].北京:
科学出版社,2002
[4]徐惠民,安德宁.数字逻辑设计与VHDL描述[M].北京:
机械工业出版社,2002
[5]杜建国.VerilogHDL硬件描述语言[M].北京:
国防工业出版社,2004.1
[6]廖裕平,陆瑞强.数字电路设计—使用MAX+plusII[M].北京:
清华大学出版社,2001
StopwatchDesignBasedonCPLD
Advisor:
ChenWeibing
Abstract:
thispaperdesignsadigitalstopwatch,accuratelyreflectthetimingtime,andcompletereset,timerfunction,becauseuseEDAtechnologydesign,theschemehasafast,hardware,smallsize,highreliabilityetc.
Keywords:
digitalstopwatch,VHDL,EDA,CPLD
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- vhdl 设计 数字 秒表