電子設(shè)計自動化實驗指導(dǎo)書_第1頁
電子設(shè)計自動化實驗指導(dǎo)書_第2頁
電子設(shè)計自動化實驗指導(dǎo)書_第3頁
電子設(shè)計自動化實驗指導(dǎo)書_第4頁
電子設(shè)計自動化實驗指導(dǎo)書_第5頁
已閱讀5頁,還剩21頁未讀 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、江蘇科技大學(xué)電子信息學(xué)院 電子設(shè)計自動化實驗指導(dǎo)書目 錄實驗一:vhdl組合邏輯電路設(shè)計3實驗二:vhdl時序邏輯電路設(shè)計10實驗三:vhdl下狀態(tài)機電路設(shè)計12實驗四:簡易數(shù)字頻率計設(shè)計14實驗五:交通燈信號控制器設(shè)計17實驗六:電子密碼鎖19實驗一:vhdl組合邏輯電路設(shè)計一、實驗?zāi)康?、熟悉quartusii軟件的使用,熟練進行程序輸入、綜合、仿真。2、熟悉實驗箱硬件資源的使用,熟練進行引腳鎖定和硬件測試,掌握eda技術(shù)設(shè)計流程,掌握數(shù)字邏輯電路設(shè)計的方法;3、學(xué)習(xí)簡單數(shù)字邏輯電路的設(shè)計、仿真和硬件測試。二、實驗內(nèi)容1、設(shè)計四選一多路選擇器,利用quartusii軟件完成程序輸入、綜合和

2、仿真驗證,給出仿真波形并進行結(jié)果分析。2、利用gw48 eda實驗系統(tǒng)完成硬件測試,驗證本項目設(shè)計的功能,記錄引腳設(shè)置和測試結(jié)果。三、實驗原理、方法和手段多路選擇器可以從多組數(shù)據(jù)源中選取一組送入目的地,應(yīng)用相當廣泛,從組合邏輯的執(zhí)行到數(shù)據(jù)路徑的選擇,經(jīng)??梢钥吹剿嫩櫽啊6嗦愤x擇器的結(jié)構(gòu)是個輸入數(shù)據(jù)對應(yīng)n個數(shù)據(jù)輸出選擇控制線和一個輸出線。在vhdl中描述一個多路選擇器的方法有多種,例如:在一個進程中使用if-then-else語句;在一個進程中使用case語句;使用選擇信號帶入語句或條件信號代入語句(when-else語句)。推薦使用when-else語句,如:library ieee;use

3、 ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity mux41 is port (data0, data1, data2, data3: in std-logic_vector (3 downto 0); a, b: in std_logic; y: out std-logic_vector (3 downto 0)end entity mux41 architecture art of mux41 issignal sel: std_logic_vector (1 downto 0);begin sel=b&a;y0

4、) ; -計數(shù) 器異步復(fù)位 elsif clkevent and clk=1 then -檢測時鐘上升沿if en = 1 then -檢測是否允許計數(shù)(同步使能) if cqi 0); -大于9, 計數(shù)值清零 end if; end if; end if; if cqi = 9 then cout = 1; -計數(shù)大于9,輸出進位信號 else cout = 0; end if; cq = cqi; -將計數(shù)值向端口輸出 end process;end behav; 兩位十進制計數(shù)器可由2個十進制計數(shù)器級聯(lián)構(gòu)成,個位計數(shù)器的進位輸出信號作為十位計數(shù)器的時鐘驅(qū)動信號即可。數(shù)字時鐘實際上是對一個

5、標準1hz秒脈沖信號進行計數(shù)的計數(shù)器,秒計數(shù)器滿60后向分計數(shù)器進位,分計數(shù)器滿60后向時計數(shù)器進位,時計數(shù)器按24進制計數(shù)器規(guī)律計數(shù),各計數(shù)器的數(shù)值經(jīng)譯碼器送led顯示。提示:分別設(shè)計帶清零和時鐘控制的2個模60計數(shù)器和1個模24計數(shù)器,按照串行進位的關(guān)系連接即可實現(xiàn)一個簡易的數(shù)字時鐘;五、實驗條件1、提供一臺具有windows 2000/xp操作系統(tǒng)的計算機;2、提供quartusii軟件開發(fā)環(huán)境。六、實驗步驟 操作步驟參見實驗一,這里不在詳述。七、思考題 60/24進制的2位數(shù)十進制計數(shù)器除了用2個一位數(shù)十進制計數(shù)器串接實現(xiàn)之外,怎樣用其他方法實現(xiàn)?八、實驗報告撰寫要求1、撰寫實驗預(yù)習(xí)報

6、告,包含實驗?zāi)康?、實驗?nèi)容,并根據(jù)實驗內(nèi)容撰寫相關(guān)的實驗原理和實驗程序;完成思考題。以備實驗前檢查。2、記錄仿真波形,完成仿真結(jié)果的詳細分析。3、整理硬件測試記錄,驗證本項目的功能。4、撰寫實驗心得,簡述在實驗過程中出現(xiàn)的問題,是何原因以及如何解決的。實驗三:vhdl下狀態(tài)機電路設(shè)計一、實驗?zāi)康?、進一步熟悉序列檢測器的原理;2、學(xué)習(xí)用狀態(tài)機實現(xiàn)序列檢測器的設(shè)計,掌握一般狀態(tài)機的設(shè)計與應(yīng)用;3、進一步熟悉quartusii的使用,掌握多層次電路的設(shè)計、仿真和硬件測試。二、實驗內(nèi)容 1、設(shè)計一個序列檢測器,檢測“11100101”序列,給出設(shè)計方案(包括狀態(tài)圖)和源程序,完成軟件仿真和硬件測試。

7、2、 利用實驗系統(tǒng)中adc0809芯片,用狀態(tài)機方式實現(xiàn)數(shù)據(jù)采集。library ieee ;use ieee.std_logic_1164.all;entity schk is port(din,clk,clr : in std_logic; -串行輸入數(shù)據(jù)位/工作時鐘/復(fù)位信號 ab : out std_logic_vector(3 downto 0); -檢測結(jié)果輸出end schk;architecture behav of schk is signal q : integer range 0 to 8 ; signal d : std_logic_vector(7 downto 0)

8、; -8位待檢測預(yù)置數(shù)(密碼=e5h)begin d = 11100101 ; -8位待檢測預(yù)置數(shù) process( clk, clr ) begin if clr = 1 then q if din = d(7) then q = 1 ; else q if din = d(6) then q = 2 ; else q if din = d(5) then q = 3 ; else q if din = d(4) then q = 4 ; else q if din = d(3) then q = 5 ; else q if din = d(2) then q = 6 ; else q if

9、 din = d(1) then q = 7 ; else q if din = d(0) then q = 8 ; else q q = 0 ; end case ; end if ; end process ; process( q ) -檢測結(jié)果判斷輸出 begin if q = 8 then ab = 1010 ; -序列數(shù)檢測正確,輸出 “a” else ab mr=0;my=0; mg=1;br=1;by=0;bg=0;if(sb and sm)=1thenif s=45 then state=b;clr:=0;en:=0;else state=a;clr:=1;en:=1;end

10、 if;elsif(sb and (not sm)=1then state=b;clr:=0;en:=0;else statemr=0;my=1;mg=0;br=1;by=0;bg=0;if s=5 then state=c;clr:=0;en:=0;else statemr=1;my=0;mg=0; br=0;by=0;bg=1;if(sm and sb)=1thenif s=25 then state=d;clr:=0;en:=0;else state=c;clr:=1;en:=1;end if;elsif sb=0then state=d;clr:=0;en:=0;else statem

11、r=1;my=0; mg=0;br=0;by=1;bg=0;if s=5 then state=a;clr:=0;en:=0;else state=d;clr:=1;en:=1;end if;end case;end if;end process cnt;end architecture art;5s計時器程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt05s isport(clk, en05m, en05b: in std_logic; dout5: out std_lo

12、gic_vector(7 downto 0);end entity cnt05s;architecture art of cnt05s issignal cnt3b: std_logic_vector(2 downto 0);beginprocess(clk,en05m,en05b) isbeginif(clkevent and clk=1)thenif en05m=1 or en05b=1 thencnt3b=cnt3b+1;elsecnt3bdout5dout5dout5dout5dout5dout5=00000000;end case;end process;end architectu

13、re art;45s計時器程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt45s isport(sb,clk,en45:in std_logic; dout45m,dout45b: out std_logic_vector(7 downto 0);end entity cnt45s;architecture art of cnt45s issignal cnt6b: std_logic_vector(5 downto 0);beginprocess(sb, clk, en4

14、5)isbeginif sb=0 then cnt6b=cnt6b-cnt6b-1;elsif(clkevent and clk=1)thenif en45=1then cnt6b=cnt6b+1;elsif en45=0then cnt6bdout45m=01000101;dout45bdout45m=01000100;dout45bdout45m=01000011;dout45bdout45m=01000010;dout45bdout45m=01000001;dout45bdout45m=01000000;dout45bdout45m=00111001;dout45bdout45m=001

15、11000;dout45bdout45m=00110111;dout45bdout45m=00110110;dout45bdout45m=00110101;dout45bdout45m=00110100;dout45bdout45m=00110011;dout45bdout45m=00110010;dout45bdout45m=00110001;dout45bdout45m=00110000;dout45bdout45m=00101001;dout45bdout45m=00101000;dout45bdout45m=00100111;dout45bdout45m=00100110;dout45

16、bdout45m=00100101;dout45bdout45m=00100100;dout45bdout45m=00100011;dout45bdout45m=00100010;dout45bdout45m=00100001;dout45bdout45m=00100000;dout45bdout45m=00011001;dout45bdout45m=00011000;dout45bdout45m=00010111;dout45bdout45m=00010110;dout45bdout45m=00010101;dout45bdout45m=00010100;dout45bdout45m=000

17、10011;dout45bdout45m=00010010;dout45bdout45m=00010001;dout45bdout45m=00010000;dout45bdout45m=00001001;dout45bdout45m=00001000;dout45bdout45m=00000111;dout45bdout45m=00000110;dout45bdout45m=00000101;dout45bdout45m=00000100;dout45bdout45m=00000011;dout45bdout45m=00000010;dout45bdout45m=00000001;dout45

18、bdout45m=00000000;dout45b=00000000;end case;end process;end architecture art;60s計時器程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt25s isport(sb,sm,clk,en25: in std_logic; dout25m,dout25b: out std_logic_vector(7 downto 0);end entity cnt25s;architecture art of cnt

19、25s issignal cnt5b: std_logic_vector(4 downto 0);beginprocess(sb,sm,clk,en25) isbeginif sb=0 or sm=0 thencnt5b=cnt5b-cnt5b-1;elsif(clkevent and clk=1)thenif en25=1thencnt5b=cnt5b+1;elsif en25=0thencnt5bdout25b=00100101;dout25mdout25b=00100100;dout25mdout25b=00100011;dout25mdout25b=00100010;dout25mdo

20、ut25b=00100001;dout25mdout25b=00100000;dout25mdout25b=00011001;dout25mdout25b=00011000;dout25mdout25b=00010111;dout25mdout25b=00010110;dout25mdout25b=00010101;dout25mdout25b=00010100;dout25mdout25b=00010011;dout25mdout25b=00010010;dout25mdout25b=00010001;dout25mdout25b=00010000;dout25mdout25b=000010

21、01;dout25mdout25b=00001000;dout25mdout25b=00000111;dout25mdout25b=00000110;dout25mdout25b=00000101;dout25mdout25b=00000100;dout25mdout25b=00000011;dout25mdout25b=00000010;dout25mdout25b=00000001;dout25mdout25b=00000000;dout25m=00000000;end case;end process;end architecture art;顯示控制library ieee;use i

22、eee.std_logic_1164.all;use ieee.std_logic_1164.all;entity xskz isport(en45,en25,en05m,en05b: in std_logic; ain45m,ain45b:in std_logic_vector(7 downto 0); ain25m,ain25b,ain05: in std_logic_vector(7 downto 0); doutm,doutb: out std_logic_vector(7 downto 0);end entity xskz;architecture art of xskz isbeg

23、inprocess(en45,en25,en05m,en05b,ain45m,ain45b,ain25m,ain25b,ain05)isbeginif en45=1thendoutm=ain45m(7 downto 0);doutb=ain45b(7 downto 0);elsif en05m=1thendoutm=ain05(7 downto 0);doutb=ain05(7 downto 0);elsif en25=1thendoutm=ain25m(7 downto 0);doutb=ain25b(7 downto 0);elsif en05b=1thendoutm=ain05(7 do

24、wnto 0);doutb=ain05(7 downto 0);end if;end process;end architecture art;實驗一,這里不在詳述。七、思考題 采用狀態(tài)碼直接輸出型狀態(tài)機,應(yīng)該怎樣實現(xiàn)?寫出實現(xiàn)方案。八、實驗報告1、撰寫實驗預(yù)習(xí)報告,包含實驗?zāi)康摹嶒瀮?nèi)容,并根據(jù)實驗內(nèi)容撰寫相關(guān)的實驗原理和實驗程序;完成思考題。以備實驗前檢查。2、記錄仿真波形,完成仿真結(jié)果的詳細分析。3、整理硬件測試記錄,驗證本項目的功能。實驗四:簡易數(shù)字頻率計設(shè)計一、實驗?zāi)康?、熟悉簡易頻率計的工作原理;2、學(xué)習(xí)頻率計的分析、設(shè)計方法,學(xué)習(xí)較復(fù)雜系統(tǒng)的eda設(shè)計方法;3、進一步掌握多層次電

25、路的設(shè)計、仿真和硬件測試。二、實驗內(nèi)容1、設(shè)計一個2位頻率計,對待測信號的頻率(099hz)進行測量、顯示,給出設(shè)計方案,并進行仿真和硬件測試,驗證設(shè)計方案的功能。library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity mult2 is port(clk : in std_logic; ma : in std_logic_vector(11 downto 0); mc : out std_logic_vector(23 downto

26、0);end mult2;architecture rtl of mult2 is signal ta : std_logic_vector(11 downto 0); constant tb : std_logic_vector(11 downto 0) := 100110111001;beginprocess(clk) begin if(clkevent and clk = 1) then ta=ma; mc=ta * tb; end if;end process;end rtl; 三、實驗原理、方法和手段頻率計是能夠測量和顯示信號頻率的電路。常用的直接測頻法有兩種,一種是測周期法,一種是

27、測頻率法。測周期法是在待測信號一個周期內(nèi),記錄基準系統(tǒng)時鐘頻率的周期數(shù)。測頻率法是在一定時間間隔內(nèi)測量待測信號的周期數(shù)。一般對于低頻信號采用測周期法,對于高頻信號采用測頻率法。本實驗采用測頻率法來設(shè)計2位頻率計,在指定的1s時間間隔內(nèi)(下圖中cnt_en1持續(xù)時間為1s),用2位十進制計數(shù)器對待測信號進行計數(shù),測得的周期數(shù)為n,則待測信號的頻率就為n/1s即n hz,再通過顯示電路顯示出數(shù)值n。所以方案中需要設(shè)計帶時鐘使能的2位十進制計數(shù)器、七段顯示譯碼器。此外還需要一個時序控制電路,產(chǎn)生復(fù)位計數(shù)鎖存周期循環(huán)的工作時序(如下圖)。 頻率計的設(shè)計原理圖可參看下圖,主要有時序控制電路、計數(shù)主電路、

28、鎖存電路和譯碼顯示電路。五、實驗條件1、提供一臺具有windows 2000/xp操作系統(tǒng)的計算機;2、提供quartusii軟件開發(fā)環(huán)境。六、實驗步驟 在quartusii軟件開發(fā)環(huán)境中使用原理圖輸入法,除了最初的編輯輸入與vhdl文本法不同外,其他步驟都一樣。1、建立工程文件夾,如f:adder2、編輯原理圖輸入1)選擇file | new,在對話框中選擇device design files頁中的 block diagram/schematic file,ok即可。2)在編輯窗口任意位置右擊鼠標,在出現(xiàn)的快捷菜單中選擇insert| symbol。3)單擊按鈕“.”,找到基本元件庫d:altera72quartuslibraries primitiveslogic項,選中需要的元件,此元件將顯示在窗口中,單擊ok按鈕就可將元件調(diào)入原理圖編輯器中。分別調(diào)入所有元件,連線,完成原理圖設(shè)計。4) 保存,file| save as,選擇前面的文件夾f:adder,保存為*.bdf。3、設(shè)置成可調(diào)用元件為了頂層設(shè)計,可以將當前設(shè)計變成一個元件符號,選擇菜單file| create/update| create symbol files

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論