




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、 第三章第三章 硬件描述語言硬件描述語言VHDLVHDL) 第三部分第三部分 基本邏輯電路設計基本邏輯電路設計基本邏輯電路: 組合邏輯電路、 時序邏輯電路一 組合邏輯電路設計 簡單門電路、編碼器、譯碼器、 加法器、多路選擇器、三態門等。3.9 3.9 基本邏輯電路設計基本邏輯電路設計1、基本門電路2、編碼器 設計一個 8 輸入優先級編碼器,y0 級別最低,y7 級別最高;輸出為3位編碼。Y7=1Vec=111Y6=1Vec=110Y5=1Vec=101Y4=1Vec=100Y3=1Vec=011Y2=1Vec=010Y1=1Vec=001Y0=1Vec=000方法方法1 1:利用:利用 if
2、if 多選擇語句自頂向下的優先特性多選擇語句自頂向下的優先特性方法方法2 2:進程內為順序語句,最先描述優先級最低,:進程內為順序語句,最先描述優先級最低, 最后描述優先級最高,可實現優先級編碼。最后描述優先級最高,可實現優先級編碼。方法方法3 3:利用條件賦值語句:利用條件賦值語句 architecture behavior of architecture behavior of priority is priority is begin begin vec = “111” when y7 = vec = “111” when y7 = 1 else1 else “110” when “11
3、0” when y6 = 1 else y6 = 1 else “101” when “101” when y5 = 1 elsey5 = 1 else “100” when “100” when y4 = 1 else y4 = 1 else “011” when “011” when y3 = 1 elsey3 = 1 else “010” when “010” when y2 = 1 elsey2 = 1 else “001” when “001” when y1 = 1 elsey1 = 1 else “000” when “000” when y0 = 1 elsey0 = 1 el
4、se “XXX”; “XXX”; end behavior; end behavior;3、譯碼器 譯碼器是編碼器的逆過程。如 3-8 譯碼器:sel=000Y=00000001sel =001Y=00000010sel =010Y=00000100sel =011Y=00001000sel =100Y=00010000sel =101Y=00100000sel =110Y=01000000sel =111Y=10000000方法方法1 1:使用邏輯左移運算符:使用邏輯左移運算符 library ieee;library ieee; use ieee.std_logic_1164.all; u
5、se ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_unsigned.all; entity decoder is entity decoder is port(inp : in port(inp : in std_logic_vector(2 downto 0);std_logic_vector(2 downto 0); outp : out outp : out std_logic_vector(7 downto 0);std_logic_vector(7 downto 0); en
6、d decoder; end decoder; architecture rtl of decoder is architecture rtl of decoder is begin begin outp=“00000001” outp=“00000001” sll(conv_integer(inp);sll(conv_integer(inp); end rtl; end rtl;方法方法2 2:使用:使用processprocess語句語句 library ieee;library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_1
7、164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_unsigned.all; entity decoder is entity decoder is port(inp : in std_logic_vector(2 port(inp : in std_logic_vector(2 downto 0);downto 0); outp : out outp : out std_logic_vector(7 downto 0);std_logic_vector(7 downto 0); end decoder; end deco
8、der; architecture rtl of decoder is architecture rtl of decoder is begin begin process(inp) process(inp) begin begin outp0); outp0); outp(conv_integer(inp)=1;outp(conv_integer(inp)=1; end process; end process; end rtl; end rtl;方法方法3 3:使用:使用 case case 語句實現。語句實現。譯碼輸出低有效方法方法4 4:使用條件賦值語句:使用條件賦值語句3-8譯碼器仿
9、真結果:譯碼輸出低有效4、多路選擇器 前面用 if 語句、case 語句、條件賦值語句、選擇賦值語句分別描述過4選1選擇器。5、三態門及總線緩沖器 VHDL語言通過指定大寫的Z值表示高阻狀態 a : std_logic; a_bus:std_logic_vector(7 downto 0); 指定高阻狀態如下: a = Z ; a_bus = “ZZZZZZZZ” ;1三態門電路描述三態門仿真結果:2單向總線緩沖器DOUT7.0ENDIN7.0ENTRI_BUF8DOUT7.0DIN7.03雙向總線緩沖器B7.0ENDIRA7.0B7.0A7.0DIRENBIDIR二 時序邏輯電路設計 觸發器
10、、寄存器、計數器、分頻器、信號發生器等。一時序電路特殊信號的描述 時鐘信號和復位信號 1、時鐘信號描述 常用的描述方式: 1進程的敏感信號是時鐘信號,在進程內 部用if 語句描述時鐘的邊沿條件。如: process (clock_signal) begin if (clock_edge_condition) then signal_out = signal_in ; 其它時序語句 end if ; end process ; 2在進程中用wait until語句描述時鐘信號,此 時進程將沒有敏感信號。 如: process begin wait until (clock_edge_condit
11、ion); signal_out = signal_in ; 其它時序語句 end process ; 注意: a.在對時鐘邊沿說明時,一定要注明是上升沿 還是下降沿。 b.一個進程中只能描述一個時鐘信號。 c.wait until 語句只能放在進程的最前面或 最后面。3時鐘邊沿的描述 時鐘上升沿: (clockevent and clock = 1) 時鐘下降沿: (clockevent and clock = 0) 2、觸發器的復位信號描述 1同步復位:在只有以時鐘為敏感信號的進程 中定義。 如: process (clock_signal) begin if (clock_edge_co
12、ndition) then if (reset_condition) then signal_out = reset_value; else signal_out = signal_in ; end if ; end if ; end process ; 2異步復位:進程的敏感信號表中除時鐘信 號外,還有復位信號。 如:process (reset_signal, clock_signal) begin if (reset_condition) then signal_out = reset_value; elsif (clock_edge_condition) then signal_out
13、 = signal_in ; end if ; end process ; 二) 常用時序電路設計 1、觸發器Flip_Flop) 1D觸發器異步置位/復位D觸發器同步復位D觸發器比較:異步置位的鎖存器Latch) library ieee; use ieee.std_logic_1164.all; entity t_ff is port(t, clk : in std_logic; q : buffer std_logic); end t_ff; architecture rtl of t_ff is begin process(clk) begin if clkevent and clk=
14、1 then if t=1 then q=not q; else q=q; end if; end process; end rtl;TClkQQ2T觸發器 library ieee; use ieee.std_logic_1164.all; entity rs_ff is port(r, s, clk : in std_logic; q, qn : buffer std_logic); end rs_ff; architecture rtl of rs_ff is begin process(r, s, clk) begin if clkevent and clk=1 then if s =
15、 1 and r = 0 then q=0; qn=1; elsif s=0 and r=1 then q=1; qn=0; elsif s=0 and r=0 then q=q; qn=q n; else null; end if; end if; end process; end rtl;SClkQQRSRQQn00QQn01101001113RS觸發器2、寄存器 8位串行輸入、串行輸出移位寄存器:z0z1z2z3z4z5z6z7z88位移位寄存器描述結構描述)移位寄存器仿真結果:3、計數器 計數器分為:同步計數器 異步計數器(1同步計數器 同步計數器指在時鐘脈沖計數脈沖的控 制下,構成計數器的各觸發器狀態同時發生變化 的計數器。帶允許端的十二進制計數器可逆計數器加減計數器)可逆計數器仿真結果:例:六十進制分、秒計數器60進制計數器仿真結果:(2異步計數器 異步計數器又稱為行波計數器,它的低位計數器的輸出作為高位計數器的時鐘信號。 異步計數器采用行波計數,使計數延遲增加,計數器工作頻率較低。 描述異步計數器與同步計數器的不同主要體現在對各級時鐘脈沖的描述上。例:由8個觸發器構成的行波計數器: 基本元件 dff
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 達成結對幫扶協議書
- 20以內三個數加減混合運算綜合測驗試題帶答案
- 信托基礎知識培訓
- 智能時代下的創新創業實踐
- 禮儀培訓:優雅儀態
- 幼兒托育服務與管理
- 高黏稠綜合征的健康宣教
- 保安培訓8個步驟
- 房產項目知識培訓
- 廣西興業縣2023-2024學年中考數學考試模擬沖刺卷含解析
- 借用品牌合同范本
- 噴灑除草劑安全協議書(2篇)
- LTE-V2X系統性能要求及測試規范
- 2025年北森題庫測試題及答案
- 中國大唐集團有限公司陸上風電工程標桿造價指標(2023年)
- 2025年美容師初級技能水平測試卷:美容師美容護膚實操技能試題匯編
- 茶館里的政治:揭秘《茶館》背后的歷史
- 跨學科實踐活動5探究土壤酸堿性對植物生長的影響教學設計-2024-2025學年九年級化學魯教版下冊
- 國望液晶數顯切紙機安全操作規程
- 《國際跳棋教學》課件
- 病歷的書寫基本規范培訓講座課件
評論
0/150
提交評論