




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1引言隨著電子技術的飛速發(fā)展,微電子技術的進步主要表現(xiàn)在大規(guī)模集成電路加工技術即半導體工藝技術的發(fā)展上,使得表征半導體的工藝水平的線寬已經(jīng)達到了60nm,并在不斷地縮小,面在硅片單位面積上,集成了更多的晶體管。集成電路設計正在不斷地向超大規(guī)模,極低功耗和超高速的方向發(fā)展,電子產品的功能越來越強大,體積越來越小,功耗越來越低。同時,利用可編程邏輯器件和EDA技術使設計方法發(fā)生了質的變化。把以前“電路設計+硬件搭試+調試焊接”轉化為“功能設計+軟件模擬+仿真下載”。利用EDA開發(fā)平臺,采用可編程邏輯器件CPLD/FPGA使硬件的功能可通過編程來實現(xiàn),這種新的基于芯片的設計方法能夠使設計者有更多機會充分發(fā)揮創(chuàng)造性思維,實現(xiàn)多種復雜數(shù)字邏輯系統(tǒng)的功能,將原來由電路板設計完成的工作放到芯片的設計中進行,減少了連線和體積,提高了集成度,降低了干擾,大大減輕了電路設計和PCB設計的工作量和難度,增強了設計的靈活性,有效地提高了工作效率,增加了系統(tǒng)的可靠性和穩(wěn)定性,提高了技術指標。這些技術使得各種電子產品迅速的進入了我們的生活,我們處在一個被電子產品深度包圍的時代,在一個普通老百姓的家里,衣食住行,每一個產品的誕生都離不開EDA技術,從彩色電視機,到智能冰箱,到全自動洗衣機,電飯煲,到微波爐,電磁爐,電子琴,再到個人隨身用的手機,MP3音樂播放器都需要EDA技術提供支持。本文應用VHDL硬件描述語言,設計一個樂曲硬件演奏電路,它能將一首預先設置存儲好的樂曲自動播放出來,除此之外,也能夠通過按鍵的方式輸入音符,使其具備簡易電子琴的功能。通過此項研究,能夠深切的體會利用EDA工具開發(fā)的優(yōu)越性,在此基礎上,對樂曲硬件演奏電路功能進行豐富,具體一定的社會實用性。2EDA技術2.1簡介EDA技術是在電子CAD技術基礎上發(fā)展起來的計算機軟件系統(tǒng),是指以計算機為工作平臺,融合了應用電子技術、計算機技術、信息處理與智能化技術的最新成果,進行電子產品的自動設計。利用EDA工具,電子設計師可以從概念、算法、協(xié)議等開始設計電子系統(tǒng),大量工作可以通過計算機完成,并可以將電子產品從電路設計、性能分析到設計出IC版圖或PCB版圖的整個過程的計算機上自動處理完成?,F(xiàn)在對EDA的概念或疇用得很寬。包括在機械、電子、通信、航空航天、化工、礦產、生物、醫(yī)學、軍事等各個領域,都有EDA的應用。目前EDA技術已在各大公司、企事業(yè)單位和科研教學部門廣泛使用。例如在飛機制造過程中,從設計、性能測試與特性分析直到飛行模擬,都可能涉與到EDA技術。本文所指的EDA技術,主要針對電子電路設計、PCB設計和IC設計。2.2硬件描述語言——VHDLVHDL的簡介VHDL的英文全名是Very-High-SpeedIntegratedCircuitHardwareDescriptionLanguage,誕生于1982年。1987年底,VHDL被IEEE和美國國防部確認為標準硬件描述語言。VHDL語言是一種用于電路設計的高級語言,主要用于描述數(shù)字系統(tǒng)的結構,行為,功能和接口。除了含有許多具有硬件特征的語句外,VHDL的語言形式和描述風格與句法是十分類似于一般的計算機高級語言。VHDL的程序結構特點是將一項工程設計,或稱設計實體(可以是一個元件,一個電路模塊或一個系統(tǒng))分成外部(或稱可是部分,與端口)和部(或稱不可視部分),既涉與實體的部功能和算法完成部分。在對一個設計實體定義了外部界面后,一旦其部開發(fā)完成后,其他的設計就可以直接調用這個實體。VHDL語言的特點功能強大、設計靈活。支持廣泛、易于修改。強大的系統(tǒng)硬件描述能力。獨立于器件的設計、與工藝無關。很強的移植能力。VHDL的設計流程用VHDL語言設計電路的流程:在用VHDL語言來設計電路時,主要的過程是這樣的:(1)使用文本編輯器輸入設計源文件。(2) 使用編譯工具編譯源文件°VHDL的編譯器有很多,ACTIVE公司,MODELSIM公司,SYNPLICITY公司,SYNOPSYS公司,VERIBEST公司等都有自己的編譯器。(3) 功能仿真。對于某些人而言,仿真這一步似乎是可有可無的。但是對于一個可靠的設計而言,任何設計最好都進行仿真,以保證設計的可靠性。另外,對于作為一個獨立的設計項目而言,仿真文件的提供足可以證明你設計的完整性。(4) 綜合。綜合的目的是在于將設計的源文件由語言轉換為實際的電路。這一部分的最終目的是生成門電路級的網(wǎng)表(Netlist)。(5) 布局、布線。這一步的目的是生成用于燒寫的編程文件。在這一步,將用到第(4)步生成的網(wǎng)表并根據(jù)CPLD/FPG廠商的器件容量,結構等進行布局、布線。這就好像在設計PCB時的布局布線一樣。先將各個設計中的門根據(jù)網(wǎng)表的容和器件的結構放在器件的特定部位。然后,在根據(jù)網(wǎng)表中提供的各門的連接,把各個門的輸入輸出連接起來。(6) 最后仿真。這一步主要是為了確定設計在經(jīng)過布局布線之后,是不是還滿足原本的設計要求。3簡易電子琴設計過程3.1簡易電子琴的工作原理音樂產生原理與硬件設計由于一首音樂是許多不同的音階組成的,而每個音階對應著不同的頻率,這樣我們就可以利用不同的頻率的組合,即可構成我們所想要的音樂了,當然對于單片機來產生不同的頻率非常方便,我們可以利用單片機的定時/計數(shù)器來產生這樣方波頻率信號,因此,我們只要把一首歌曲的音階對應頻率關系弄正確即可。該電子琴可以實現(xiàn)兩個功能,用按鍵CS來選擇不同功能,第一種功能是用手動即通過按鍵的形式輸入不同音名,第二種功能是音樂發(fā)生器,可以自動重復播放兒童歌曲“種太陽”音樂。當CS為高電平1時,選擇功能二,當CS為低電平0時,選擇功能一。3.2簡易電子琴的工作流程圖3.3簡易電子琴中各模塊的設計系統(tǒng)部結構圖如圖3.1所示圖3.13.3.1分頻器fpq1模塊1.分頻器1的程序libraryieee;useieee.std_logic_1164.all;entityfpq1isport(clk12:instd_logic;clk1:bufferstd_logic);endfpq1;architecturebhvoffpq1isbeginprocess(clk12)variablecount:integerrange0to1200;beginifclk12'eventandclk12='1'thencount:二count+1;ifcount=1200thenclk1<=notclk1;count:=0;endif;endif;endprocess;endbhv;2.分頻器1的仿真圖3.3.2分頻器fpq2模塊程序分頻器2的程序libraryieee;useieee.std_logic_1164.all;entityfpq2isport(clk1:instd_logic;clk2:bufferstd_logic);endfpq2;architecturebhvoffpq2isbeginprocess(clk1)variablecount:integerrange0to500;beginifclk1'eventandclk1='1'thencount:二count+1;ifcount=500thenclk2<=notclk2;count:=0;endif;endif;endprocess;endbhv;分頻器2的仿真圖3.3.3琴/樂功能選擇器bmux模塊程序1.功能選擇器的程序libraryieee;useieee.std_logic_1164.all;entitybmuxisport(index1:instd_logic_vector(3downto0);index2:instd_logic_vector(3downto0);cs:instd_logic;toneindex:outstd_logic_vector(3downto0));end;architecturebhvofbmuxisbeginprocess(cs)begincasecsiswhen'0'=>toneindex<=index1;when'1'=>toneindex<=index2;whenothers=〉toneindex<=null;endcase;endprocess;endbhv;3.3.2樂曲自動演奏notetabs模塊程序libraryieee;useieee.std_logic_1164.all;entitynotetabsisport(clk:instd_logic;toneindex2:outstd_logic_vector(3downto0));endnotetabs;architectureoneofnotetabsissignalcounter:integerrange0to138;beginprocess(clk)beginifcounter=138thencounter<=0;elsifclk'eventandclk='1'thencounter<=counter+1;endif;endprocess;process(counter)begincasecounteriswhen00=>toneindex2<="0101";when01二〉toneindex2<="0110";when02=>toneindex2<="0101";when03=>toneindex2<="0101";when04=>toneindex2<="1011";when05=>toneindex2<="1011";when06=>toneindex2<="1001";when07=>toneindex2<="1001";when08=>toneindex2<="0101";when09=>toneindex2<="0110";when10=>toneindex2<="0101";when11=>toneindex2<="0101";when12=>toneindex2<="1011";when13=>toneindex2<="1011";when14=>toneindex2<="1001";when15=>toneindex2<="1001";when16=>toneindex2<="0011";when17=>toneindex2<="0100";when18=>toneindex2<="0101";when19=>toneindex2<="0101";when20=>toneindex2<="0101";when21=>toneindex2<="0101";when22=>toneindex2<="1001";when23=>toneindex2<="1001";when24=>toneindex2<="0101";when25=>toneindex2<="0101";when26=>toneindex2<="0111";when27=>toneindex2<="0110";when28=>toneindex2<="0110";when29=>toneindex2<="0110";when30=>toneindex2<="0000";when31=>toneindex2<="0000";when32=>toneindex2<="0100";when33=>toneindex2<="0100";when34=>toneindex2<="1010";when35=>toneindex2<="1010";when36=>toneindex2<="0111";when37=>toneindex2<="0111";when38=>toneindex2<="0010";when39=>toneindex2<="0011";when40=>toneindex2<="0100";when41=>toneindex2<="0100";when42=>toneindex2<="1001";when43=>toneindex2<="1001";when44=>toneindex2<="0111";when45=>toneindex2<="0111";when46=>toneindex2<="0111";when47=>toneindex2<="0110";when48=>toneindex2<="0101";when49=>toneindex2<="0101";when50=>toneindex2<="0110";when51=>toneindex2<="0111";when52=>toneindex2<="1001";when53=>toneindex2<="1001";when54=>toneindex2<="0101";when55=>toneindex2<="0110";when56=>toneindex2<="0101";when57=>toneindex2<="0100";when58=>toneindex2<="0011";when59=>toneindex2<="0011";
when60=>toneindex2<="0000";when61=>toneindex2<="0000";when62=>toneindex2<="0101";when63=>toneindex2<="0110";when64=>toneindex2<="0101";when65=>toneindex2<="0101";when66=>toneindex2<="1011";when67=>toneindex2<="1011";when68=>toneindex2<="1001";when69=>toneindex2<="1001";when70=>toneindex2<="0101";when71=>toneindex2<="0110";when72=>toneindex2<="0101";when73=>toneindex2<="0101";when74=>toneindex2<="1011";when75=>toneindex2<="1011";when76=>toneindex2<="1001";when77=>toneindex2<="1001";when78=>toneindex2<="0101";when79=>toneindex2<="0110";when80=>toneindex2<="0111";when81=>toneindex2<="0111";when82=>toneindex2<="0111";when83=>toneindex2<="0111";when84=>toneindex2<="1001";when85=>toneindex2<="1010";when86=>toneindex2<="1011";when87=>toneindex2<="1011";when88=>toneindex2<="1100";when89=>toneindex2<="1011";when90=>toneindex2<="1010";when91=>toneindex2<="1010";when92=>toneindex2<="0000";when93=>toneindex2<="0000";when94=>toneindex2<="0010";when95=>toneindex2<="0011";when96=>toneindex2<="0100";when97=>toneindex2<="0100";when98=>toneindex2<="1010";when99=>toneindex2<="1010";when100二〉toneindex2<="0111";when101=>toneindex2<=”0111”103=>toneindex2<=,,00H"when104二〉toneindex2<="0100";when105=>toneindex2<="0100"when106二〉toneindex2<="1010";when107=>toneindex2<="1010"whenwhenwhenwhenwhenwhenwhenwhenwhenwhen;when110=>toneindex2<="0111";when112=>toneindex2<="0101";when114二〉toneindex2<="0101";when116=>toneindex2<="0110";when118=>toneindex2<="0111";when120二〉toneindex2<="1010";when122101=>toneindex2<=”0111”103=>toneindex2<=,,00H"when104二〉toneindex2<="0100";when105=>toneindex2<="0100"when106二〉toneindex2<="1010";when107=>toneindex2<="1010"whenwhenwhenwhenwhenwhenwhenwhenwhenwhen;when110=>toneindex2<="0111";when112=>toneindex2<="0101";when114二〉toneindex2<="0101";when116=>toneindex2<="0110";when118=>toneindex2<="0111";when120二〉toneindex2<="1010";when122二〉toneindex2<="1010";when124二〉toneindex2<="1010";when126二〉toneindex2<="0101";when108=>toneindex2<=”0111”109=>toneindex2<=”0111”111=>toneindex2<=,,0110"113=>toneindex2<="010r,115=>toneindex2<="010r,117=>toneindex2<=,,0110"119=>toneindex2<="01ir,121=>toneindex2<="1010"123=>toneindex2<="1010"125=>toneindex2<="1010"127=>toneindex2<="010r'when130=>toneindex2<="0000";when131=>toneindex2<="0000";when132=>toneindex2<="0000";when133=>toneindex2<="0000";when134=>toneindex2<="0000";when135=>toneindex2<="0000";when136=>toneindex2<="0000";when137=>toneindex2<="0000";when138=>toneindex2<="0000";whenothers=〉null;endcase;endprocess;endone;3.3.3按鍵tone模塊程序libraryieee;useieee.std_logic_1164.all;entitytoneisport(key:instd_logic_vector(6downto0);toneindex1:outstd_logic_vector(3downto0));end;architectureoneoftoneisbeginsearch:process(key)begincasekeyiswhen"0000001"=>toneindex1<="0001";when"0000010"=>toneindex1<="0010";when"0000100"=>toneindex1<="0011";when"0001000"=>toneindex1<="0100";when"0010000"=>toneindex1<="0101";when"0100000"=>toneindex1<="0110";when"1000000"=>toneindex1<="0111";whenothers=〉toneindex1<="0000";endcase;endprocess;end;3.3.4tonetaba模塊程序libraryieee;useieee.std_logic_1164.all;entitytonetabaisport(index:instd_logic_vector(3downto0);code:outstd_logic_vector(3downto0);high:outstd_logic;tone:outstd_logic_vector(10downto0));end;architectureoneoftonetabaisbeginprocess(index)begincaseindexis--譯碼電路,查表方式,控制音調的預置數(shù)when"0000"=>tone<="";code<="0000";high<='0';--2047when "0001" => tone<="" ; code<="0001"; high <='0';--773;when "0010" => tone<="" ; code<="0010"; high <='0';--912;when "0011" => tone<="" ; code<="0011"; high <='0';--1036;when"0100"=>tone<="";code<="0100";high<='0';--1116;when "0101" => tone<="" ; code<="0101"; high <='0';--1197;when "0110" => tone<="" ; code<="0110"; high <='0';--1290;when "0111" => tone<="" ; code<="0111"; high <='0';--1372;when "1000" => tone<="" ; code<="0001"; high <='1';--1410;when "1001" => tone<="" ; code<="0010"; high <='1';--1480;when "1010" => tone<="" ; code<="0011"; high <='1';--1542;when "1100" => tone<="" ; code<="0101"; high <='1';--1622;when "1101" => tone<="" ; code<="0110"; high <='1';--1668;when "1111" => tone<="" ; code<="0001"; high <='1';--1728;whenothers=>null;endcase;endprocess;end;3.3.5speaker模塊程序:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityspeakeraisport(clk:instd_logic;tone:instd_logic_vector(10downto0);spk:outstd_logic);end;architectureoneofspeakeraissignalpreclk,fullspk:std_logic;beginprocess(clk)variablecount4:integerrange0to16;beginpreclk<='0';--將clk進行16分頻,preclk為clk的16分頻ifcount4=16thenpreclk<='1';count4:二0;elsifclk'eventandclk='1'thencount4:二count4+1;endif;endprocess;genspk:process(preclk,tone)--11位可預置計數(shù)器variablecount11:std_logic_vector(10downto0);beginifpreclk'eventandpreclk='1'thenifcount11=""thencount11:二tone;fullspk<='1';elsecount11:二count11+1;fullspk<='0';endif;endif;endprocess;process(fullspk)--將輸出再2分頻,展寬脈沖,使揚聲器有足夠功率發(fā)音variablecount2:std_logic;beginiffullspk'eventandfullspk='1'thencount2:二notcount2;ifcount2='1'thenspk<='1';elsespk<='0';endif;endif;endprocess;end;3.3.6頂層設計頂層keshe模塊程序libraryieee;useieee.std_logic_1164.all;entitykesheisport(clk12:instd_logic;key:instd_logic_vector(6downto0);cs:instd_logic;code1:outstd_logic_vector(3downto0);high1:outstd_logic;spkout:outstd_logic);end;architecturebhvofkesheiscomponenttoneport(key:instd_logic_vector(6downto0);toneindex1:outstd_logic_vector(3downto0));endcomponent;componentnotetabsport(clk:instd_logic;toneindex2:outstd_logic_vector(3downto0));endcomponent;componentbmuxport(index1:instd_logic_vector(3downto0);index2:instd_logic_vector(3downto0);cs:instd_logic;toneindex:outstd_logic_vector(3downto0));endcomponent;componenttonetabaport(index:instd_logic_vector(3downto0);code:outstd_logic_vector(3downto0);high:outstd_logic;tone:outstd_logic_vector(10downto0));endcomponent;componentspeakeraport(clk:instd_logic;tone:instd_logic_vector(10downto0));spk:outstd_logic);endcomponent;componentfpq1port(clk12:instd_logic;clk1:bufferstd_logic);endcomponent;componentfpq2port(clk1:instd_logic;clk2:bufferstd_logic);endcomponent;signaltoneindex1:std_logic_vector(3downto0);signaltoneindex2:std_logic_vector(3downto0);signaltoneindex:std_logic_vector(3downto0);signaltone1:std_logic_vector(10downto0);signalclk:std_logic;signalclk1:std_logic;beginu0:fpq1portmap(clk12,clk);u1:fpq2portmap(clk,clk1);u2:toneportmap(key,toneindex1);u3:notetabsportmap(clk1,toneindex2);u4:bmuxportmap(toneindex1,to
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 南大版一年級心理健康第14課《我愛你們》課件
- 7.2《走向未來》-課件- -2024-2025學年統(tǒng)編版道德與法治九年級下冊
- 2025屆太白縣四下數(shù)學期末達標檢測試題含解析
- 青島市李滄區(qū)2025年六年級下學期5月模擬預測數(shù)學試題含解析
- 武漢科技大學《能源法》2023-2024學年第二學期期末試卷
- 廣東工業(yè)大學《西方音樂史與名作欣賞Ⅱ》2023-2024學年第二學期期末試卷
- 云南機電職業(yè)技術學院《花鳥》2023-2024學年第二學期期末試卷
- 淘寶運營提成合同范本
- 高效解析藥物在人體內作用的光譜技術研究與應用趨勢
- 石家莊理工職業(yè)學院《化工原理2》2023-2024學年第二學期期末試卷
- 涉詐風險賬戶審查表
- 論完整的學習與核心素養(yǎng)的形成課件
- 新零售運營管理PPT完整全套教學課件
- (完整版)小學英語語法大全-附練習題,推薦文檔
- 注塑參數(shù)表完整版
- 初中英語中考總復習
- 學習弘揚楓橋精神與楓橋經(jīng)驗PPT楓橋經(jīng)驗蘊含的精神和內涵PPT課件(帶內容)
- ArcEngine二次開發(fā)入門介紹
- 山東大學出版社六年級上冊傳統(tǒng)文化第一單元寬仁厚愛備課教案
- 選煤廠工完料盡場地清制度
- 煤礦瓦斯防治八招及釋義
評論
0/150
提交評論