优秀毕业论文——基于FPGA的数字钟设计.docx
- 文档编号:159235
- 上传时间:2022-10-04
- 格式:DOCX
- 页数:12
- 大小:226.42KB
优秀毕业论文——基于FPGA的数字钟设计.docx
《优秀毕业论文——基于FPGA的数字钟设计.docx》由会员分享,可在线阅读,更多相关《优秀毕业论文——基于FPGA的数字钟设计.docx(12页珍藏版)》请在冰豆网上搜索。
江 苏 科 技 大 学
实 验 报 告
实验名称:
基于FPGA的数字钟设计学院:
电子信息工程学院专业:
电子与通信工程学号:
149****** 姓名:
*** 指导老师:
**
日 期:
2014.11.18
11
一.数字钟总体设计方案:
1.1设计目的
①正确显示时、分、秒;
②可手动校时,能分别进行时、分的校正;
③清零功能;
1.2设计思路
数字钟的设计模块包括:
分频器模块、“时、分、秒”计数器模块、和译码显示模块。
每一个功能模块作为一个实体单独进行设计,最后再用VHDL的例化语句将各个模块进行整合,生成顶层实体top。
该数字钟可以实现3个功能:
计时功能、设置时间功能和清零功能。
二.数字钟各具体模块
2.1分频器(fengp)模块
本系统共需3种频率时钟信号(10MHz、1Hz、1KHz)。
为减少输入引脚,本系统采用分频模块,只需由外部提供10MHz基准时钟信号,其余两种频率时钟信号由分频模块得到。
分频器管脚
分频器代码:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entityfengpisport(clk0:
instd_logic;
clk_1Hz,clk_1kHz:
outstd_logic);
endentity;
architectureoneoffengpis
signalq1Hz:
integerrange0to9999999;signalq1kHz:
integerrange0to9999;begin
process(clk0)begin
ifclk0'eventandclk0='1'then
ifq1Hz<5000000-1thenclk_1Hz<='0';q1Hz<=q1Hz+1;elsifq1Hz=10000000-1thenq1Hz<=0;
else clk_1Hz<='1';q1Hz<=q1Hz+1;endif;
ifq1kHz<5000-1thenclk_1kHz<='0';q1kHz<=q1kHz+1;elsifq1kHz=10000-1thenq1kHz<=0;
else clk_1kHz<='1';q1kHz<=q1kHz+1;endif;
endif;
endprocess;end;
2.260(count60)进制计数校时模块
本模块要实现的功能是:
正常计时、校时、校分在每个状态下都会
产生不同控制信号实现相应的功能。
60进制计数器管脚图
60进制计数器代码:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitycount60isport(clk,set:
instd_logic;
CLR:
instd_logic:
='0';co:
outstd_logic;
h,l:
bufferstd_logic_vector(3downto0));endentity;
architectureoneofcount60issignalco1,set1:
std_logic;begin
set1<=set;
co<=(set1orco1);process(clk,CLR)begin
ifCLR='1'thenh<="0000";l<="0000";
else
ifclk'eventandclk='1'then
--ifstart='1'then
--h<=d(7downto4);
--l<=d(3downto0);
if(h="0101"andl="1001")thenco1<='1';l<="0000";h<="0000";
else
ifl<"1001"thenl<=l+1;
else
l<="0000";
ifh<"0101"thenh<=h+1;
endif;endif;
co1<='0';
endif;endif;
endif;endprocess;end;
2.324(count24)进制计数器模块
24进制计数器管脚图
24进制计数器时代码:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitycount24isport(clk:
instd_logic;
CLR:
instd_logic:
='0';
--d:
instd_logic_vector(7downto0)
---co:
outstd_logic;
h,l:
bufferstd_logic_vector(3downto0));endentity;
architectureoneofcount24isbegin
process(clk,CLR)begin
ifCLR='1'thenh<="0000";l<="0000";
elsifclk'eventandclk='1'then
--ifstart='1'then
-- h<=d(7downto4);
-- l<=d(3downto0);
ifh="0000"orh="0001"thenifl="1001"then
l<="0000";h<=h+1;
else
l<=l+1;
endif;
else
ifl="0011"then
l<="0000";
ifh="0010"thenh<="0000";
else
h<=h+1;
endif;else
l<=l+1;
endif;endif;
endif;endprocess;end;
2.3译码显示模块(display)
该显示用的是动态扫描电路
译码显示器管脚图
译码显示器代码:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;useieee.std_logic_arith.all;
entitydisplayisport(clk:
instd_logic;
hh,hl,mh,ml,sh,sl:
instd_logic_vector(3downto0);sg:
outstd_logic_vector(6downto0);bt:
outstd_logic_vector(7downto0));
endentity;
architectureoneofdisplayissignala:
integerrange0to10;
signalcnt:
integerrange0to7;--实现动态扫描
beginP1:
process(cnt,hh,hl,mh,ml,sh,sl)begin
casecntis
when
0
=>
bt
<=
"00000001";a
<=
conv_integer(hh);
when
1
=>
bt
<=
"00000010";a
<=
conv_integer(hl);
when
2
=>
bt
<=
"00000100";a
<=
10; jiangefu"-"
when
3
=>
bt
<=
"00001000";a
<=
conv_integer(mh);
when
4
=>
bt
<=
"00010000";a
<=
conv_integer(ml);
when
5
=>
bt
<=
"00100000";a
<=
10; jiangefu"-"
when
6
=>
bt
<=
"01000000";a
<=
conv_integer(sh);
when
7
=>
bt
<=
"10000000";a
<=
conv_integer(sl);
whenothers=>null;endcase;
endprocessP1;
p2:
process(clk)begin
if(clk'eventandclk='1')thencnt<=cnt+1;
endif;
endprocessp2;
P3:
process(a)begin
caseais
when
0
=>
sg
<=
"0111111";
when
1
=>
sg
<=
"0000110";
when
2
=>
sg
<=
"1011011";
when
3
=>
sg
<=
"1001111";
when
4
=>
sg
<=
"1100110";
when
5
=>
sg
<=
"1101101";
when
6
=>
sg
<=
"1111101";
when
7
=>
sg
<=
"0000111";
when
8
=>
sg
<=
"1111111";
when
9
=>
sg
<=
"1101111";
when10=>sg<="1000000";
whenothers=>sg<="1000000";endcase;
endprocessP3;end;
2.4数字钟顶层设计模块
数字钟顶层设计模块管脚图
数字钟顶层设计模块代码:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;useieee.std_logic_arith.all;
entitydclockisport(clk,s1,s0,k0:
instd_logic;
sg7:
outstd_logic_vector(6downto0);bt8:
outstd_logic_vector(7downto0));
endentity;
architectureoneofdclockiscomponentfengp
port(clk0:
instd_logic;clk_1Hz,clk_1kHz:
outstd_logic);
endcomponent;componentcount60
port(clk,set:
instd_logic;
CLR:
instd_logic:
='0';
---d:
instd_logic_vector(7downto0)
co:
outstd_logic;
h,l:
bufferstd_logic_vector(3downto0));endcomponent;
componentcount24port(clk:
instd_log
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 优秀 毕业论文 基于 FPGA 数字 设计