EDA信號與變量課件_第1頁
EDA信號與變量課件_第2頁
EDA信號與變量課件_第3頁
EDA信號與變量課件_第4頁
EDA信號與變量課件_第5頁
已閱讀5頁,還剩17頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

信號與變量區(qū)別&聯系1非靜態(tài)與靜態(tài)數據對象非靜態(tài)數據處理 signal,variable靜態(tài)數據處理 constant,generic常量和信號是全局的,用于順序代碼及并行代碼變量是局部的,只用于順序代碼(process,function,procedure)且值不能直接向外傳遞。2常量常量可以在包集、實體或結構中聲明。包集—調用包集的所有實體使用實體—對該實體的所有結構體可用結構—僅在結構體中使用3信號代表邏輯電路的“硬”連線,用作輸入/出端口、內部連接所有端口默認為信號定義的地方同常量當信號用在順序描述語句(如process)內部,其值不立刻更新,信號值是在相應的進程、函數或過程完成后才進行更新對同一個信號進行多重賦值:編譯器可能給出警告并退出綜合過程或僅認為最后一次賦值是有效的。(MaxplusII給出警告)4計數向量中‘1’的個數信號不立即更新變量立即更新5libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;entitycount_onesisport(din:instd_logic_vector(7downto0); ones:outintegerrange0to8);endcount_ones;architecturenot_okofcount_onesis signaltemp:integerrange0to8;begin process(din) begin temp<=0; foriin0to7loop if(din(i)='1')then temp<=temp+1; endif; endloop; ones<=temp; endprocess; endarchitecturenot_ok;6process(clk,clr) variablecount2:integerrange0to7; begin if(clr='1')then count1<=0; count2:=0; out1<='0'; out2<='0'; else if(clk'eventandclk='1')then count1<=count1+1; count2:=count2+1; if(count1=???)then out1<=notout1; count1<=0; endif; if(count2=???)then out2<=notout2; count2:=0; endif; endif; endif; endprocess;endBehavioral;9Cnt1:sigCnt2:var2,22,34,410觸發(fā)器設計libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;entitydffisport(d,clk:instd_logic; q:bufferstd_logic; qbar:outstd_logic);enddff;architecturenot_okofdffisbegin process(clk) begin if(clk'eventandclk='1')then q<=d; --進程結束后才生效 qbar<=notq;--進程結束后才生效,q的值此時還沒更新! endif; endprocess;endarchitecturenot_ok;11qbar延遲了一個周期12改進的設計libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;entitydffisport(d,clk:instd_logic; q:bufferstd_logic; qbar:outstd_logic);enddff;architectureokofdffisbegin process(clk) begin if(clk'eventandclk='1')then q<=d; endif; endprocess; qbar<=notq;endarchitectureok;13qbar賦值與進程并發(fā),q變化,qbar立即更新14寄存器數量一個信號的賦值是以另一個信號的跳變?yōu)闂l件時(即發(fā)生同步賦值時),編譯后產生寄存器。(process、function、procedure中)如果一個變量在還沒有進行賦值操作時已被使用,那么綜合后就好產生寄存器。一個變量在一個信號跳變時賦值,并且該值最終又被賦給了另外的信號,則綜合后會產生寄存器。如果變量的值沒有被進程(函數或過程)以外的代碼調用,那么不一定產生寄存器。151617libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;entitydffisport(d,clk:instd_logic; q:bufferstd_logic; qbar:outstd_logic);enddff;architecturenot_okofdffisbegin process(clk) begin if(clk'eventandclk='1')then q<=d; --進程結束后才生效 qbar<=notq;--進程結束后才生效,q的值此時還沒更新! endif; endprocess;endarchitecturenot_ok;18改進的設計libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;entitydffisport(d,clk:instd_logic; q:bufferstd_logic; qbar:outstd_logic);enddff;architectureokofdffisbegin process(clk) begin if(clk'eventandclk='1')then q<=d; endif; endprocess; qbar<=notq;endarchitectureok;19移位寄存器entityshiftisport( din,clk:inbit; dout:outbit);endshift;architectureshiftofshiftisbegin process(clk) variablea,b,c:bit; begin if(clk'eventandclk='1')then dout<=c; c:=b; b:=a; a:=din; endif; endprocess;endarchitectureshift;20entityshiftisport( din,clk:inbit; dout:outbit);endshift;architectureshiftofshiftisbegin process(clk) variablea,b,c:bit; begin if(clk'eventandclk='1')then a:=din; b:=a; c:=b; dout<=c;

endif; endprocess;endarchitectureshift;21entityshiftisport( din,clk:inbit; dout:outbit);endshift;architectureshiftofshif

溫馨提示

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

評論

0/150

提交評論