




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、分頻module clkgen (clock,reset,clkdiv,clk500;input clock,reset;output clkdiv;output clk500;reg 31:0 counter1;reg clkdiv;reg clk500;reg 31:0 counter0;/*?1HZ?*/always(posedge clockif(resetbeginclkdiv<=0;counter0<=0;endelse if(counter0=24'd4begincounter0<=0;clkdiv=clkdiv;endelsebegincounter0
2、<=counter0+1;clkdiv<=clkdiv;end/*?500HZ?*/always(posedge clock if(resetbeginclk500<=0;counter1<=0;endelse if(counter1=24'd2begincounter1<=0;clk500=clk500;endelsebegincounter1<=counter1+1;clk500<=clk500;endendmodule計(jì)數(shù)module jishu24(clkdiv,clear,second,s_carry,minute,m_carry,h
3、our,sL,sH,mL,mH,hL,hH; input clkdiv,clear;output 5:0 second,minute;output 4:0 hour;output s_carry,m_carry;output sL,sH,mL,mH,hL,hH;reg s_carry,m_carry;reg 5:0 second,minute;reg 4:0 hour;reg sL,sH,mL,mH,hL,hH;always(posedge clkdiv or clearif(clearsecond<=0;else if(second!=6'b111011beginsecond&
4、lt;=second+1;s_carry<=0;endelsebeginsecond<=0;s_carry<=1;endalways(posedge s_carry or clearif(clearminute<=0;else if(minute!=6'b111011beginminute<=minute+1;m_carry<=0;endelsebeginminute<=0;m_carry<=1;endalways (posedge m_carry or clearif(clearhour<=0;else if(hour!=5
5、9;b10111beginhour<=hour+1;endelsebeginhour<=0;endalways(posedge secondbeginsL<=second%10;sH<=second/10;endalways(posedge minutebeginmL<=minute%10;mH<=minute/10;endalways(posedge hourbeginhL<=hour%10;hH<=hour/10;endendmodule顯示module decode(clk500,reset,hH,hL,mH,mL,sH,sL,HIGH,L
6、OW,COM;input clk500;input reset;input hH,hL;/?input mH,mL;/?input sH,sL;/?output 6:0 HIGH,LOW;/?output 7:0 COM;/?reg 7:0 show_temp_H,show_temp_L;/?reg 7:0 COM;reg 7:0 Uweixuan;/?COM?reg 2:0 sm;/?reg 6:0 HIGH;/?reg 6:0 LOW;/?always(posedge clk500beginif(sm=3'b111sm<=3'b000;elsesm<=sm+3&
7、#39;b001;Uweixuan<=Uweixuan<<1;/?if(Uweixuan=8'b0000_0000Uweixuan<=8'b0000_0001; /?Uweixuan?COM=Uweixuan;/?Uweixuan?endalways(smbegincase(COM8'b1111_1110:show_temp_H=sL;/?8'b1111_1101:show_temp_H=sH;8'b1111_1011:show_temp_H=4'b1010;8'b1111_0111:show_temp_H=mL;
8、8'b1110_1111:show_temp_L=mH;8'b1101_1111:show_temp_L=4'b1010;8'b1011_1111:show_temp_L=hL;8'b0111_1111:show_temp_L=hH;/?endcaseendalways(show_temp_H/?begincase(show_temp_H4'b0000: HIGH=7'b011_1111;4'b0001: HIGH =7'b000_0110;4'b0010: HIGH =7'b101_1011;4'
9、b0011: HIGH =7'b100_1111;4'b0100: HIGH =7'b110_0110;4'b0101: HIGH =7'b110_1101;4'b0110: HIGH =7'b111_1101;4'b0111: HIGH =7'b000_0111;4'b1000: HIGH =7'b111_1111;4'b1001: HIGH =7'b110_1111;4'b1010: HIGH =7'b100_0000;default HIGH =7'b000_0
10、000;endcaseendalways(show_temp_L/?begincase(show_temp_L4'b0000:LOW=7'b011_1111;4'b0001: LOW =7'b000_0110;4'b0010: LOW =7'b101_1011;4'b0011: LOW =7'b100_1111;4'b0100: LOW =7'b110_0110;4'b0101: LOW =7'b110_1101;4'b0110: LOW =7'b111_1101;4'b01
11、11: LOW =7'b000_0111;4'b1000: LOW =7'b111_1111;4'b1001: LOW =7'b110_1111;4'b1010: LOW =7'b100_0000;default LOW =7'b000_0000;endcaseendendmodule主函數(shù)實(shí)現(xiàn)各函數(shù)的調(diào)用module main(clock,reset,HIGH,LOW,COM;input clock;input reset;output 6:0 HIGH,LOW;output 7:0 COM;endmodulemodule cl
12、kgen (clock,reset,clkdiv,clk500; input clock,reset;output clkdiv;output clk500;reg 23:0 counter1;reg clkdiv;reg clk500;reg 23:0 counter0;/*?1HZ?*/ always(posedge clockif(resetbeginclkdiv<=0;counter0<=0;endelse if(counter0=24'd4begincounter0<=0;clkdiv=clkdiv;endelsebegincounter0<=coun
13、ter0+1;clkdiv<=clkdiv;end/*?500HZ?*/ always(posedge clock if(resetbeginclk500<=0;counter1<=0;endelse if(counter1=24'd2begincounter1<=0;clk500=clk500;endelsebegincounter1<=counter1+1;clk500<=clk500;endendmodulemodule jishu24(clkdiv,clear,second,s_carry,minute,m_carry,hour,sL,sH,
14、mL,mH,hL,hH; input clkdiv,clear;output 5:0 second,minute;output 4:0 hour;output s_carry,m_carry;output sL,sH,mL,mH,hL,hH;reg s_carry,m_carry;reg 5:0 second,minute;reg 4:0 hour;reg sL,sH,mL,mH,hL,hH;always(posedge clkdiv or clearif(clearsecond<=0;else if(second!=6'b111011beginsecond<=second
15、+1;s_carry<=0;endelsebeginsecond<=0;s_carry<=1;endalways(posedge s_carry or clearif(clearminute<=0;else if(minute!=6'b111011beginminute<=minute+1;m_carry<=0;endelsebeginminute<=0;m_carry<=1;endalways (posedge m_carry or clearif(clearhour<=0;else if(hour!=5'b10111be
16、ginhour<=hour+1;endelsebeginhour<=0;endalways(posedge secondbeginsL<=second%10;sH<=second/10;endalways(posedge minutebeginmL<=minute%10;mH<=minute/10;endalways(posedge hourbeginhL<=hour%10;hH<=hour/10;endendmodulemodule shumaguan(clk500,reset1,hH,hL,mH,mL,sH,sL,HIGH,LOW,COM;i
17、nput clk500;input reset1;input hH,hL;/?input mH,mL;/?input sH,sL;/?output 6:0 HIGH,LOW;/?output 7:0 COM;/?reg 7:0 show_temp_H,show_temp_L;/?reg 7:0 COM;reg 7:0 Uweixuan;/?COM?reg 2:0 sm;/?reg 6:0 HIGH;/?reg 6:0 LOW;/?always(posedge clk500beginif(sm=3'b111sm<=3'b000;elsesm<=sm+3'b00
18、1;Uweixuan<=Uweixuan<<1;if(Uweixuan=8'b0000_0000Uweixuan<=8'b0000_0001; /?Uweixuan? COM=Uweixuan;/?Uweixuan?endalways(clk500begincase(COM8'b1111_1110:show_temp_H=sL;/?8'b1111_1101:show_temp_H=sH;8'b1111_1011:show_temp_H=4'b1010;8'b1111_0111:show_temp_H=mL;8
19、9;b1110_1111:show_temp_L=mH;8'b1101_1111:show_temp_L=4'b1010;8'b1011_1111:show_temp_L=hL;8'b0111_1111:show_temp_L=hH;/?endcaseendalways(show_temp_H/?begincase(show_temp_H4'b0000: HIGH=7'b011_1111;4'b0001: HIGH =7'b000_0110;4'b0010: HIGH =7'b101_1011;4'b001
20、1: HIGH =7'b100_1111;4'b0100: HIGH =7'b110_0110;4'b0101: HIGH =7'b110_1101;4'b0110: HIGH =7'b111_1101;4'b0111: HIGH =7'b000_0111;4'b1000: HIGH =7'b111_1111;4'b1001: HIGH =7'b110_1111;4'b1010: HIGH =7'b100_0000;default HIGH =7'b000_0000;
21、 endcaseendalways(show_temp_L/?begincase(show_temp_L4'b0000: LOW =7'b011_1111;4'b0001: LOW =7'b000_0110;4'b0010: LOW =7'b101_1011;4'b0011: LOW =7'b100_1111;4'b0100: LOW =7'b110_0110;4'b0101: LOW =7'b110_1101;4'b0110: LOW =7'b111_1101;4'b0111: LOW =7'b000_0111;4'b1000: LOW =7'b111_1111;4'b1
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 江蘇南京金陵中學(xué)2024~2025學(xué)年高二下冊(cè)期末考試數(shù)學(xué)試題學(xué)生卷
- 江蘇常州聯(lián)盟學(xué)校2024~2025學(xué)年高一下冊(cè)期末調(diào)研數(shù)學(xué)試題學(xué)生卷
- 農(nóng)村居民消費(fèi)升級(jí)對(duì)農(nóng)村金融服務(wù)的需求變化考核試卷
- 創(chuàng)新思維培訓(xùn)效果評(píng)估考核試卷
- 設(shè)備自動(dòng)化升級(jí)方案考核試卷
- 健康促進(jìn)項(xiàng)目評(píng)估中的慢性病預(yù)防與控制效果評(píng)價(jià)考核試卷
- 水資源保護(hù)法規(guī)考核試卷
- 壓力傳感器數(shù)據(jù)傳輸考核試卷
- 哺乳期營養(yǎng)保健品效果評(píng)價(jià)考核試卷
- 智能化醫(yī)療器械產(chǎn)品追溯系統(tǒng)考核試卷
- 影視視聽視聽語言課件
- 活性污泥法PPT參考課件
- 語文六年級(jí)下冊(cè)口語交際辯論20張
- (全)變電站全壽命周期管理建議
- 2022年福建華僑大學(xué)研究生院招聘行政人員筆試備考試題及答案解析
- 熱烈歡迎領(lǐng)導(dǎo)蒞臨指導(dǎo)ppt模板
- VTS中雷達(dá)和AIS的技術(shù)應(yīng)用與進(jìn)展
- 芬頓試劑投加量計(jì)算
- 建筑自動(dòng)化課件2013 10.通信網(wǎng)絡(luò)技術(shù)
- LS/T 8008-2010糧油倉庫工程驗(yàn)收規(guī)程
- GB/T 18749-2002耐化學(xué)腐蝕陶瓷塔填料技術(shù)條件
評(píng)論
0/150
提交評(píng)論