VHDL数字钟代码Word文件下载.docx

上传人:b****1 文档编号:4439230 上传时间:2023-05-03 格式:DOCX 页数:28 大小:21.40KB
下载 相关 举报
VHDL数字钟代码Word文件下载.docx_第1页
第1页 / 共28页
VHDL数字钟代码Word文件下载.docx_第2页
第2页 / 共28页
VHDL数字钟代码Word文件下载.docx_第3页
第3页 / 共28页
VHDL数字钟代码Word文件下载.docx_第4页
第4页 / 共28页
VHDL数字钟代码Word文件下载.docx_第5页
第5页 / 共28页
VHDL数字钟代码Word文件下载.docx_第6页
第6页 / 共28页
VHDL数字钟代码Word文件下载.docx_第7页
第7页 / 共28页
VHDL数字钟代码Word文件下载.docx_第8页
第8页 / 共28页
VHDL数字钟代码Word文件下载.docx_第9页
第9页 / 共28页
VHDL数字钟代码Word文件下载.docx_第10页
第10页 / 共28页
VHDL数字钟代码Word文件下载.docx_第11页
第11页 / 共28页
VHDL数字钟代码Word文件下载.docx_第12页
第12页 / 共28页
VHDL数字钟代码Word文件下载.docx_第13页
第13页 / 共28页
VHDL数字钟代码Word文件下载.docx_第14页
第14页 / 共28页
VHDL数字钟代码Word文件下载.docx_第15页
第15页 / 共28页
VHDL数字钟代码Word文件下载.docx_第16页
第16页 / 共28页
VHDL数字钟代码Word文件下载.docx_第17页
第17页 / 共28页
VHDL数字钟代码Word文件下载.docx_第18页
第18页 / 共28页
VHDL数字钟代码Word文件下载.docx_第19页
第19页 / 共28页
VHDL数字钟代码Word文件下载.docx_第20页
第20页 / 共28页
亲,该文档总共28页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

VHDL数字钟代码Word文件下载.docx

《VHDL数字钟代码Word文件下载.docx》由会员分享,可在线阅读,更多相关《VHDL数字钟代码Word文件下载.docx(28页珍藏版)》请在冰点文库上搜索。

VHDL数字钟代码Word文件下载.docx

ten:

outstd_logic_vector(7downto0);

one:

outstd_logic_vector(7downto0)

componenti24bcd

inintegerrange0to23;

signalcarry1,carry2:

signalabin1,abin2:

integerrange0to59;

signalabin3:

integerrange0to23;

signalclk_1h:

signalsh,sl,mh,ml,hh,hl:

std_logic_vector(7downto0);

signalcnt:

integerrange0to5:

=0;

begin

process(clk)--分频为1hz

constantcounter_len:

integer:

=19999999;

variablecnt:

integerrange0tocounter_len;

begin

ifclk'

eventandclk='

1'

then

ifcnt=counter_lenthen

cnt:

else

=cnt+1;

endif;

casecntis

when0tocounter_len/2=>

clk_1h<

='

0'

;

whenothers=>

endcase;

endprocess;

process(clk)

variablecnt1:

integerrange0to200;

variablecnt2:

integerrange0to10;

ifcnt1=200then

cnt1:

ifcnt2=10then

cnt2:

if(cnt=5)then

cnt<

=cnt2+1;

=cnt1+1;

ifclk='

when0=>

duan<

="

000001"

data_o<

=sl;

when1=>

000010"

=sh;

when2=>

000100"

=ml;

when3=>

001000"

=mh;

when4=>

010000"

=hl;

when5=>

100000"

=hh;

whenothers=>

duan<

000000"

u1:

count60portmap(carry=>

clk_1h,rst=>

reset,times=>

abin1,full=>

carry1);

u2:

carry1,rst=>

abin2,full=>

carry2);

u3:

count24portmap(carry=>

carry2,rst=>

abin3);

u4:

i60bcdportmap(interg=>

abin1,ten=>

sh,one=>

sl);

u5:

abin2,ten=>

mh,one=>

ml);

u6:

i24bcdportmap(interg=>

abin3,ten=>

hh,one=>

hl);

entitycount60is--分,秒计数器

architectureaofcount60is

signaltime_s:

process(rst,carry)

ifrst='

time_s<

full<

elsifrising_edge(carry)then

iftime_s=59then

=time_s+1;

times<

=time_s;

libraryieee;

entitycount24is--时计数器

architectureaofcount24is

--full<

iftime_s=23then

entityi60bcdis--分,秒显示

architectureaofi60bcdis

process(interg)

caseintergis

when0|10|20|30|40|50=>

one<

11000000"

when1|11|21|31|41|51=>

11111001"

when2|12|22|32|42|52=>

10100100"

when3|13|23|33|43|53=>

10110000"

when4|14|24|34|44|54=>

10011001"

when5|15|25|35|45|55=>

10010010"

when6|16|26|36|46|56=>

10000011"

when7|17|27|37|47|57=>

11111000"

when8|18|28|38|48|58=>

10000000"

when9|19|29|39|49|59=>

10011000"

=null;

when0|1|2|3|4|5|6|7|8|9=>

ten<

when10|11|12|13|14|15|16|17|18|19=>

when20|21|22|23|24|25|26|27|28|29=>

when30|31|32|33|34|35|36|37|38|39=>

when40|41|42|43|44|45|46|47|48|49=>

when50|51|52|53|54|55|56|57|58|59=>

entityi24bcdis--时显示

architectureaofi24bcdis

when0|10|20=>

when1|11|21=>

when2|12|22=>

when3|13|23=>

when4|14=>

when5|15=>

when6|16=>

when7|17=>

when8|18=>

when9|19=>

when20|21|22|23=>

回答者:

ail傻大个|三级|2010-12-2917:

19

entityMINSECONDbis

port(clk,clrm,stop:

instd_logic;

----时钟/清零信号

secm1,secm0:

outstd_logic_vector(3downto0);

----秒高位/低位

co:

outstd_logic);

-------输出/进位信号

endMINSECONDb;

architectureSECofMINSECONDbis

signalclk1,DOUT2:

std_logic;

process(clk,clrm)

variablecnt1,cnt0:

std_logic_vector(3downto0);

---计数

VARIABLECOUNT2:

INTEGERRANGE0TO10;

IFCLK'

EVENTANDCLK='

THEN

IFCOUNT2>

=0ANDCOUNT2<

10THEN

COUNT2:

=COUNT2+1;

ELSECOUNT2:

DOUT2<

=NOTDOUT2;

ENDIF;

ifclrm='

then----当clr为1时,高低位均为0

cnt1:

0000"

cnt0:

elsifclk'

ifstop='

cnt0:

=cnt0;

=cnt1;

ifcnt1="

1001"

andcnt0="

1000"

then----当记数为98(实际是经过59个记时脉冲)

co<

----进位

----低位为9

elsifcnt0<

"

then----小于9时

=cnt0+1;

----计数

--elsifcnt0="

--clk1<

=notclk1;

else

ifcnt1<

then----高位小于9时

endif;

secm1<

secm0<

endprocess;

endSEC;

秒模块程序清单

entitySECONDis

port(clk,clr:

sec1,sec0:

endSECOND;

architectureSECofSECONDis

process(clk,clr)

ifclr='

then----当ckr为1时,高低位均为0

0101"

then----当记数为58(实际是经过59个记时脉冲)

then----高位小于5时

sec1<

sec0<

 

分模块程序清单

libraryieee;

entityMINUTEis

port(clk,en:

min1,min0:

endMINUTE;

architectureMINofMINUTEis

process(clk)

ifclk'

ifen='

min1<

min0<

endMIN;

时模块程序清单

entityHOURis

----输入时钟/高电平有效的使能信号

h1,h0:

outstd_logic_vector(3downto0));

----时高位/低位

endHOUR;

architecturehour_arcofHOURis

----记数

then---上升沿触发

then---同时“使能”为1

0010"

0011"

----高位/低位同时为0时

then----低位小于9时,低位记数累加

-----高位记数累加

h1<

h0<

endhour_arc;

动态扫描模块

entitySELTIMEis

clk:

------扫描时钟

secm1,secm0,sec1,sec0,min1,min0,h1,h0:

instd_logic_vector(3downto0);

-----分别为秒个位/时位;

分个位/

daout:

----------------输出

sel:

outstd_logic_vector(2downto0));

-----位选信号

endSELTIME;

architecturefunofSELTIMEis

signalcount:

std_logic_vector(2downto0);

----计数信号

sel<

=count;

if(clk'

)then

if(count>

111"

count<

000"

=count+1;

case

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

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2