大規模數字集成電路設計第二章VHDL語言序的基本結構_第1頁
大規模數字集成電路設計第二章VHDL語言序的基本結構_第2頁
大規模數字集成電路設計第二章VHDL語言序的基本結構_第3頁
大規模數字集成電路設計第二章VHDL語言序的基本結構_第4頁
大規模數字集成電路設計第二章VHDL語言序的基本結構_第5頁
已閱讀5頁,還剩35頁未讀 繼續免費閱讀

下載本文檔

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

文檔簡介

1、大規模數字集成電路設計大規模數字集成電路設計第二章第二章vhdlvhdl語言程序的基本結構語言程序的基本結構本章要點本章要點 vhdlvhdl程序的宏觀結構;程序的宏觀結構; 實體的基本格式及其在實體的基本格式及其在vhdlvhdl硬件設計硬件設計中的應用中的應用 構造體的基本格式及其在構造體的基本格式及其在vhdlvhdl硬件設硬件設計中的基本功能計中的基本功能 庫的實用意義及使用方法。庫的實用意義及使用方法。 2.1 vhdl程序組成部分及其功能程序組成部分及其功能vhdlvhdl程序程序實體(實體(entityentity)構造體(構造體(architecturearchitecture

2、)配置(配置(configurationconfiguration)包集合(包集合(packagepackage)庫(庫(librarylibrary)設計共享部分設計共享部分需編寫的部分需編寫的部分vhdl描述的總體結構描述的總體結構2.1 vhdl程序組成部分及其功能程序組成部分及其功能vhdlvhdl程序程序實體(實體(entityentity)構造體(構造體(architecturearchitecture)配置(配置(configurationconfiguration)包集合(包集合(packagepackage)庫(庫(librarylibrary)基本設計單元基本設計單元所必需

3、的部分所必需的部分實體實體-規定設計單元的輸入規定設計單元的輸入輸出接口信號和引腳輸出接口信號和引腳構造體構造體-定義設計單元的具體定義設計單元的具體構造或功能(行為)構造或功能(行為) 2.2 2.2 實體實體實體說明的結構實體說明的結構entity 實體名 is【類屬參數說明】;【端口說明】;end 實體名;2.2 2.2 實體說明實體說明 端口說明端口說明1 1)端口名)端口名2 2)端口方向)端口方向3 3)數據類型)數據類型2.2 2.2 實體說明實體說明 端口說明端口說明 端口說明是對設計實體與外部接口的描述。端口說明是對設計實體與外部接口的描述。包括對引腳信號名稱、引腳信號的數據

4、類包括對引腳信號名稱、引腳信號的數據類型、以及信號的輸入、輸出方向的描述。型、以及信號的輸入、輸出方向的描述。portport(端口名:(端口名: ; 端口名:端口名:方向方向 數據類型數據類型);方向方向數據類型數據類型2.3 2.3 構造體構造體 構造體的結構構造體的結構architecture 構造體名構造體名 of 實體名實體名 is【定義語句】【定義語句】內部信號、常數、數據類型等的定義內部信號、常數、數據類型等的定義;begin【并行處理語句】【并行處理語句】;end 構造體名構造體名;2.3 2.3 構造體構造體 1 1)構造體的命名)構造體的命名 2 2)定義語句)定義語句 3

5、 3)并行處理語句)并行處理語句2.3 2.3 構造體構造體 一個完整的構造體由兩個基本層次組成:一個完整的構造體由兩個基本層次組成:2)2) 描述實體邏輯行為的,以各種不同的描描述實體邏輯行為的,以各種不同的描述風格表示的功能描述語句。述風格表示的功能描述語句。1 1)對數據類型,常數,信號,子程序和元對數據類型,常數,信號,子程序和元件等元素的說明部分。件等元素的說明部分。【例【例1 1】 二選一選擇器二選一選擇器andnotandord1seld0qtmp1tmp2mux2id0entity mux2id0 isport(d0,d1,sel : in bit;q : out bit);e

6、nd mux2id0;architecture struc of mux isbeginprocess(d0,d1,sel)variable tmp1,tmp2,tmp3 : bit;begintmp1:=d0 and sel;tmp2:=d1 and(not sel);q=tmp1 or tmp2;end process;end struc;【例【例1 1】 二選一選擇器二選一選擇器【例【例 1- -2】 二選一選擇器的構造體說明二選一選擇器的構造體說明( (續續) ) architecturearchitecture connectconnect ofof muxmux isis- - 構

7、造體定義構造體定義beginbegin - - 構造體開始標記構造體開始標記 processprocess (d0, d1, sel)(d0, d1, sel) - - 進程進程 variablevariable tmp1, tmp2, tmp3: bit;tmp1, tmp2, tmp3: bit; - - 變量的聲明變量的聲明 beginbegin- - 進程開始標記進程開始標記 tmp1 := d0tmp1 := d0 andand sel;sel;- - 變量賦值語句變量賦值語句 tmp2 := d1tmp2 := d1 andand ( (notnot sel);sel);- - 變

8、量賦值語句變量賦值語句 q = tmp1q = tmp1 oror tmp2;tmp2; - - 信號賦值語句信號賦值語句 end processend process; ;- - 進程結束進程結束endend connect;connect;- - 構造體結束構造體結束【例【例 1- -2】 二選一選擇器的構造體說明二選一選擇器的構造體說明( (續續) ) architecturearchitecture connectconnect ofof muxmux isis- - 構造體定義構造體定義beginbegin - - 構造體開始標記構造體開始標記 processprocess (d0,

9、 d1, sel)(d0, d1, sel) - - 進程進程1 1。 end processend process; ;- - 進程進程1 1結束結束 processprocess (d0, d1, sel)(d0, d1, sel) - - 進程進程2 2。 end processend process; ;- - 進程進程2 2結束結束 。- - 其它并行語句結構其它并行語句結構 endend connect;connect;- - 構造體結束構造體結束 used to make associations within modelsused to make associations wi

10、thin models associate a entity and architecture associate a entity and architecture associate a component to an entity- associate a component to an entity-architecturearchitecture widely used in simulation environmentswidely used in simulation environments provides a flexible and fast path to design

11、 provides a flexible and fast path to design alternativesalternatives limited or no support in synthesis environments limited or no support in synthesis environmentsconfiguration configuration of of isisfor for end for;end for;end; end; (1076-1987 version)end configuration; end configuration; (1076-

12、1993 version)2.4 2.4 配置配置 (configurationconfiguration)putting it all togetherputting it all together packages are a convenient way of storing and using information throughout an entire model. packages consist of: package declaration (required) type declarations subprograms declarations package body

13、(optional) subprogram definitions vhdl has two built-in packages standard textio2.4 2.4 包集合(包集合(packagepackage)2.5 庫庫 contains a package or a collection of packages. resource libraries standard package ieee developed packages altera component packages any library of design units that are referenced

14、in a design. working library library into which the unit is being compiled. 必須放在vhdl程序最前面; 在vhdl程序中,可以有多個庫,庫和庫之間相互獨立; all packages must be compiled implicit libraries work std note: items in these packages do not need to be referenced,they are implied. library library clause defines the library name

15、 that can be referenced. is a symbolic name to path/directory. defined by the compiler tool. use use clause specifies the package and object in the library that you have specified in the library clause.2.5 庫庫library library stdn contains the following packages:standard standard ( types: bit, boolean

16、, integer, real, and time. all operator functions to support types)textio textio (file operations)n an implicit library (built-in)does not need to be referenced in vhdl designtypes defined in types defined in standard packagestandard packagen type bit 2 logic value system (0, 1)signal signal a_temp

17、: bit; bit_vector array of bitssignasignal temp : bit_vector(3 downto downto 0);signal signal temp : bit_vector(0 to to 3) ;n type boolean (false, true)n integer positive and negative values in decimalsignal signal int_tmp : integer; - 32 bit numbersignal signal int_tmp1 : integer range range 0 to 2

18、55; -8 bit numbernote: standard package has other types2.4.1 庫的種類庫的種類1) ieee庫std_logic_1164 std_logic_1164 (std_logic types & related functions) std_logic_arith std_logic_arith (arithmetic functions) std_logic_signed std_logic_signed (signed arithmetic functions) std_logic_unsigned std_logic_uns

19、igned (unsigned arithmetic functions)2) std庫 standard standard ( types: bit, boolean, integer, real, and time.all operator functions to support types) textio textio (file operations)library library ieeecontains the following packages: std_logic_1164 std_logic_1164 (std_logic types & related func

20、tions) std_logic_arith std_logic_arith (arithmetic functions) std_logic_signed std_logic_signed (signed arithmetic functions) std_logic_unsigned std_logic_unsigned (unsigned arithmetic functions)types defined in types defined in std_logic_1164 packagestd_logic_1164 packagen type std_logictype std_lo

21、gic 9 logic value system (u, x, 0, 1, z, w, l, h, -) 9 logic value system (u, x, 0, 1, z, w, l, h, -) w, l, h” weak values (not supported by w, l, h” weak values (not supported by synthesis)synthesis) x - used for unknown x - used for unknown z - (not z) used for tri-state z - (not z) used for tri-s

22、tate - dont care - dont care resolved type: supports, signals with multiple drives. resolved type: supports, signals with multiple drives.n type std_ulogic type std_ulogic same 9 value system as std_logic same 9 value system as std_logic unresolved type: does not support multiple signal unresolved type: does not support multiple signal drives.error will occur.drives.error will occur.2.4.1 庫的使用庫的使用1) 庫的聲明lib

溫馨提示

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

評論

0/150

提交評論