【正文】
pe iocell is record Enable :bit。 Signal b : word。 a = X “3A”。 Signal a: std_logic_vector(7 downto 0)。 – 注意: 這里的大小寫是敏感的 VHDL數(shù)據(jù)類型 ?整數(shù)、浮點(diǎn)數(shù) – 方便用于數(shù)值方面的運(yùn)算:加減乘除 – 整數(shù)范圍: 231 ~ 231 –1,經(jīng)常用于計(jì)數(shù)器 – 實(shí)數(shù)范圍: ~ +,不被 Max+ PLusII支持 Variable a : integer range –255 to +255。 VHDL數(shù)據(jù)類型--枚舉 ? IEEE1164標(biāo)準(zhǔn)中預(yù)定義了一個(gè)枚舉類型Type std_logic is(?U?, ?X?,?0?, ?1?, ?Z?, ?W?, ?L?, ?H?, ??)。 VHDL數(shù)據(jù)類型 ?標(biāo)量類型( Scalar) – 枚舉( Enumeration) – 整數(shù)( Integer) – 浮點(diǎn)數(shù)( Float) – 物理( Physical) ?復(fù)合類型( Composite) VHDL數(shù)據(jù)類型--枚舉 ?列舉數(shù)據(jù)對(duì)象可能存在的值,一般用于定義狀態(tài)機(jī)的狀態(tài) – Type states is (idle, start, running, pause, stop) – Signal current_state : states。 end process。 end loop。139。 architecture a of start is begin process(a_bus) variable tmp:std_logic。 end process。 end loop。139。 信號(hào)與變量的區(qū)別 architecture a of start is signal tmp : std_logic。 end process。 end if。 else carryout = 39。 if(count=0) then carryout = 39。139。 begin if (clk39。 end rtl。 end if。039。139。) then count = count + 1。event and clk=39。 信號(hào)與變量的區(qū)別 architecture rtl of start is signal count : integer range 0 to 7。 VHDL數(shù)據(jù)對(duì)象( Data Objects) ?變量( Variable) – 臨時(shí)數(shù)據(jù),沒有物理意義 – 只能在 Process和 Function中定義,并只在其內(nèi)部有效 – 要使其全局有效,先轉(zhuǎn)換為 Signal。在 Max+ PlusII中被忽略。 三種描述方式的比較 描述方式 優(yōu)點(diǎn) 缺點(diǎn) 適用場(chǎng)合 結(jié)構(gòu)化描述 連接關(guān)系清晰,電路模塊化清晰 電路不易理解、繁瑣、復(fù)雜 電路層次化設(shè)計(jì) 數(shù)據(jù)流描述 布爾函數(shù)定義明白 不易描述復(fù)雜電路,修改不易 小門數(shù)設(shè)計(jì) 行為描述 電路特性清楚明了 進(jìn)行綜合效率相對(duì)較低 大型復(fù)雜的電路模塊設(shè)計(jì) VHDL標(biāo)識(shí)符( Identifiers) ?基本標(biāo)識(shí)符由字母、數(shù)字和下劃線組成 ?第一個(gè)字符必須是字母 ?最后一個(gè)字符不能是下劃線 ?不允許連續(xù) 2個(gè)下劃線 ?保留字 (關(guān)鍵字 )不能用于標(biāo)識(shí)符 ?大小寫是等效的 VHDL數(shù)據(jù)對(duì)象( Data Objects) ?常數(shù)( Constant) – 固定值,不能在程序中被改變 – 增強(qiáng)程序的可讀性,便于修改程序 – 在綜合后,連接到電源和地 – 可在 Library、 Entity、 Architecture、 Process中進(jìn)行定義,其有效范圍也相應(yīng)限定 Constant data_bus_width: integer := 8。 類似于電路的網(wǎng)絡(luò)表,將各個(gè)器件通過語(yǔ)言的形式進(jìn)行連接,與電路有一一對(duì)應(yīng)的關(guān)系。 U4:and4 port map(x(0),x(1),x(2),x(3),equal)。 U2:xnor2 port map(a(2),b(2),x(2))。 當(dāng) a和 b的寬度發(fā)生變化時(shí),需要修改設(shè)計(jì),當(dāng)寬度過大時(shí),設(shè)計(jì)非常繁瑣 結(jié)構(gòu)體--結(jié)構(gòu)化描述 architecture struct of eqp4 is begin U0:xnor2 port map(a(0),b(0),x(0))。 Architecture dataflow2 of eqp4 is begin equal = not(a(0) xor b(0)) and not(a(1) xor b(1)) and not(a(2) xor b(2)) and not(a(3) xor