資源描述:
《3-8譯碼器的vhdl設(shè)計(jì)》由會員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
1、3-8譯碼器的VHDL設(shè)計(jì)1.實(shí)體框圖2.程序設(shè)計(jì)正確的程序LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;ENTITYDECODER38AISPORT(A2,A1,A0,S1,S2,S3:INSTD_LOGIC;Y:OUTSTD_LOGIC_VECTOR(7DOWNTO0));ENDENTITYDECODER38A;ARCHITECTUREONEOFDECODER38AISSIGNALS:STD_LOGIC_VECTOR(5DOWNTO0);BEGINS<=A2&A1&A0&S1&S2&S3;WITHSSELECTY<=
2、"11111110"WHEN"000100","11111101"WHEN"001100","11111011"WHEN"010100","11110111"WHEN"011100","11101111"WHEN"100100","11011111"WHEN"101100","10111111"WHEN"110100","01111111"WHEN"111100","11111111"WHENOTHERS;ENDARCHITECTUREONE;3.仿真波形圖4.仿真波形分析當(dāng)S1S2S3=100時(shí),只有當(dāng)A2A1A0=111時(shí),Y[7]才輸出低電平,否
3、則為高電平,當(dāng)A2A1A0=110時(shí),Y[6]才輸出低電平,否則為高電平,當(dāng)A2A1A0=101時(shí),Y[5]才輸出低電平,否則為高電平,Y[4]到Y(jié)[0]同理??梢娫摮绦蛟O(shè)計(jì)的是3-8譯碼器三、共陽極數(shù)碼管七段顯示譯碼器的VHDL設(shè)計(jì)1.實(shí)體框圖2.程序設(shè)計(jì)正確的程序LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;ENTITYDISPLAY_DECODERISPORT(A3,A2,A1,A0:INSTD_LOGIC;Y:OUTSTD_LOGIC_VECTOR(6DOWNTO0));ENDENTITYDISPLAY_DECO
4、DER;ARCHITECTUREONEOFDISPLAY_DECODERISSIGNALS:STD_LOGIC_VECTOR(3DOWNTO0);BEGINS<=A3&A2&A1&A0;WITHSSELECTY<="1111110"WHEN"0000","0110000"WHEN"0001","1101101"WHEN"0010","1111001"WHEN"0011","0110011"WHEN"0100","1011011"WHEN"0101","1011111"WHEN"0110","1110000"WHEN"0111","1111111"WHE
5、N"1000","1111011"WHEN"1001","0000000"WHENOTHERS;ENDARCHITECTUREONE;3.仿真波形圖4.仿真波形分析由圖可知,當(dāng)A3A2A1A0=0000時(shí),輸出Y[6]到Y(jié)[0]對應(yīng)為1111110,即只有g(shù)不亮,數(shù)碼管顯示為0,A3A2A1A0=0001時(shí),輸出對應(yīng)為0110000,數(shù)碼管顯示為1,A3A2A1A0=0010時(shí),輸出對應(yīng)為1101101,數(shù)碼管顯示為2,其他同理,當(dāng)A3A2A1A0>1001,即大于9,數(shù)碼管無顯示。由此可知,程序設(shè)計(jì)的是七段顯示譯碼管。LIBRARYIEEE;USEI
6、EEE.STD_LOGIC_1164.ALL;USEIEEE.STD_LOGIC_UNSIGNED.ALL;ENTITYCOMPARE4IS——四位比較器PORT(IA_MORE_THAN_B:INSTD_LOGIC;——高位比較的標(biāo)志位的輸入IB_MORE_THAN_A:INSTD_LOGIC;IA_EQUAL_B:INSTD_LOGIC;A:INSTD_LOGIC_VECTOR(3DOWNTO0);——兩個(gè)輸入B:INSTD_LOGIC_VECTOR(3DOWNTO0);OA_MORE_THAN_B:OUTSTD_LOGIC;OB_MORE_THA
7、N_A:OUTSTD_LOGIC;OA_EQUAL_B:OUTSTD_LOGIC);ENDCOMPARE4;ARCHITECTUREBEHAVOFCOMPARE4ISBEGINPROCESS(IB_MORE_THAN_A,IA_EQUAL_B,IA_EQUAL_B)BEGINIF(IA_EQUAL_B='1')THEN——從最高位比較,如果高位大則停止比較輸出結(jié)果,否則進(jìn)行下一位比較IF(A(3)>B(3))THENOA_MORE_THAN_B<='1';OB_MORE_THAN_A<='0';OA_EQUAL_B<='0';ELSIF(A(3)
8、3))THENOA_MORE_THAN_B<='0';OB_MORE_THAN_A<='1';