數(shù)字電路與邏輯設(shè)計(jì)實(shí)驗(yàn)報(bào)告-王云深.doc_第1頁(yè)
數(shù)字電路與邏輯設(shè)計(jì)實(shí)驗(yàn)報(bào)告-王云深.doc_第2頁(yè)
數(shù)字電路與邏輯設(shè)計(jì)實(shí)驗(yàn)報(bào)告-王云深.doc_第3頁(yè)
數(shù)字電路與邏輯設(shè)計(jì)實(shí)驗(yàn)報(bào)告-王云深.doc_第4頁(yè)
數(shù)字電路與邏輯設(shè)計(jì)實(shí)驗(yàn)報(bào)告-王云深.doc_第5頁(yè)
已閱讀5頁(yè),還剩7頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

數(shù)字電路與邏輯設(shè)計(jì)實(shí)驗(yàn)-4位簡(jiǎn)易密碼鎖 姓名:王云深學(xué)號(hào):10210889班級(jí):2011211209軟件簡(jiǎn)介:Quartus II 是Altera公司的綜合性PLD/FPGA開發(fā)軟件,支持原理圖、VHDL、VerilogHDL以及AHDL(Altera Hardware Description Language)等多種設(shè)計(jì)輸入形式,內(nèi)嵌自有的綜合器以及仿真器,可以完成從設(shè)計(jì)輸入到硬件配置的完整PLD設(shè)計(jì)流程。Quartus II可以在XP、Linux以及Unix上使用,除了可以使用Tcl腳本完成設(shè)計(jì)流程外,提供了完善的用戶圖形界面設(shè)計(jì)方式。具有運(yùn)行速度快,界面統(tǒng)一,功能集中,易學(xué)易用等特點(diǎn)。Quartus II支持Altera的IP核,包含了LPM/MegaFunction宏功能模塊庫(kù),使用戶可以充分利用成熟的模塊,簡(jiǎn)化了設(shè)計(jì)的復(fù)雜性、加快了設(shè)計(jì)速度。對(duì)第三方EDA工具的良好支持也使用戶可以在設(shè)計(jì)流程的各個(gè)階段使用熟悉的第三方EDA工具。此外,Quartus II 通過和DSP Builder工具與Matlab/Simulink相結(jié)合,可以方便地實(shí)現(xiàn)各種DSP應(yīng)用系統(tǒng);支持Altera的片上可編程系統(tǒng)(SOPC)開發(fā),集系統(tǒng)級(jí)設(shè)計(jì)、嵌入式軟件開發(fā)、可編程邏輯設(shè)計(jì)于一體,是一種綜合性的開發(fā)平臺(tái)。Maxplus II 作為Altera的上一代PLD設(shè)計(jì)軟件,由于其出色的易用性而得到了廣泛的應(yīng)用。目前Altera已經(jīng)停止了對(duì)Maxplus II 的更新支持,Quartus II 與之相比不僅僅是支持器件類型的豐富和圖形界面的改變。Altera在Quartus II 中包含了許多諸如SignalTap II、Chip Editor和RTL Viewer的設(shè)計(jì)輔助工具,集成了SOPC和HardCopy設(shè)計(jì)流程,并且繼承了Maxplus II 友好的圖形界面及簡(jiǎn)便的使用方法。實(shí)驗(yàn)?zāi)康模?設(shè)計(jì)并實(shí)現(xiàn)一個(gè)數(shù)字密碼鎖,密碼鎖有四位數(shù)字密碼和一個(gè)確認(rèn)開鎖按鍵,密碼輸入正確,密碼鎖打開,密碼輸入錯(cuò)誤進(jìn)行警示。實(shí)驗(yàn)要求:基本要求:1、密碼設(shè)置:通過鍵盤進(jìn)行4 位數(shù)字密碼設(shè)定輸入,在數(shù)碼管上顯示所輸入數(shù)字。通過密碼設(shè)置確定鍵(BTN 鍵)進(jìn)行鎖定。2、開鎖:在閉鎖狀態(tài)下,可以輸入密碼開鎖,且每輸入一位密碼,在數(shù)碼管上顯示“-”,提示已輸入密碼的位數(shù)。輸入四位核對(duì)密碼后,按“開鎖”鍵,若密碼正確則系統(tǒng)開鎖,若密碼錯(cuò)誤系統(tǒng)仍然處于閉鎖狀態(tài),并用蜂鳴器或led 閃爍報(bào)警。3、在開鎖狀態(tài)下,可以通過密碼復(fù)位鍵(BTN 鍵)來(lái)清除密碼,恢復(fù)初始密碼“0000”。閉鎖狀態(tài)下不能清除密碼。4、 用點(diǎn)陣顯示開鎖和閉鎖狀態(tài)。提高要求:1、輸入密碼數(shù)字由右向左依次顯示,即:每輸入一數(shù)字顯示在最右邊的數(shù)碼管上,同時(shí)將先前輸入的所有數(shù)字向左移動(dòng)一位。2、 密碼鎖的密碼位數(shù)(46 位)可調(diào)。3、自擬其它功能。 實(shí)驗(yàn)代碼:LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;ENTITY Lock ISPORT(clk_in:IN STD_LOGIC;rst :IN STD_LOGIC;keyboard_input:IN STD_LOGIC_VECTOR(3 DOWNTO 0);btn_input: IN STD_LOGIC;relock_input :IN STD_LOGIC;state_out: OUT STD_LOGIC_VECTOR(3 DOWNTO 0);number_shape : OUT STD_LOGIC_VECTOR(7 downto 0);number_location : OUT STD_LOGIC_VECTOR(5 downto 0);square_row : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);square_colG : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);square_colR : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);beep:OUT STD_LOGIC);END Lock;ARCHITECTURE a OF Lock ISsignal cnt_dis : integer range 0 to 100000;signal clk_tmp_dis : std_logic;signal clk_out_dis : std_logic;signal cnt_dis2 : integer range 0 to 750001;signal clk_tmp_dis2 : std_logic;signal clk_out_dis2 : std_logic;signal disp_cnt : integer range 0 to 9;signal square_cnt: integer range 0 to 9;signal keyboard_state : integer range 0 to 9;signal btn_state :std_logic;signal relock_state : std_logic;signal disp_num0 : integer range 0 to 11;signal disp_num1 : integer range 0 to 11;signal disp_num2 : integer range 0 to 11;signal disp_num3 : integer range 0 to 11;signal real_pwd0 : integer range 0 to 9;signal real_pwd1 : integer range 0 to 9;signal real_pwd2 : integer range 0 to 9;signal real_pwd3 : integer range 0 to 9;signal test_pwd0 : integer range 0 to 9;signal test_pwd1 : integer range 0 to 9;signal test_pwd2 : integer range 0 to 9;signal test_pwd3 : integer range 0 to 9;signal current_state : std_logic_vector(3 downto 0);signal next_state : std_logic_vector(3 downto 0);signal beep_buf : std_logic;signal is_locked : std_logic;signal is_beep : std_logic;BEGINPROCESS(clk_in,clk_tmp_dis)BEGINIF(clk_inevent and clk_in=1) THENIF cnt_dis= 35000 THEN -71429cnt_dis=0;clk_tmp_dis= NOT clk_tmp_dis;-beep_buf = NOT beep_buf;ELSE cnt_dis=cnt_dis+1;END IF;clk_out_dis = clk_tmp_dis;END IF;END PROCESS;PROCESS(clk_out_dis,clk_tmp_dis2)BEGINIF(clk_out_disevent and clk_out_dis=1) THENIF cnt_dis2= 75 THEN -250000cnt_dis2=0;clk_tmp_dis2= NOT clk_tmp_dis2;ELSE cnt_dis2=cnt_dis2+1;END IF;clk_out_dis2 CASE disp_num3 ISWHEN 0 = number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape = 00000000;END CASE;number_location CASE disp_num2 ISWHEN 0 = number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape = 00000000;END CASE;number_location CASE disp_num1 ISWHEN 0 = number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape = 00000000;END CASE;number_location CASE disp_num0 ISWHEN 0 = number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape number_shape = 00000000;END CASE;number_location number_shape = 00000000;number_location = 111111;END CASE;disp_cnt = disp_cnt + 1;IF (disp_cnt = 3) THENdisp_cnt = 0;END IF;END IF;END PROCESS;PROCESS(clk_out_dis2)-input scanBEGINIF (clk_out_dis2event and clk_out_dis2=1) THENbtn_state = btn_input;relock_state keyboard_state keyboard_state keyboard_state keyboard_state keyboard_state keyboard_state keyboard_state keyboard_state keyboard_state keyboard_state keyboard_state = 0;END CASE;END IF;END PROCESS;PROCESS(clk_out_dis2,rst)-state controlBEGINIF rst = 1 THENcurrent_state = 0000;ELSIF clk_out_dis2 = 1 AND clk_out_dis2event THENcurrent_state -0: Init/Resetreal_pwd3 = 0;real_pwd2 = 0;real_pwd1 = 0;real_pwd0 = 0;test_pwd3 = 0;test_pwd2 = 0;test_pwd1 = 0;test_pwd0 = 0;disp_num3 = 0;disp_num2 = 0;disp_num1 = 0;disp_num0 = 0;next_state = 0001;is_locked = 0;is_beep -1: Input real pwd X123disp_num3 = keyboard_state;real_pwd3 = keyboard_state;IF btn_state = 1 THENnext_state = 0010;ELSEnext_state -2: Input real pwd 0X23disp_num2 = keyboard_state;real_pwd2 = keyboard_state;IF btn_state = 1 THENnext_state = 0011;ELSEnext_state -3: Input real pwd 01X3disp_num1 = keyboard_state;real_pwd1 = keyboard_state;IF btn_state = 1 THENnext_state = 0100;ELSEnext_state -4: Input real pwd 012Xdisp_num0 = keyboard_state;real_pwd0 = keyboard_state;IF btn_state = 1 THENnext_state = 0101;ELSEnext_state -5: It is lockedis_beep = 0;is_locked = 1;disp_num3 = 11;disp_num2 = 11;disp_num1 = 11;disp_num0 = 11;next_state -6: Input test pwd X123disp_num3 = 10;test_pwd3 = keyboard_state;IF btn_state = 1 THENnext_state = 0111;ELSEnext_state -7: Input test pwd 0X23disp_num2 = 10;test_pwd2 = keyboard_state;IF btn_state = 1 THENnext_state = 1000;ELSEnext_state -8: Input test pwd 01X3disp_num1 = 10;test_pwd1 = keyboard_state;IF btn_state = 1 THENnext_state = 1001;ELSEnext_state -9: Input test pwd 012Xdisp_num0 = 10;test_pwd0 = keyboard_state;IF btn_state = 1 THENnext_state = 1010;ELSEnext_state -10:Determine whether test pwd is the real pwdIF real_pwd3 = test_pwd3 AND real_pwd2 = test_pwd2 AND real_pwd1 = test_pwd1 AND real_pwd0 = test_pwd0 THENnext_state = 1011;is_locked = 0;ELSEis_beep = 1;next_state IF btn_state = 1 THENnext_state = 0000;ELSIF relock_state = 1 THENnext_state next_state = 0000;END CASE;END IF;END PROCESS;PROCESS(current_state)BEGINstate_out = current_state;END PROCESS;PROCESS(clk_out_dis,is_beep)BEGINIF is_beep = 1 THENbeep = clk_out_dis;ELSEbeep square_colR = 01111110;square_row = 11111110;square_colG square_colR = 01111110;square_row = 11111101;square_colG square_colR = 01111110;square_row = 11111011;square_colG square_colR = 01111110;square_row = 11110111;square_colG square_colR = 00100100;square_row = 11101111;square_colG square_colR = 00100100;square_row = 11011111;square_colG square_colR = 00011000;square_row = 101111

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論