28421BCD编码器源代码:LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;ENTITYencoder8421ISPORT(a:INSTD_LOGIC_VECTOR(9DOWNTO0);encode:OUTSTD_LOGIC_VECTOR(3DOWNTO0));ENDencoder8421;ARCHITECTUREoneOFencoder8421ISBEGINencode=0000whena(0)='1'else0001whena(1)='1'else0010whena(2)='1'else0011whena(3)='1'else0100whena(4)='1'else0101whena(5)='1'else0110whena(6)='1'else0111whena(7)='1'else1000whena(8)='1'else1001whena(9)='1';ENDone;仿真结果: