VHDL数字钟设计报告001Word格式.docx
- 文档编号:16881666
- 上传时间:2022-11-26
- 格式:DOCX
- 页数:17
- 大小:165.42KB
VHDL数字钟设计报告001Word格式.docx
《VHDL数字钟设计报告001Word格式.docx》由会员分享,可在线阅读,更多相关《VHDL数字钟设计报告001Word格式.docx(17页珍藏版)》请在冰豆网上搜索。
integerrange0to512;
variableq1:
std_logic;
ifclk1024'
eventandclk1024='
1'
then
ifcount1=512then
q1:
=notq1;
count1:
=0;
else
count1:
=count1+1;
endif;
clk1<
=q1;
endprocess;
process(clk1024)
variablecount512:
integerrange0to1;
variableq512:
begin
ifclk1024'
ifcount512=1then
q512:
=notq512;
count512:
else
count512:
=count512+1;
clk512<
=q512;
endcml;
2.2校时电路(jiaoshi)
本模块要实现的功能是:
正常计时、校时、校分在每个状态下都会产生不同控制信号实现相应的功能。
校时管脚图
代码:
entityjiaoshiis
port(rst,rvs,select_rvs,mtime,mclkin,hclkin:
hclkout,mclkout:
endjiaoshi;
architecturecmlofjiaoshiis
signalh_m:
std_logic;
begin
p1:
process(rst,rvs,hclkin,mclkin,h_m,mtime)
ifrst='
0'
null;
elsifrvs='
then
hclkout<
=hclkin;
mclkout<
=mCLKin;
elsifh_m='
=mtime;
else
mclkout<
=mclkin;
p2:
process(select_rvs)
ifselect_rvs'
eventandselect_rvs='
h_m<
=noth_m;
endprocess;
管脚图
仿真图
2.3时计数器(hour)分计数器(mine)秒计数器(second)
时计数器管脚图
时代码:
libraryieee;
entityhouris
port(rst,hclk:
hour0,hour1:
bufferstd_logic_vector(3downto0)
endhour;
architecturecmlofhouris
process(rst,hclk,hour0,hour1)
hour0<
="
0000"
;
hour1<
elsifhclk'
eventandhclk='
ifhour0="
0011"
andhour1="
0010"
elsifhour0="
1001"
=hour1+1;
=hour0+1;
endprocess;
分计数器管脚图
分代码:
entitymineis
port(rst,mclk:
mco:
outstd_logic;
min0,min1:
endmine;
architecturecmlofmineis
signalmin0_t,min1_t:
std_logic_vector(3downto0);
process(rst,mclk,min0,min1)
min0<
min1<
elsifmclk'
eventandmclk='
ifmin0="
0101"
andmin1="
mco<
='
elsifmin0="
andmin0="
=min1+1;
=min0+1;
秒计数器管脚图
秒代码:
entitysecondis
port(rst,sclk:
sco:
sec0,sec1:
endsecond;
architecturecmlofsecondis
signalsec0_t,sec1_t:
process(rst,sclk,sec0,sec1)
sec0<
sec1<
elsifsclk'
eventandsclk='
ifsec0="
andsec1="
sco<
elsifsec0="
andsec0="
=sec1+1;
=sec0+1;
2.4校时闪烁电路(flashnjiaoshi)
如果正在进行校时,flashjiaoshi将实现使当前正在校时项(小时或分钟)以1Hz的频率闪烁,以便于操知道正在被校正。
校时闪烁电路管脚图
entityflashjiaoshiis
port(rst,sclk,rvs,select_rvs:
hour0in,hour1in,min0in,min1in:
instd_logic_vector(3downto0);
hour0out,hour1out,min0out,min1out:
outstd_logic_vector(3downto0)
endflashjiaoshi;
architecturecmlofflashjiaoshiis
process(rst,sclk,rvs,hour0in,hour1in,min0in,min1in,h_m)
hour0out<
=hour0in;
hour1out<
=hour1in;
min0out<
=min0in;
min1out<
=min1in;
hour1out<
ifsclk='
min0out<
min1out<
1111"
IFsCLK='
endprocessp1;
process(select_rvs)
h_m<
endif;
endprocessp2;
2.5整点报时电路
整点报时管脚图
entitybaoshiis
port(clk1024,clk512:
instd_logic;
min0,min1,sec0,sec1:
instd_logic_vector(3downto0);
speak:
outstd_logic);
endbaoshi;
architecturecmlofbaoshiis
speak<
=clk512
when(min1="
)and(sec0="
orsec0="
0111"
)else
clk1024
when(min1="
)else'
2.6译码显示电路
该显示用的是动态扫描电路
译码显示管脚图
波形图
entityxianshiis
port(clk512:
h1,h0,m1,m0,s1,s0:
seg7:
outstd_logic_vector(6downto0);
select_sig:
outstd_logic_vector(5downto0)
endxianshi;
architecturecmlofxianshiis
signaldata:
signalorder:
std_logic_vector(2downto0);
process(clk512)
ifclk512'
eventandclk512='
caseorderis
when"
000"
=>
data<
=h1;
select_sig<
011111"
when"
001"
=h0;
101111"
010"
=m1;
110111"
011"
=m0;
111011"
100"
=s1;
111101"
101"
=s0;
111110"
whenothers=>
1000"
111111"
endcase;
iforder="
thenorder<
elseorder<
=order+1;
endif;
process(data)
casedatais
=>
seg7<
="
0000001"
0001"
1001111"
0010010"
0000110"
0100"
1001100"
0100100"
0110"
0100000"
0001111"
0000000"
0000100"
whenothers=>
1111111"
endcml;
2.7数字钟整体设计(top)
本数字钟的设计包括分频器、去抖动电路、校时电路、“时、分、秒”计数器、校时闪烁电路和译码显示电路。
以上已经有了各个功能模块的实现方法,现在将各个模块综合在一起,构成一个完整的数字钟。
entitytopis
port(clk1024,key,reset:
keyin:
instd_logic_vector(1downto0);
select_sigout:
outstd_logic_vector(5downto0);
seg7out:
speak:
endtop;
architecturecmloftopis
componentfenpinis
endcomponentfenpin;
componentjiaoshiis
endcomponentjiaoshi;
componenthouris
endcomponenthour;
componentminuteis
endcomponentminute;
componentsecondis
endcomponentsecond;
componentflashjiaoshiis
endcomponentflashjiaoshi;
componentxianshiis
endcomponentxianshi;
componentbaoshiis
endcomponentbaoshi;
signalscanCLKSig:
signalsecCLKSig:
signalhCLKSig0,hCLKSig1:
signalmCLKSig0,mCLKSig1:
signalsec1Sig,sec0Sig:
std_logic_vector(3downto0);
signalmin1Sig0,min0Sig0:
signalmin1Sig1,min0Sig1:
signalhour1Sig0,hour0Sig0:
signalhour1Sig1,hour0Sig1:
begin
U1:
fenpinPORTMAP(clk1024=>
clk1024,clk512=>
scanCLKSig,clk1=>
secCLKSig);
U2:
jiaoshiPORTMAP(rst=>
reset,rvs=>
key,select_rvs=>
keyin(0),
mtime=>
keyin
(1),
hclkin=>
hCLKSig0,mclkin=>
mCLKSig0,hclkout=>
hCLKSig1,mclkout=>
mCLKSig1);
U3:
hourPORTMAP(rst=>
reset,hCLK=>
hCLKSig1,hour1=>
hour1Sig0,
hour0=>
hour0Sig0);
U4:
minutePORTMAP(rst=>
reset,mclk=>
mCLKSig1,mco=>
hCLKSig0,
min1=>
min1Sig0,min0=>
min0Sig0);
U5:
secondPORTMAP(rst=>
reset,sCLK
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- VHDL 数字 设计 报告 001