【文章內(nèi)容簡介】
1/23 43 并發(fā)賦值語句 D = A + E。 A = B + C。 + + B C E A D 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 44 并發(fā)賦值語句 (Cont.) A = B + A。 并發(fā)賦值語句: + A B A C = A。 C = B。 A B C 組合邏輯環(huán)路??! Multidriver, need resolved function 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 45 順序賦值語句 D = A + E。 A = B + C。 + + B C E A D 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 46 順序賦值語句 (Cont.) C = A。 C = B。 B C A = B + A。 組合進(jìn)程: No! 時序進(jìn)程: Ok! + A B A 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 47 小結(jié) i. 一個設(shè)計由 entity和 architecture描述 ii. 數(shù)據(jù)對象類型有 bit, boolean, integer, std_logic等標(biāo)準(zhǔn)類型和用戶自定義類型 iii. 并發(fā)語句執(zhí)行與書寫順序無關(guān)( order independent) iv. VHDL是一種強類型語言(類型不能自動相互轉(zhuǎn)換) v. 元件例化語句不能在 process中, if語句和 for語句用于并發(fā)語句時,只能是 generate語句,并發(fā)語句無變量賦值語句 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 48 小結(jié) (Cont.) entity shift is port( reset, clk : in std_logic。 din : in std_logic。 dout : out std_logic)。 end shift。 architecture str of shift is ponent dff port(reset, clk : in std_logic。 d : in std_logic。 q : out std_logic)。 end ponent。 signal tv : std_logic_vector(0 to 7)。 begin for I in 0 to 7 generate if I = 0 generate u1 : dff port map(reset, clk, din, tv(0))。 end generate。 if I 0 and I = 7 generate u2 : dff port map(reset, clk, tv(I – 1), tv(I))。 end generate。 end generate。 dout = tv(7)。 end str。 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 49 process 描述電路功能或行為。由于綜合后的電路對所有輸入信號變化敏感,因此所有 被讀 信號均應(yīng)包含在敏感表中,否則,綜合前的模擬結(jié)果與綜合后的模擬結(jié)果不一致! 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 50 syntax [process_label :] process(sensitivity list) [declarations。] begin statements。 if, loop, case, subprogram call etc end process [process_label]。 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 51 syntax P1 : process(A, B) Begin D = A or B and C。 End process P1。 P1 : process(A, B, C) Begin D = A or B and C。 End process P1。 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 52 munication among process Assignment If, case, loop etc Signal_N Signal_3 Signal_1 Signal_2 Process A Process B architecture example 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 53 if then else語句綜合 i/. 引入寄存器 entity dff is port (d : in std_logic。 clk : in std_logic。 q : out std_logic)。 End dff。 architecture rtl of dff is begin infer_reg : process(d, clk) begin if (clk‘event and clk = ?1‘) then q = d。 end process infer。 end rtl。 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 54 if then else語句綜合 (Cont.) ii/. 引入鎖存器 Infer_latch : process(A, B) begin if (A = ?1‘) then x = B。 end process infer_infer_latch。 Infer_latch : process(A, B) Begin x = ‘0’。 if (A = ?1‘) then x = B。 end process infer_infer_latch。 隱含了 A = ?0‘時 x = x。 不完全的 else 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 55 if then else語句綜合 (Cont.) iii/. 組合電路 entity b is port(a, b : in bit。 select : in bit。 y : out bit)。 end b。 architecture arch of b is begin process(a, b, select) begin if (select = ?1‘) then y = b。 else y = a。 end if。 end process。 end arch。 b a y select 1 0 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 56 if then else語句綜合 (Cont.) iv/. 異步復(fù)位 process(reset, clk, d) Begin if (reset = ?0‘) then q = ?0‘。 elsif (clk‘event and clk = ?1‘) then q = d。 end if。 end process。 d clk reset q 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 57 if then else語句綜合 (Cont.) v/. 三態(tài)邏輯 signal s, sel, data : std_logic。 process(sel, data) Begin if (sel = ?1‘) then s = data。 else s = ?Z‘。 end if。 end process。 sd a t as e l1 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 58 if then else語句綜合 (Cont.) v/. 三態(tài)邏輯 architecture beh of tribuf is signal asel, bsel, a, b, s : std_logic。 begin pa : process(asel, a) begin s = ?Z‘。 if (asel = ?1‘) then s = a。 end if。 end process pa。 saa s e lbb s e l2 pb : process(bsel, b) begin s = ?Z‘。 if (bsel = ?1‘) then s = b。 end if。 end process pb。 end beh。 Multi driver!! 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 59 if then else語句綜合 (Cont.) Discussion signal a, b, use_b : bit。 process(a, b, use_b) Begin if (use_b = ?1‘) then s = b。 elseif(use_b = ?0‘) then s = a。 end if。 end process。 1 Latch? 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 60 if then else語句綜合 (Cont.) Discussion signal a, b, use_b : std_logic。 process(a, b, use_b) Begin if (use_b = ?1‘) then s = b。 elseif(use_b = ?0‘) then s = a。 end if。 end process。 2 Latch? 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 61 if then else語句綜合 (Cont.) Discussion else assert false report ―invalid use_b‖ severity error。 end if。 end process。 3 what? signal a, b, use_b : std_logic。 process(a, b, use_b) Begin if (use_b = ?1‘) then s = b。 elseif(use_b = ?0‘) then s = a。 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 62 if then else語句綜合 (Cont.) vi/. 在一個進(jìn)程中,一個信號只能對應(yīng)一個三態(tài)驅(qū)動 process(b, ub, a, ua) Begin dout = ?Z‘。 if (ub = ?1‘) then dout = b。 end if。 if (ua = ?1‘) then dout = a。 end if。 end process。 au abu bd o u t哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 63 if then else語句綜合 (Cont.) vii/. ?Z‘值使用規(guī)則 如: dout = ?Z‘ and din。 如: if (sel = ?Z‘) then 相當(dāng)于 if false then 某個信號被賦值 ‘ Z‘值時,將會引入三態(tài)驅(qū)動,但‘ Z‘值不能用于復(fù)雜的表達(dá)式中(邏輯 /算術(shù)表達(dá)式) 1 當(dāng)信號與 ‘ Z‘值比較時,結(jié)果總為 false,引用這樣的關(guān)系表達(dá)式將導(dǎo)致模擬與綜合結(jié)果不匹配 2 哈爾濱工業(yè)大學(xué)微電子中心 2020/11/23 64 if then else語句綜合 (Cont.) vii/. if then else語句小結(jié) 可以描述順序行為 1 可以