




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、數(shù)字電子技術(shù)課程設(shè)計(jì)報(bào)告基于verilog HDL語言的簡(jiǎn)易電子琴設(shè)計(jì) 學(xué) 院:_信息與控制工程學(xué)院_ 專業(yè)班級(jí):_電氣11級(jí)四班_ 姓 名:_商玉璽_ 學(xué) 號(hào):_11053421_ 指導(dǎo)教師:_一、實(shí)驗(yàn)?zāi)康?1、學(xué)習(xí)verilogHDL語言的基本運(yùn)用,能夠利用其進(jìn)行簡(jiǎn)單編程; 2、學(xué)習(xí)使用Quartus 7.0的基本操作,能夠利用其進(jìn)行簡(jiǎn)單的設(shè)計(jì); 3、結(jié)合實(shí)踐加深對(duì)理論知識(shí)的理解。二、設(shè)計(jì)題目 用verilogHDl語言設(shè)計(jì)簡(jiǎn)易電子琴。三、題目要求 (1)單獨(dú)從左至右按下S1-S7每個(gè)按鍵后能夠各自對(duì)應(yīng)發(fā)出 “哆來咪發(fā)唆啦西”的音樂聲;(2)按下最右邊按鍵(S8),同時(shí)再配合按下S1-S7
2、鍵后,發(fā)高八度的對(duì)應(yīng)音;(3)按鍵需要進(jìn)行“消抖”處理;(4)外部輸入脈沖信號(hào)頻率為1mhz;(5)擴(kuò)展要求:自主設(shè)計(jì)(增加低8度功能,自動(dòng)播放一段音樂)。四、設(shè)計(jì)原理(1)喇叭的振動(dòng)頻率不同,導(dǎo)致產(chǎn)生不同的聲音;振動(dòng)頻率越低,聲音越低沉,振動(dòng)頻率越高,聲音越尖銳。題目中音樂基本音的 “哆”對(duì)應(yīng)頻率為523Hz 、“來”對(duì)應(yīng)頻率為587Hz 、“咪”對(duì)應(yīng)頻率為659Hz 、“發(fā)”對(duì)應(yīng)頻率為698Hz 、“唆”對(duì)應(yīng)頻率為784Hz 、“啦”對(duì)應(yīng)頻率為880Hz 、“西”對(duì)應(yīng)頻率為998Hz。低8度音:基本音頻率/2,例如低音1的頻率為523/2=261.5Hz。高8度音:基本音頻率×2
3、,例如高音1的頻率為523×2=1046Hz.。不同的頻率產(chǎn)生利用給定的時(shí)鐘脈沖來進(jìn)行分頻實(shí)現(xiàn)。(2)消抖的原理:按鍵默認(rèn)輸入邏輯1,當(dāng)有按鍵按下時(shí)對(duì)應(yīng)的輸入為邏輯0(但會(huì)存在抖動(dòng)),當(dāng)FPGA開始檢測(cè)到該引腳從1變?yōu)?后開始定時(shí)(按鍵抖動(dòng)時(shí)間大約10ms),定時(shí)時(shí)間結(jié)束后若該引腳仍然為0則表示確實(shí)發(fā)生按鍵按下,否則視為抖動(dòng)而不予以理會(huì);按鍵松開過程的消抖處理和按下時(shí)原理一樣。(3)原理框圖四、管腳對(duì)應(yīng)表信號(hào)名稱對(duì)應(yīng)FPGA管腳名說明1MHzL2基準(zhǔn)時(shí)鐘OUF3音頻輸出S1F8基本功能按鍵S2A14S3F10S4B16S5F12S6B17S7F15S8B18BT1M1擴(kuò)展功能按鍵BT
4、2M2BT3U12BT4U11五、實(shí)驗(yàn)過程1、設(shè)計(jì)按鍵防抖模塊(1)設(shè)計(jì)程序module xiaodou(rst,clk_1M,out);input clk_1M;input rst;output out;wire rst;reg out;reg24:0cnt;reg2:0state;parameter state0=3'b000, state1=3'b001, state2=3'b010, state3=3'b011, state4=3'b100, state5=3'b101;always(posedge clk_1M)begincnt<
5、=24'd0;case(state) state0:if(!rst)beginout=0;state<=state1;end elsestate<=state0; state1:beginout=0;cnt<=cnt+1;if(cnt=10000)state<=state2;elsebegin/out=1;state<=state1;endend state2:if(!rst)state<=state3;elsestate<=state0; state3:if(!rst)begin out=1;cnt<=0;/state<=stat
6、e3;end elsestate<=state4; state4:begincnt<=cnt+1;if(cnt=200000)beginout=1;state<=state5;endelsebeginout=1;state<=state4;endend state5:if(rst)beginout=0;state<=state0;end else state<=state3;endcaseendendmodule(2)原理圖及仿真波形2、按鍵識(shí)別模塊設(shè)計(jì)(1)程序設(shè)計(jì)module xkey(a,b,c,d,e,f,g,h,l,qout);input a,b,
7、c,d,e,f,g,h,l;output qout;reg 8:0 qin;reg 4:0 qout;always(a or b or c or d or e or f or g or h or l)begin qin8=a; qin7=b; qin6=c; qin5=d; qin4=e; qin3=f; qin2=g; qin1=h; qin0=l;endalways(qin)begincase(qin)9'b100000000:qout<=5'b00001;9'b010000000:qout<=5'b00010;9'b001000000:
8、qout<=5'b00011;9'b000100000:qout<=5'b00100;9'b000010000:qout<=5'b00101;9'b000001000:qout<=5'b00110;9'b000000100:qout<=5'b00111;9'b100000010:qout<=5'b01000;9'b010000010:qout<=5'b01001;9'b001000010:qout<=5'b01010;9'
9、;b000100010:qout<=5'b01011;9'b000010010:qout<=5'b01100;9'b000001010:qout<=5'b01101;9'b000000110:qout<=5'b01110;9'b100000001:qout<=5'b01111;9'b010000001:qout<=5'b10000;9'b001000001:qout<=5'b10001;9'b000100001:qout<=5'
10、b10010;9'b000010001:qout<=5'b10011;9'b000001001:qout<=5'b10100;9'b000000101:qout<=5'b10101;9'b000000000:qout<=5'b00000;9'b000000010:qout<=5'b00000;9'b000000001:qout<=5'b00000;default:qout<=0;endcaseendendmodule(2)原理圖及仿真波形3、分頻器模塊的設(shè)計(jì)
11、(1)程序設(shè)計(jì)module fenpin(in,clk_1M,out);input in;input clk_1M;output out;wire4:0in;reg out;reg11:0count;reg4:0state;initialcount<=12'd0;parameter state0=5'b00000, state1=5'b00001, state2=5'b00010, state3=5'b00011, state4=5'b00100, state5=5'b00101, state6=5'b00110, stat
12、e7=5'b00111, state8=5'b01000, state9=5'b01001, state10=5'b01010, state11=5'b01011, state12=5'b01100, state13=5'b01101, state14=5'b01110, state15=5'b01111, state16=5'b10000, state17=5'b10001, state18=5'b10010, state19=5'b10011, state20=5'b10100,
13、 state21=5'b10101, state22=5'b10110;always(posedge clk_1M)begincase(state)state0:begin/if(allin=5'b10110)/state<=state0;if(in=5'b00001)state<=state1;else if(in=5'b00010)state<=state2;else if(in=5'b00011)state<=state3;else if(in=5'b00100)state<=state4;else i
14、f(in=5'b00101)state<=state5;else if(in=5'b00110)state<=state6;else if(in=5'b00111)state<=state7;else if(in=5'b01000)state<=state8;else if(in=5'b01001)state<=state9;else if(in=5'b01010)state<=state10;else if(in=5'b01011)state<=state11;else if(in=5'
15、b01100)state<=state12;else if(in=5'b01101)state<=state13;else if(in=5'b01110)state<=state14;else if(in=5'b01111)state<=state15;else if(in=5'b10000)state<=state16;else if(in=5'b10001)state<=state17;else if(in=5'b10010)state<=state18;else if(in=5'b10011
16、)state<=state19;else if(in=5'b10100)state<=state20;else if(in=5'b10101)state<=state21;else if(in=5'b00000)state<=state22;elsestate<=state0;endstate1:beginif(count<=956)beginbegincount=count+12'd1;endif(in=5'b00001)state<=state1;elsebeginout=0;state<=state0
17、;endendelsebeginbeginout=out;count=0;endif(in=5'b00001)state<=state1;elsebeginout=0;state<=state0;endendendstate2:begin if(count<=852)begin begin count=count+12'd1;end if(in=5'b00010)state<=state2;else begin out=0;state<=state0;end endelse begin begin out=out;count=0;end i
18、f(in=5'b00010)state<=state2;else begin out=0;state<=state0;end end endstate3:begin if(count<=759)begin begin count=count+12'd1;end if(in=5'b00011)state<=state3;else begin out=0;state<=state0;end endelse begin begin out=out;count=0;end if(in=5'b00011)state<=state3;el
19、se begin out=0;state<=state0;end end endstate4:begin if(count<=716)begin begin count=count+12'd1;end if(in=5'b00100)state<=state4;else begin out=0;state<=state0;end endelse begin begin out=out;count=0;end if(in=5'b00100)state<=state4;else begin out=0;state<=state0;end e
20、nd endstate5:begin if(count<=638)begin begin count=count+12'd1;end if(in=5'b00101)state<=state5;else begin out=0;state<=state0;end endelse begin begin out=out;count=0;end if(in=5'b00101)state<=state5;else begin out=0;state<=state0;end end endstate6:begin if(count<=568)b
21、egin begin count=count+12'd1;end if(in=5'b00110)state<=state6;else begin out=0;state<=state0;end endelse begin begin out=out;count=0;end if(in=5'b00110)state<=state6;else begin out=0;state<=state0;end end endstate7:begin if(count<=501)begin begin count=count+12'd1;end
22、if(in=5'b00111)state<=state7;else begin out=0;state<=state0;end endelse begin begin out=out;count=0;end if(in=5'b00111)state<=state7;else begin out=0;state<=state0;end end endstate8:begin if(count<=478)begin begin count=count+12'd1;end if(in=5'b01000)state<=state8;e
23、lse begin out=0;state<=state0;end endelse begin begin out=out;count=0;end if(in=5'b01000)state<=state8;else begin out=0;state<=state0;end end endstate9:begin if(count<=426)begin begin count=count+12'd1;end if(in=5'b01001)state<=state9;else begin out=0;state<=state0;end
24、endelse begin begin out=out;count=0;end if(in=5'b01001)state<=state9;else begin out=0;state<=state0;end end endstate10:begin if(count<=380)begin begin count=count+12'd1;end if(in=5'b01010)state<=state10;else begin out=0;state<=state0;end endelse begin begin out=out;count=0
25、;end if(in=5'b01010)state<=state10;else begin out=0;state<=state0;end end endstate11:begin if(count<=358)begin begin count=count+12'd1;end if(in=5'b01011)state<=state11;else begin out=0;state<=state0;end endelse begin begin out=out;count=0;end if(in=5'b01011)state<=
26、state11;else begin out=0;state<=state0;end end endstate12:begin if(count<=319)begin begin count=count+12'd1;end if(in=5'b01100)state<=state12;else begin out=0;state<=state0;end endelse begin begin out=out;count=0;end if(in=5'b01100)state<=state12;else begin out=0;state<
27、=state0;end end endstate13:begin if(count<=284)begin begin count=count+12'd1;end if(in=5'b01101)state<=state13;else begin out=0;state<=state0;end endelse begin begin out=out;count=0;end if(in=5'b01101)state<=state13;else begin out=0;state<=state0;end end endstate14:begin i
28、f(count<=251)begin begin count=count+12'd1;end if(in=5'b01110)state<=state14;else begin out=0;state<=state0;end endelse begin begin out=out;count=0;end if(in=5'b01110)state<=state14;else begin out=0;state<=state0;end end endstate15:begin if(count<=1912)begin begin count
29、=count+12'd1;end if(in=5'b01111)state<=state15;else begin out=0;state<=state0;end endelse begin begin out=out;count=0;end if(in=5'b01111)state<=state15;else begin out=0;state<=state0;end end endstate16:begin if(count<=1704)begin begin count=count+12'd1;end if(in=5'
30、b10000)state<=state16;else begin out=0;state<=state0;end endelse begin begin out=out;count=0;end if(in=5'b10000)state<=state16;else begin out=0;state<=state0;end end endstate17:begin if(count<=1518)begin begin count=count+12'd1;end if(in=5'b10001)state<=state17;else beg
31、in out=0;state<=state0;end endelse begin begin out=out;count=0;end if(in=5'b10001)state<=state17;else begin out=0;state<=state0;end end endstate18:begin if(count<=1432)begin begin count=count+12'd1;end if(in=5'b10010)state<=state18;else begin out=0;state<=state0;end end
32、else begin begin out=out;count=0;end if(in=5'b10010)state<=state18;else begin out=0;state<=state0;end end endstate19:begin if(count<=1276)begin begin count=count+12'd1;end if(in=5'b10011)state<=state19;else begin out=0;state<=state0;end endelse begin begin out=out;count=0;
33、end if(in=5'b10011)state<=state19;else begin out=0;state<=state0;end end endstate20:begin if(count<=1136)begin begin count=count+12'd1;end if(in=5'b10100)state<=state20;else begin out=0;state<=state0;end endelse begin begin out=out;count=0;end if(in=5'b10100)state<=
34、state20;else begin out=0;state<=state0;end end endstate21:begin if(count<=1002)begin begin count=count+12'd1;end if(in=5'b10101)state<=state21;else begin out=0;state<=state0;end endelse begin begin out=out;count=0;end if(in=5'b10101)state<=state21;else begin out=0;state<
35、;=state0;end end endstate22:begin out=0;state<=state0;endendcaseendendmodule(2)原理圖及仿真波形4、自動(dòng)播放模塊(1)程序設(shè)計(jì)module huanlesong(in,clk_1M,o1,o2,o3,o4,o5,o6,o7,o8,o9);input in,clk_1M;output o1,o2,o3,o4,o5,o6,o7,o8,o9;reg o1,o2,o3,o4,o5,o6,o7,o8,o9;reg18:0q;reg6:0n;always(posedge clk_1M)if(in=0)begino1=0;o
36、2=0;o3=0;o4=0;o5=0;o6=0;o7=0;o8=0;o9=0;q=q+1;if(q='d200000)begin q='b0;n=n+1;endcase(n)'d1:o3=1;'d2:o3=1;'d3:o4=1;'d4:o5=1;'d5:o5=1;'d6:o4=1;'d7:o3=1;'d8:o2=1;'d9:o1=1;'d10:o1=1;'d11:o2=1;'d12:o3=1;'d13:o3=1;'d14:o2=1;'d15:o2=1;'
37、;d16:begin o1=0;o2=0;o3=0;o4=0;o5=0;o6=0;o7=0;o8=0;o9=0;end'd17:o3=1;'d18:o3=1;'d19:o4=1;'d20:o5=1;'d21:o5=1;'d22:o4=1;'d23:o3=1;'d24:o2=1;'d25:o1=1;'d26:o1=1;'d27:o2=1;'d28:o3=1;'d29:o2=1;'d30:o1=1;'d31:o1=1;'d32:begin o1=0;o2=0;o3=0;o
38、4=0;o5=0;o6=0;o7=0;o8=0;o9=0;end'd33:o2=1;'d34:o2=1;'d35:o3=1;'d36:o1=1;'d37:o2=1;'d38:o3=1;'d39:o3=1;'d40:o1=1;'d41:o2=1;'d42:o3=1;'d43:o3=1;'d44:o2=1;'d45:o1=1;'d46:o2=1;'d47:begin o9=1;o5=1;end'd48:o1=1;'d49:o3=1;'d50:o3=1;'d51:o4=1;'d52:o5=1;'d53:o5=1;'d54:o4=1;'d55:o3=1;'d56:o2=1;'d57:o1=1;'d58:o1=1;'d59:o2=1;'d60:o3=1;'d61:o2=1;'d62:o1=1;'d63:o1=1;'d64:begin o1=0
溫馨提示
- 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. 人人文庫(kù)網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 班主任在班級(jí)活動(dòng)中的引導(dǎo)角色計(jì)劃
- 合同范本音樂app
- 股骨頸骨折護(hù)理查房
- 班級(jí)班規(guī)的制定與執(zhí)行計(jì)劃
- 2025年自然拼讀2級(jí)標(biāo)準(zhǔn)課件材料
- 學(xué)校周邊安全環(huán)境的構(gòu)建計(jì)劃
- 建立有效的會(huì)議記錄機(jī)制計(jì)劃
- 第3課 中華文明的起源2024-2025學(xué)年新教材七年級(jí)上冊(cè)歷史新教學(xué)設(shè)計(jì)(統(tǒng)編版2024)
- 以活動(dòng)促學(xué)習(xí)的班級(jí)實(shí)踐計(jì)劃
- 《貴州水城礦業(yè)股份有限公司水城縣米籮煤礦(新立一期)(延續(xù))礦產(chǎn)資源綠色開發(fā)利用方案(三合一)》評(píng)審意見
- DB37-T4824-2025 鄉(xiāng)鎮(zhèn)(街道)應(yīng)急物資配備指南
- 《重大基礎(chǔ)設(shè)施項(xiàng)目涉及風(fēng)景名勝區(qū)選址論證報(bào)告編制技術(shù)規(guī)范》編制說明
- 2025年中國(guó)中煤能源股份有限公司招聘筆試參考題庫(kù)含答案解析
- 2024年蘇州健雄職業(yè)技術(shù)學(xué)院高職單招語文歷年參考題庫(kù)含答案解析
- 2024年大慶醫(yī)學(xué)高等??茖W(xué)校高職單招語文歷年參考題庫(kù)含答案解析
- 四川省綿陽市2025屆高三上學(xué)期第二次診斷性考試語文試題(含答案)
- 2025年1月 浙江首考英語試卷
- 2024年07月威海市商業(yè)銀行校園招考大學(xué)生報(bào)到筆試歷年參考題庫(kù)附帶答案詳解
- 房屋修繕工程難點(diǎn)、重點(diǎn)分析及應(yīng)對(duì)措施
- 《汽豐田服務(wù)流程》課件
- 財(cái)務(wù)管理(山東聯(lián)盟-青島科技大學(xué))知到智慧樹章節(jié)測(cè)試課后答案2024年秋青島科技大學(xué)
評(píng)論
0/150
提交評(píng)論