【文章內(nèi)容簡介】
case a is when 00 = p1=c。 當(dāng) a 為 0 時,將 c 的值賦給 p1。 when 01 = p2=c。 當(dāng) a 為 1 時,將 c 的值賦給 p2。 when 10 = p3=c。 當(dāng) a 為 2 時,將 c 的值賦給 p3。 when 11 = p4=c。 當(dāng) a 為 3 時,將 c 的值賦給 p4。 end case。 end if。 end process t1。 t2: process(b,esc) begin if esc=39。039。 then 當(dāng) esc 為低電平時, a 賦值為 11。 a=11。 elsif b39。event and b=39。139。 then a=a+1。 當(dāng) b 為高電平時, a 為 a+1。 end if。 end process t2。 end behave。 當(dāng)按下鍵盤時, a 為高電平,鍵盤輸入一個值,此時輸入的值存儲在 c 中,當(dāng) b 為低電平時,根據(jù) a 對應(yīng)的取值,給對應(yīng)的 p 賦值。 基于 VHDL 的密碼鎖設(shè)計 12 主控制 模塊 程序 LIBRARY IEEE。 USE 。 USE 。 USE 。 ENTITY xia IS PORT( vc,m,enter,esc: IN STD_LOGIC。 m 為密碼鎖修改控制鍵,高電平有效 。 key: IN STD_LOGIC_VECTOR(15 DOWNTO 0)。 l: buffer STD_LOGIC l 為輸出控制鍵,高電平有效,為高電平時,密碼鎖打開 。 )。 END ENTITY xia。 ARCHITECTURE behave OF xia IS SIGNAL keyin:STD_LOGIC_VECTOR(15 DOWNTO 0)。 16 位二進(jìn)制密碼輸入 。 BEGIN process (enter,esc,vc) begin if (vc=39。139。) then keyin=1000011100110000。 當(dāng) vc 為 1 時,初始密碼為8730。 elsif (esc=39。039。) THEN l=39。039。 當(dāng) esc 為低電平時, l 為 0。 elsif (enter39。event and enter=39。139。 and m=39。139。 and l=39。139。 ) then keyin=key。 當(dāng) m 為 1 時,修改密碼 。 elsif (enter39。event and enter=39。139。 and m=39。039。 and l=39。039。) then if key=keyin then 當(dāng) m 為 0 時,判定輸入密碼 。 l=39。139。 else l=39。039。 end if。 end if。 end process。 end behave。 當(dāng) vc 為 1 時,初始密碼為 8730,此時若輸入密碼正確,打開密碼鎖,此時 l 為 m 為 1 時,此時為修改密碼狀態(tài),此時可以輸入新的密碼,按 esc 鍵退出,密碼設(shè)置結(jié)束。 基于 VHDL 的密碼鎖設(shè)計 13 第四章 密碼鎖的仿真結(jié)果 密碼判斷仿真結(jié)果 圖 41 密碼鎖判斷仿真結(jié)果 如圖 41 所示,初始密碼為 8730,開始密碼輸入為 0000,密碼鎖沒有打開, l 為 0。當(dāng) m 為 1 時,因為密碼鎖沒有打開,所以即使密碼鎖修改鍵為高電平,此時無法修改密碼。當(dāng) esc 為低電平時,此時從新輸入, m 為 0,為輸入驗證階 段,此時輸入為 8730,與初始密碼一致,密碼鎖打開, l 為 1. 密碼修改判斷仿真結(jié)果 圖 42 密碼鎖修改判斷仿真結(jié)果 基于 VHDL 的密碼鎖設(shè)計 14 如圖 42 所示,初始密碼設(shè)為 0000,當(dāng) enter 為 1 時,此時輸入為初始密碼狀態(tài),密碼鎖打開, l 為 1。當(dāng) m 為 1 時,此時修改密碼,將密碼設(shè)為 8739,然后按 esc 退出鍵。 若在輸入密碼 8739,則密碼鎖打開, l 為 1. 基于 VHDL 的密碼鎖設(shè)計 15 第五章 總結(jié) 畢業(yè)設(shè)計馬上就要結(jié)束了,意味著大學(xué)生涯的結(jié)束。在做畢業(yè)設(shè)計的過程中讓我學(xué)到了很多東西,也知道自己 遠(yuǎn)遠(yuǎn)不夠好。還差的很多。在這幾個月的學(xué)習(xí)中,讓我又重新學(xué)習(xí)了一邊 VHDL 語言,也才知道自己之前學(xué)的有多差。通過這次學(xué)習(xí)讓我更進(jìn)一步的了解 VHDL 語言,我相信這些對我的以后的學(xué)習(xí)和工作都會起到很大的幫助。 本論文通過 VHDL 語言實現(xiàn)了數(shù)字密碼鎖的設(shè)計,該密碼鎖雖然是有 鍵盤 輸入的,但是可以實現(xiàn)密碼位數(shù)的自設(shè)定。本程序的重點(diǎn)就在與密碼的比較。通過與自設(shè)定的密碼相比較,看正確與否。 致謝 行文至此,我的畢業(yè)設(shè)計就要結(jié)束了,我的大學(xué)生涯也快畫上句號了。在此次畢業(yè)設(shè)計的撰寫能夠順利結(jié)束,要特別感謝那些幫助過我 的人,要謝謝我的導(dǎo)師,本學(xué)位論文是在我的導(dǎo)師的細(xì)心指導(dǎo)下完成的,從選題到論文的最終定稿,都離不開導(dǎo)師的指導(dǎo);也要謝謝我的同學(xué),在我遇到難題時給我?guī)椭? 基于 VHDL 的密碼鎖設(shè)計 16 參考文獻(xiàn) [1]劉昌華 . 數(shù)字邏輯 EDA 設(shè)計與實踐: MAX+plus Ⅱ與 Quartus Ⅱ雙劍合壁 ,國防工業(yè)出版社, 2020:115 [2]侯伯 亨 、 顧新 、 劉凱 .VHDL 硬件描述語言與數(shù)字邏輯電路設(shè)計 .第 3 版 ,西安電子科技大學(xué)出版社, 2020:2225 [3] 楊剛 、 龍海燕 .現(xiàn)代電子技術(shù) :VHDL 與數(shù)字系統(tǒng)設(shè)計,電子工業(yè)出版社, 2020:1213 [4] 劉欲曉 、 方強(qiáng) 、 黃婉寧 .EDA 技術(shù)與 VHDL 電路開發(fā)應(yīng)用實踐 電子工業(yè)出版社,2020:112114 [5] 鄭燕 、 郝建國 、 黨建華 .基于 VHDL 語言與 Quartus Ⅱ軟件的可編程邏輯器件應(yīng)用與開發(fā) , 2020:98100 [6] (美 ) Kevin VHDL 設(shè)計技術(shù),東南大學(xué)出版社,1998:100115 [7]王振紅 .VHDL 數(shù)字電路設(shè)計與應(yīng)用實踐教程,機(jī)械工業(yè)出版社, 2020:2326 [8]張亦華 、 延明 .數(shù)字電路 EDA 入門 :VHDL 程序?qū)嵗?,北京郵電大學(xué)出版社,2020:5760 [9]劉明業(yè) .集成電路 /計算機(jī)硬件描述語 言 VHDL高等教程 ,清華大學(xué)出版社, 2020:7698 [10]姜波 、 郭宏 .EDA 技術(shù)及應(yīng)用,哈爾濱工業(yè)大學(xué)出版社, 2020:3235 [11] James R. Armstrong、 F. Gail Gray. VHDL design representation and synthesis , China Machine Press,2020:0120 [12] Douglas L. :programming by example , McGrawHill, 112 [13] 王道憲 、 賀名臣 、 劉偉 .VHDL 電路設(shè)計技術(shù) , 國防工業(yè)出版社 2020: 2334 [14] 張?zhí)?、 寧改娣 、 劉和平 .DSP 技術(shù)與應(yīng)用 , 機(jī)械工業(yè)出版社 ,2020: 112 基于 VHDL 的密碼鎖設(shè)計 17 附錄 1 英文參考資料 To introduce digital circuit definition digital circuit: With the pletion of the digital signal for digital arithmetic and logic operations of puting circuits known as digital circuits, or digital systems. Because of its logic operations and processing logic, therefore, also known as digital logic circuits. Classification of digital logic circuits (according to the functions of points): the bination of logic Referred to as the bination of circuit, which isthe most basic logic gate bination. Characterized by: the output value and only then enter the value, that is, the only output from the input value at the time the decision. No memory circuit, with the input output status of a state of change, similar to the resistance of the circuit, such as the adder, decoder, encoder, data selector and so on, belong to this category. sequential logic circuits Referred to as the timing circuit, which is the most basic logic gates together with the logic of the feedback loop (output to the input) device or a bination of the circuit, with the bination of the na