基本組合和時序電路描述_第1頁
基本組合和時序電路描述_第2頁
基本組合和時序電路描述_第3頁
基本組合和時序電路描述_第4頁
基本組合和時序電路描述_第5頁
已閱讀5頁,還剩58頁未讀 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、1基本邏輯電路: 組合邏輯電路、 時序邏輯電路一 組合邏輯電路設計 簡單門電路、編碼器、譯碼器、 加法器、多路選擇器、三態(tài)門等。 基本邏輯電路設計21、基本門電路32、編碼器 設計一個 8 輸入優(yōu)先級編碼器,y0 級別最低,y7 級別最高;輸出為3位編碼。Y7=1Vec=111Y6=1Vec=110Y5=1Vec=101Y4=1Vec=100Y3=1Vec=011Y2=1Vec=010Y1=1Vec=001Y0=1Vec=0004方法方法1 1:利用 if 多選擇語句自頂向下的優(yōu)先特性5方法方法2 2:利用條件賦值語句:利用條件賦值語句 architecture behavior of pri

2、ority is begin vec = “111” when y7 = 1 else “110” when y6 = 1 else “101” when y5 = 1 else “100” when y4 = 1 else “011” when y3 = 1 else “010” when y2 = 1 else “001” when y1 = 1 else “000” when y0 = 1 else “XXX”; end behavior;63、譯碼器 譯碼器是編碼器的逆過程。如 3-8 譯碼器:sel=000Y=00000001sel =001Y=00000010sel =010Y=0

3、0000100sel =011Y=00001000sel =100Y=00010000sel =101Y=00100000sel =110Y=01000000sel =111Y=100000007方法方法1 1:使用邏輯左移運算符:使用邏輯左移運算符 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity decoder is port(inp : in std_logic_vector(2 downto 0); outp : out std_logic_vector(7 downto

4、 0); end decoder; architecture rtl of decoder is begin outp=“00000001” sll(conv_integer(inp); end rtl;8方法方法2 2:使用:使用processprocess語句語句 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity decoder is port(inp : in std_logic_vector(2 downto 0); outp : out std_logic_vector

5、(7 downto 0); end decoder; architecture rtl of decoder is begin process(inp) begin outp0); outp(conv_integer(inp)=1; end process; end rtl;9方法方法3 3:使用:使用 case case 語句實現(xiàn)。語句實現(xiàn)。10譯碼輸出低有效11方法方法4 4:使用條件賦值語句:使用條件賦值語句123-8譯碼器仿真結果:譯碼輸出低有效134、加法器 帶進位的 4位加法器符號如下:Sum(i) = a(i) b(i) cinC(i+1) = a(i) b(i) +(a(i)

6、+ b(i) ) c(i) 14方法1:用for loop語句實現(xiàn) 15方法2:直接使用加法“+”函數(shù):16加法器仿真結果:175、多路選擇器 前面用 if 語句、case 語句、條件賦值語句、選擇賦值語句分別描述過4選1選擇器。6、三態(tài)門及總線緩沖器 VHDL語言通過指定大寫的Z值表示高阻狀態(tài) a : std_logic; a_bus:std_logic_vector(7 downto 0); 指定高阻狀態(tài)如下: a = Z ; a_bus = “ZZZZZZZZ” ;181)三態(tài)門電路描述19三態(tài)門仿真結果:202)單向總線緩沖器213)雙向總線緩沖器22二 時序邏輯電路設計 觸發(fā)器、寄存

7、器、計數(shù)器、分頻器、信號發(fā)生器等。一)時序電路特殊信號的描述 時鐘信號和復位信號 1、時鐘信號描述 常用的描述方式: 1)進程的敏感信號是時鐘信號,在進程內(nèi) 部用if 語句描述時鐘的邊沿條件。23如: process (clock_signal) begin if (clock_edge_condition) then signal_out = signal_in ; 其它時序語句 end if ; end process ; 242)在進程中用wait until語句描述時鐘信號,此 時進程將沒有敏感信號。 如: process begin wait until (clock_edge_co

8、ndition); signal_out = signal_in ; 其它時序語句 end process ; 25 注意: a.在對時鐘邊沿說明時,一定要注明是上升沿 還是下降沿。 b.一個進程中只能描述一個時鐘信號。 c.wait until 語句只能放在進程的最前面或 最后面。3)時鐘邊沿的描述 時鐘上升沿: (clockevent and clock = 1clockevent and clock = 1) 時鐘下降沿: (clockevent and clock = 0clockevent and clock = 0) 262、觸發(fā)器的復位信號描述 1)同步復位:在只有以時鐘為敏感信

9、號的進程 中定義。 如: process (clock_signal) begin if (clock_edge_condition) then if (reset_condition) then signal_out = reset_value; else signal_out = signal_in ; end if ; end if ; end process ; 27 2)異步復位:進程的敏感信號表中除時鐘信 號外,還有復位信號。 如:process (reset_signal, clock_signal) begin if (reset_condition) then signal_

10、out = reset_value; elsif (clock_edge_condition) then signal_out = signal_in ; end if ; end process ; 28二) 常用時序電路設計 1、觸發(fā)器(Flip_Flop) 1)D觸發(fā)器29異步置位/復位D觸發(fā)器30同步復位D觸發(fā)器31比較:異步置位的鎖存器(Latch)32 library ieee; use ieee.std_logic_1164.all; entity t_ff is port(t, clk : in std_logic; q : buffer std_logic); end t_f

11、f; architecture rtl of t_ff is begin process(clk) begin if clkevent and clk=1 then if t=1 then q=not q; else q=q; end if; end process; end rtl;TClkQQ2)T觸發(fā)器33 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

12、rtl of rs_ff is begin process(r, s, clk) begin if clk event and clk=1 then if s = 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;SClkQQRSRQQn00QQn01101001113)RS觸發(fā)器342、寄存器 8位串行輸入、串行輸出移位寄存器:z0z1z2z3z4z5z

13、6z7z8358位移位寄存器描述(結構描述)368位移位寄存器直接用信號連接描述37移位寄存器仿真結果:383、計數(shù)器 計數(shù)器分為:同步計數(shù)器 異步計數(shù)器(1)同步計數(shù)器 同步計數(shù)器指在時鐘脈沖(計數(shù)脈沖)的控 制下,構成計數(shù)器的各觸發(fā)器狀態(tài)同時發(fā)生變化 的計數(shù)器。39帶允許端的十二進制計數(shù)器40可逆計數(shù)器(加減計數(shù)器)41可逆計數(shù)器仿真結果:42例:六十進制(分、秒)計數(shù)器434460進制計數(shù)器仿真結果:45(2)異步計數(shù)器 異步計數(shù)器又稱為行波計數(shù)器,它的低位計數(shù)器的輸出作為高位計數(shù)器的時鐘信號。 異步計數(shù)器采用行波計數(shù),使計數(shù)延遲增加,計數(shù)器工作頻率較低。 描述異步計數(shù)器與同步計數(shù)器的不同主

溫馨提示

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

評論

0/150

提交評論