電子科技電子設(shè)計(jì)及自動(dòng)第四講_第1頁
電子科技電子設(shè)計(jì)及自動(dòng)第四講_第2頁
電子科技電子設(shè)計(jì)及自動(dòng)第四講_第3頁
電子科技電子設(shè)計(jì)及自動(dòng)第四講_第4頁
電子科技電子設(shè)計(jì)及自動(dòng)第四講_第5頁
已閱讀5頁,還剩30頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

1、電子科技電子設(shè)計(jì)及自動(dòng)第四講第1頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四本章要點(diǎn) *VHDL描述語句集合的全貌建立一個(gè)清晰的概念; *對(duì)VHDL主要描述語句的作用有一個(gè)正確的認(rèn)識(shí); *建立VHDL是一種并行語言的基本概念;第2頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四VHDL主要描述語句分類VHDL的主要描述語句種類繁多,為了便于學(xué)習(xí)和理解,我們將VHDL的主要描述語句劃分為:“描述功能的語句”和“描述結(jié)構(gòu)的語句”兩大部分,如圖所示 這兩大部分分別由若干語句組成第3頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四VHDL描述語句功能描述語句(Foun

2、ction)結(jié)構(gòu)描述語句(Structure)并行賦值語句(Concurrent Assign)進(jìn)程語句(Process)斷言語句(Assert)塊語句(Block)子程序(Subprogram)元件語句(Component)端口映射語句(Port Map)生成語句(Generate)參數(shù)說明語句(Generic)等待語句(Wait)順序賦值語句(Sequent Assign)順序控制語句(Sequent Control)IFCASELOOPFORWHILE函數(shù)(Function)過程(Procedure)最常用語句第4頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四VHDL主要描述

3、語句分類在本章中將對(duì)圖中所列出的所有語句逐一進(jìn)行具體介紹。如果把每一種語句比喻成一顆樹,則上圖給出了這些樹所構(gòu)成的森林的面目。由圖中可以獲得以下信息: 1.VHDL的主要描述語句由“描述功能的語句”和“描述結(jié)構(gòu)的語句”兩個(gè)部分組成 2.描述功能的語句主要有:信號(hào)賦值語句,進(jìn)程語句,斷言語句,子程序等;第5頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四VHDL主要描述語句分類 3.描述結(jié)構(gòu)的語句主要有:component (元件),port map(端口映射),generate(生成語句),generic(參數(shù)說明語句)等; 4. 在所有VHDL語句中,描述功能的進(jìn)程語句最為復(fù)雜。它

4、可以包含等待語句、順序信號(hào)賦值語句和順序控制語句等三部分,其中,順序控制語句又可以包含條件語句和循環(huán)語句等5種語句。第6頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四VHDL主要描述語句分類 5. 信號(hào)的賦值可分為:進(jìn)程中賦值和進(jìn)程外賦值兩種。進(jìn)程中賦值使用順序信號(hào)賦值語句。進(jìn)程外賦值使用并行信號(hào)賦值語句。 6. if和case語句是進(jìn)程語句中實(shí)現(xiàn)順序控制的最常用語句。 第7頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四VHDL主要描述語句分類另外,在此需要指出兩點(diǎn):1. 行為級(jí)描述的VHDL程序一般不會(huì)用到描述結(jié)構(gòu)的語句。2.然而除行為級(jí)描述外,RTL級(jí)和結(jié)構(gòu)級(jí)描述都

5、大量使用描述功能的語句。通常情況下VHDL程序都要用到描述功能的語句。電子系統(tǒng)中的行為主要體現(xiàn)在信號(hào)的變化,組合和傳輸,所以一般VHDL程序都會(huì)用到描述功能的語句。所以學(xué)習(xí)的重點(diǎn)是描述功能的語句。第8頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四描述功能的語句信號(hào)賦值語句(Assignment)進(jìn)程語句(Process)斷言語句(Assert)塊語句(Block)子程序(Subprogram)第9頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四對(duì)象的賦值VHDL程序中數(shù)值的載體稱為對(duì)象(object)。VHDL中有四種對(duì)象:常量(constant)、變量(variable

6、)信號(hào)(signal)和文件(file)。對(duì)象賦值是電子系統(tǒng)的功能行為賦值語句是描述功能的語句第10頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四VHDL描述語句行為描述語句(Behaviour)結(jié)構(gòu)描述語句(Structure)并行賦值語句(Concurrent Assign)進(jìn)程語句(Process)斷言語句(Assert)塊語句(Block)子程序(Subprogram)元件語句(Component)端口映射語句(Port Map)生成語句(Generate)參數(shù)說明語句(Generic)等待語句(Wait)順序賦值語句(Sequent Assign)順序控制語句(Seque

7、nt Control)IFCASELOOPFORWHILE函數(shù)(Function)過程(Procedure)最常用語句第11頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四賦值符 =( )=( );1,右邊信號(hào)的值傳送給左邊的信號(hào);2,左右兩邊信號(hào)寬度必須一致;第12頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四Concurrent Assignment StatementAll the Concurrent Statement is executed in parallelConcurrent Statement does not care the position w

8、ithin the codingConcurrent Statement is : OUTPUT depends on INPUT only第13頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四Entity test1 IsPort ( a, b : in std_logic; c, d : out std_logic);end test1;architecture test1_a of test1 isbeginc = a and b;d = a or b;end test1_a;Entity test1 IsPort ( a, b : in std_logic; c, d : o

9、ut std_logic);end test1;architecture test1_a of test1 isbegind = a or b;c = a and b;end test1_a;This two excutein parallelDoes not care the position within the coding并行賦值語句(Concurrent Assignment Statement)并行賦值語句與語句出現(xiàn)的先后順序無關(guān)。如下例給出的兩條語句交換順序前后等價(jià)。第14頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四C = ABD = A+Bequivalentc

10、= a and b;d = a or b;d = a or b;c = a and b;01010000100100001111兩條語句交換順序前后的仿真波形完全相同,如下圖:分析真值得:并行賦值語句(Concurrent Assignment Statement)第15頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四Concurrent StatementsforCombinational Logic第16頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四Concurrent StatementsThere are several different kinds of Co

11、ncurrent Statements(1) Simple Signal Assignments (簡單信號(hào)賦值)(2) Conditional Signal Assignments (條件信號(hào)賦值)(3) Selected Signal Assignments (選擇信號(hào)賦值)第17頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四Putting them all together第18頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四(1) Simple Signal Assignment This kind of statements are executed in Pa

12、rallelEntity test1 isport ( a, b, e : in std_logic; c, d : out std_logic);end test1;architecture test1_body of test1 isbegin c = a and b; d = e;end test1_body;第19頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四What kind of logic supportANDNANDORNORXORNOTmore .第20頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四We want 5 Inputs AND-GateQ

13、:AND is only a two input, if I want more inputs, what can I do ?A : It is easy, we are due with Language not GraphicEntity test1 isport ( a, b, c, d, e : in std_logic; f : out bit);end test1;architecture test1_body of test1 isbegin f = a AND b AND c AND d AND e;end test1_body;第21頁,共35頁,2022年,5月20日,2

14、0點(diǎn)19分,星期四(2) Conditional Signal AssignmentsThe output get the value when the condition is truee.g. 2 to 1 multiplexerEntity test1 isport (in1, in2, sel : in std_logic; d : out std_logic);end test1;architecture test1_body of test1 isbegind = in1 WHEN sel = 0 ELSE in2;end test1_body;第22頁,共35頁,2022年,5月

15、20日,20點(diǎn)19分,星期四If we want more - 4 to 1 MuxOnce again, you are due with Language not Graphic, so it is easyEntity test1 isport (in1, in2, in3, in4 : in std_logic; sel1, sel2 : in std_logic; d : out std_logic);end test1;architecture test1_body of test1 isbegind = in1 WHEN sel1 = 0 and sel2 = 0 ELSE in

16、2 WHEN sel1 = 0 and sel2 = 1 ELSE in3 WHEN sel1 = 1 and sel2 = 0 ELSE in4;end test1_body;第23頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四(3) Select Signal AssignmentsThe output get value when matching with the selected itemEntity test1 isport (a, b: in bit; sel : in bit; c : out bit);end test1;architecture test1_bo

17、dy of test1 isbeginWITH sel SELECT c = a WHEN 1, -逗號(hào) b WHEN 0; -分號(hào)end test1_body;第24頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四If I want more choice -It is easyEntity test1 isport (in1, in2, in3, in4 : in bit; sel : in integer; out1 : out bit);end test1;architecture test1_body of test1 isbeginwith sel select out1

18、 = in1 when 0 , in2 when 1 , in3 when 2 , in4 when 3 ;end test1_body;第25頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四ReviewConcurrent Statement forcombinational logic (without Flip-flop circuit)eg. decoder, multiplexer, multiplier, adderUnderstand the usage of the Concurrent Statementfor Combinational Logic simple

19、signal assignment statementconditional signal assignment statementselected signal assignment statement第26頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四作 業(yè)Entity MUX_8 isport (data_in: in std_logic_vector(7 downto 0); sel1, sel2, sel3 : in std_logic; d : out std_logic);end test1;提示:d=data_in(5);第27頁,共35頁,2022年,5月20日,

20、20點(diǎn)19分,星期四作 業(yè)xyZq1q20000000110101000111101011111提示:信號(hào)賦固定值 q1=0;q2=1;1第28頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四VHDL描述語句行為描述語句(Behaviour)結(jié)構(gòu)描述語句(Structure)并行賦值語句(Concurrent Assign)進(jìn)程語句(Process)斷言語句(Assert)塊語句(Block)子程序(Subprogram)元件語句(Component)端口映射語句(Port Map)生成語句(Generate)參數(shù)說明語句(Generic)等待語句(Wait)順序賦值語句(Seque

21、nt Assign)順序控制語句(Sequent Control)IFCASELOOPFORWHILE函數(shù)(Function)過程(Procedure)最常用語句第29頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四PROCESS語句一般格式 進(jìn)程標(biāo)號(hào):PROCESS (敏感信號(hào)表)IS說明; BEGIN順序語句 ;END PROCESS ;PROCESS是進(jìn)程語句的標(biāo)示符,PROCESS前可以加進(jìn)程標(biāo)號(hào),也可以沒有標(biāo)號(hào)。進(jìn)程內(nèi)部說明部分用于定義本進(jìn)程所需的局部數(shù)據(jù)環(huán)境,在這里可以說明數(shù)據(jù)類型、子程序和變量,在此說明區(qū)說明的變量,僅在當(dāng)前進(jìn)程內(nèi)可對(duì)其進(jìn)行讀/寫。BEGIN以后的順序語

22、句為進(jìn)程的執(zhí)行語句部分。 第30頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四Process StatementAll the Process Statement is executed in parallel (進(jìn)程與進(jìn)程之間并行)Within the Process Statement, the coding is execute in sequential (進(jìn)程內(nèi)部語句之間串行順序執(zhí)行)Process Statement: OUTPUT depends on INPUT with Sensitivity List to control the event happen第31

23、頁,共35頁,2022年,5月20日,20點(diǎn)19分,星期四Entity test1 isPort ( clk, d1, d2 : in std_logic; q1, q2 : out std_logic);end test1;architecture test1_body of test1 isbeginProcess (clk, d2)begin if (clkevent and clk = 1) then q2 = d2; end if;end process;Process (clk, d1)begin if (clkevent and clk= 1) then q1 = d1; end

24、 if;end process;end test1_body;This two processes execute in parallelEntity test1 isPort ( clk, d1, d2 : in std_logic; q1, q2 : out std_logic);end test1;architecture test1_body of test1 isbeginProcess (clk, d1)begin if (clkevent and clk = 1) then q1 = d1; end if;end process;Process (clk, d2)begin if (clkevent and clk= 1) then q2 = d2; end if;end

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(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)論