EDA課程設(shè)計(jì)報(bào)告正弦波信號(hào)發(fā)生器的設(shè)計(jì)_第1頁
EDA課程設(shè)計(jì)報(bào)告正弦波信號(hào)發(fā)生器的設(shè)計(jì)_第2頁
EDA課程設(shè)計(jì)報(bào)告正弦波信號(hào)發(fā)生器的設(shè)計(jì)_第3頁
EDA課程設(shè)計(jì)報(bào)告正弦波信號(hào)發(fā)生器的設(shè)計(jì)_第4頁
EDA課程設(shè)計(jì)報(bào)告正弦波信號(hào)發(fā)生器的設(shè)計(jì)_第5頁
已閱讀5頁,還剩13頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、eda課程設(shè)計(jì)報(bào)告 正弦波信號(hào)發(fā)生器的設(shè)計(jì)一、設(shè)計(jì)目的 通過本次課程設(shè)計(jì),進(jìn)一步了解quartus 與lpm_rom與fpga硬件功能的使用方法。培養(yǎng)自己查閱資料及解決問題的能力。二、設(shè)計(jì)要求1、 通過按鍵,可以控制輸出的是正弦波或三角波。2、 通過adc0832輸出正弦波與三角波,電壓v范圍在0至-10v之間3、 通過示波器觀察波形。三、設(shè)計(jì)內(nèi)容: 在quartusii上完成信號(hào)發(fā)生器的設(shè)計(jì)。最后在實(shí)驗(yàn)板上實(shí)測,包括fpga中rom的在系統(tǒng)數(shù)據(jù)讀寫測試和利用示波器測試。信號(hào)輸出的d/a使用實(shí)驗(yàn)板上的adc0832。四、 設(shè)計(jì)原理: 圖1所示的波信號(hào)發(fā)生器的結(jié)構(gòu)由五部分組成:1、計(jì)數(shù)器或地址發(fā)

2、生器(這里選擇8位)。正弦信號(hào)數(shù)據(jù)rom(8位地址線,8位數(shù)據(jù)線),含有256個(gè)8位數(shù)據(jù)(一個(gè)周期)。2、vhdl頂層設(shè)計(jì)。3、8位d/a圖1所示的信號(hào)發(fā)生器結(jié)構(gòu)圖中,頂層文件adc.vhd在fpga中實(shí)現(xiàn),包含兩個(gè)部分:rom的地址信號(hào)發(fā)生器,由8位計(jì)數(shù)器擔(dān)任;一個(gè)正弦數(shù)據(jù)rom(或者一個(gè)三角波數(shù)據(jù)rom),由lpm_rom模塊構(gòu)成。地址發(fā)生器的時(shí)鐘clk的輸入頻率fo與每周期的波形數(shù)據(jù)點(diǎn)數(shù)(在此選擇256點(diǎn)),以及d/a輸出的頻率f的關(guān)系是:f=fo/256 vhdl頂層設(shè)計(jì)adc.vhd 正弦波數(shù)據(jù)存儲(chǔ)rom1 20分頻8位計(jì)數(shù)器(地址發(fā)生器)8位d/a按鍵3三角波數(shù)據(jù)存儲(chǔ)rom2 圖1

3、 正弦信號(hào)發(fā)生器結(jié)構(gòu)框圖 圖一 信號(hào)發(fā)生器結(jié)構(gòu)圖 圖2 信號(hào)發(fā)生器的設(shè)計(jì)圖五、 設(shè)計(jì)步驟:1、 建立.mif格式文件mif文件可用c語言程序生成,產(chǎn)生正弦波數(shù)值的c程序如下:#include#includemain()int i;float s;for(i=0;i256;i+)s=sin(atan(1)*8*i/256);printf(%d :%d;n,i,(int)(s+1)*255/2)以zx.c保存。產(chǎn)生三角波數(shù)值的c程序如下:#include#includemain()int i;float s;for(i=0;i zx.mif;sj sj.mif;將生成的*.mif 文件,再加上.m

4、if文件的頭部說明即可。.mif文件的頭部說明如下所示:width=8;depth=256;address_radix=dec;data_radix=dec;content begin(數(shù)據(jù)略去)end;2、 在設(shè)計(jì)信號(hào)發(fā)生器前,必須首先完成存放波形數(shù)據(jù)rom的設(shè)計(jì)。設(shè)計(jì)步驟如下:1) 打開quartus 。在files菜單中選擇new產(chǎn)生一個(gè)對(duì)話框,選擇block diagram/schematic file 項(xiàng),會(huì)生成一個(gè)*.bdf文件,雙擊文件空白處,跳出symbol窗口,在改窗口下選擇megafunctionsstoragelpm_rom。2) 在跳出的 megawizard plug

5、-in manager中選 擇vhdl,路徑保存在d:chengxv中3) 在parameter settings 窗口中,選擇currently selected device family :cyclone.選擇rom控制線、地址線和數(shù)據(jù)線。在彈出的對(duì)話框中選擇地址線位寬和rom中數(shù)據(jù)數(shù)分別為8和64;選擇地址鎖存控制信號(hào)dual clock。在對(duì)話框的“what should the ram”欄選擇默認(rèn)的auto。4) 單擊next,將此界面數(shù)據(jù)如圖設(shè)置5) 單擊next按鈕,選擇browse,選擇利用c做成的mif文件,將此模塊命名為rom0,再單擊finish 按鈕后完成rom0定制

6、。6) 打開此文件可以看到其中調(diào)用初始化數(shù)據(jù)文件的語句為:init_file = .mif。最后生成的rom0元件文件如源代碼1所示. 六、 源代碼:1)、源代碼1如下所示:library ieee;use ieee.std_logic_1164.all;library altera_mf;use altera_mf.all;entity rom0 isport(address: in std_logic_vector (5 downto 0);inclock: in std_logic ;q: out std_logic_vector (7 downto 0);end rom0;archit

7、ecture syn of rom0 issignal sub_wire0: std_logic_vector (7 downto 0);component altsyncramgeneric (address_aclr_a: string;init_file: string;intended_device_family: string;lpm_hint: string;lpm_type: string;numwords_a: natural;operation_mode: string;outdata_aclr_a: string;outdata_reg_a: string;widthad_

8、a: natural;width_a: natural;width_byteena_a: natural);port (clock0: in std_logic ;address_a: in std_logic_vector (5 downto 0);q_a: out std_logic_vector (7 downto 0);end component;beginq none,init_file = ././ad.mif,intended_device_family = cyclone,lpm_hint = enable_runtime_mod=no,lpm_type = altsyncra

9、m,numwords_a = 64,operation_mode = rom,outdata_aclr_a = none,outdata_reg_a = unregistered,widthad_a = 6,width_a = 8,width_byteena_a = 1)port map (clock0 = inclock,address_a = address,q_a = sub_wire0);end syn;2)、頂層設(shè)計(jì)代碼:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity ad

10、c isport ( clk:in std_logic;dout:out std_logic_vector(7 downto 0);key:in std_logic);end ;architecture dacc of adc is component rom0 port(address: in std_logic_vector(7 downto 0); inclock: in std_logic;q: out std_logic_vector(7 downto 0) ) ; end component; component rom1 port(address: in std_logic_ve

11、ctor(7 downto 0); inclock: in std_logic;q: out std_logic_vector(7 downto 0) ) ; end component; signal clk1:std_logic;signal q0:std_logic_vector(3 downto 0);signal q1:std_logic_vector(7 downto 0);signal q2:std_logic_vector(7 downto 0);signal q3:std_logic_vector(7 downto 0);beginprocess(clk)beginif cl

12、kevent and clk=1 then if q00110 then q0=q0+1;else q0=0000;clk1= not clk1;end if;end if;end process;process(clk1)beginif clk1event and clk1=1 then q1q1,q=q2,inclock=clk);u1:rom0 port map(address=q1,q=q3,inclock=clk);process(key)beginif key=1 then dout=q2;else dout=q3; end if; end process;end ;3)為此頂層設(shè)

13、計(jì)創(chuàng)建一項(xiàng)工程,工程名和實(shí)體名都是adc。4)全程編譯一次后進(jìn)入時(shí)序仿真測試。由波形可見,隨著每一個(gè)時(shí)鐘上升沿的到來,輸出端口將正弦波數(shù)據(jù)依次輸出。 5)硬件測試。選擇電路模式5,則時(shí)鐘clk接實(shí)驗(yàn)箱的clock0 。將dout(0)dout(7)分別鎖定于實(shí)驗(yàn)系統(tǒng)上與dac0832相接的i/o口:pio24、pio25、pio26、pio27、pio28、pio29、pio30、pio31。編譯下載adc.sof后,打開電壓開關(guān),將clk的時(shí)鐘通過實(shí)驗(yàn)箱上clock0的跳線選擇頻率為12mhz,再將示波器接于實(shí)驗(yàn)箱的兩個(gè)掛鉤上就能觀察波形的輸出情況了。七、 仿真波形圖:八、 引腳鎖定:九、 設(shè)計(jì)結(jié)果:clock0=12mhz,輸出頻率為:f=47kh

溫馨提示

  • 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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論