【正文】
signal q:std_logic_vector(7 downto 0)。 八分頻器 數(shù)據(jù)并行輸入端口 串并轉(zhuǎn)換器 數(shù)據(jù)串行輸出端口 15 begin process(clk) begin if clk39。event and clk =39。139。 then t = t+1。 end if。 end process。 process(clk) begin if clk39。event and clk = 39。139。 then if en33 =39。039。 then q(7)=39。Z39。 else if t 000 then q(7 downto 1)=q(6 downto 0)。 else if t = 000 then q=din3。 end if。 end if。 end if。 end if。 end process。 dt3= q(7)。 end behave。 8 位并行輸入,一位串行輸出仿真波形圖 —— 輸入為 10111111 圖 432 八位并轉(zhuǎn)串波形 八位串轉(zhuǎn)并 原理和四位串轉(zhuǎn)并基本一樣,只是 將輸入的數(shù)據(jù)改成了八位串行數(shù)據(jù)。結(jié)構(gòu)框圖如下: 圖 441 八位串轉(zhuǎn)并實(shí)驗(yàn)框圖 部分程序代碼如下: library ieee。 8 位串行數(shù)據(jù)輸入 串并轉(zhuǎn)換器 8 位并行數(shù)據(jù)輸出 16 use 。 use 。 entity cb1_8 is port (clk,en22:in std_logic。 din2:in std_logic。 dt2:out std_logic_vector(7 downto 0))。 end entity。 architecture one of cb1_8 is signal q:std_logic_vector(8 downto 0)。 begin process(clk) begin if clk39。event and clk=39。139。 then if en22=39。039。 then dt2=ZZZZZZZZ。 else if q(8)=39。039。 then q= 11111110amp。din2。 else q=q(7 downto 0)amp。din2。 end if。 end if。 end if。 end process。 process(q) begin if q(8)=39。039。 then dt2=q(7 downto 0)。 else dt2= ZZZZZZZZ。 end if。 end process。 end。 圖 442 八位串轉(zhuǎn)并波形 17 十六位并轉(zhuǎn)串 原理和四位并轉(zhuǎn)串一樣,只是將四分頻器改為十六分頻器即可。實(shí)驗(yàn)框圖如下: 圖 451 十六位并轉(zhuǎn)串實(shí)驗(yàn)框圖 部分程序代碼如下: library ieee。 use 。 use 。 entity c7_7 is port(clk:in std_logic。 en77:in std_logic。 din7:in std_logic_vector(15 downto 0)。 dt7: out std_logic)。 end entity 。 architecture behav of c7_7 is signal t:std_logic_vector(3 downto 0)。 signal q:std_logic_vector(15 downto 0)。 begin process(clk) begin if clk39。event and clk =39。139。 then t = t+1。 end if。 end process。 process(clk) begin if clk39。event and clk = 39。139。 then if en77 =39。039。 then q(15)=39。Z39。 else if t 0000 then q(15 downto 1)=q(14 downto 0)。 else if t = 0000 then q=din7。 end if。 end if。 end if。 十六分頻器 數(shù)據(jù)并行輸入端口 串并轉(zhuǎn)換器 數(shù)據(jù)串行輸出端口 18 end if。 end process。 dt7= q(15)。 end behav。 16 位并行輸入, 1位串行輸出仿真波形圖 輸入為 1111000011110000 圖 452 十六位并串轉(zhuǎn)波形 十六位串轉(zhuǎn)并 原理和四位串轉(zhuǎn)并基本一樣,只是將輸入的數(shù)據(jù)改成了十六位串行數(shù)據(jù)。結(jié)構(gòu)框圖如下: 16位串行數(shù)據(jù)輸入 串并轉(zhuǎn)換器 16位并行數(shù)據(jù)輸出 19 圖 461 十六位串轉(zhuǎn)并實(shí)驗(yàn)框圖 部分程序代碼如下: library ieee。 use 。 use 。 entity cb1_16 is port (clk,en66:in std_logic。 din6:in std_logic。 dt6:out std_logic_vector(15 downto 0))。 end entity。