八位二进制数据比较器ARCHITECTUREoneOFcomp8ISBEGINfa='1'WHENabELSE'0';fb='1'WHENa=bELSE'0';fe='1'WHENabELSE'0';ENDone;四选一数据选择器LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;ENTITYcomp8ISPORT(a,b:INSTD_LOGIC;fa,fb,fe:OUTSTD_LOGIC);ENDcomp8;ARCHITECTUREoneOFcomp8ISBEGINPROCESS(a,b)BEGINIFabTHENfa='1';fb='0';fe='0';ELSEIFabTHENfa='0';fb='0';fe='1';ELSEfa='0';fb='1';fe='0';ENDIF;ENDIF;ENDPROCESS;ENDone;LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;USEIEEE.STD_LOGIC_UNSIGNED.ALL;ENTITYmux41_2ISPORT(S1,S0:INSTD_LOGIC;D1,D2,D3,D4:INSTD_LOGIC;Y:OUTSTD_LOGIC);ENDmux41_2;ARCHITECTUREoneOFmux41_2ISSIGNALs:STD_LOGIC_VECTOR(1DOWNTO0);BEGINs=S1&S0;Y=D1WHENS=00ELSED2WHENS=01ELSED3WHENS=10ELSED4;ENDone;三输入与或门LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;ENTITYYHISPORT(A,B,C:INSTD_LOGIC;CON:INSTD_LOGIC;OUTA:OUTSTD_LOGIC);ENDYH;ARCHITECTUREoneOFYHISBEGINPROCESS(A,B,C,CON)BEGINIFCON='1'THENOUTA=AANDBANDC;ELSEOUTA=AORBORC;ENDIF;ENDPROCESS;ENDone;三八译码器LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;ENTITYDecoderISPORT(A,B,C:INBIT;ENA:INBIT;Y:OUTBIT_VECTOR(7DOWNTO0));ENDDecoder;ARCHITECTUREoneOFDecoderISBEGINPROCESS(ENA,A,B,C)VARIABLECBA:BIT_VECTOR(2DOWNTO0);BEGINCBA:=(C&B&A);IFENA='1'THENY=11111111;ELSECASE(CBA)ISWHEN000=Y=11111110;WHEN001=Y=11111101;WHEN010=Y=11111011;WHEN011=Y=11110111;WHEN100=Y=11101111;WHEN101=Y=11011111;WHEN110=Y=10111111;WHEN111=Y=01111111;WHENOTHERS=NULL;ENDCASE;ENDIF;ENDPROCESS;ENDone;方法二LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;ENTITYcomp8ISPORT(a,b:INSTD_LOGIC;fa,fb,fe:OUTSTD_LOGIC);ENDcomp8;元件例化LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;USEwork.my_pkg.ALL;ENTITYord41ISPORT(a1,b1,c1,d1:INSTD_LOGIC;z1:OUTSTD_LOGIC);ENDord41;ARCHITECTUREord41behvOFord41ISSIGNALx,y:STD_LOGIC;BEGINu1:nd2PORTMAP(a1,b1,x);u2:nd2PORTMAP(a=c1,b=d1,c=y);u3:nd2PORTMAP(x,y,c=z1);ENDord41behv;LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;ENTITYnd2ISPORT(a,b:INSTD_LOGIC;c:OUTSTD_LOGIC);ENDnd2;ARCHITECTUREnd2behvOFnd2ISBEGINC=Anandb;ENDnd2behv;LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;PACKAGEmy_pkgISComponentnd2PORT(a,b:INSTD_LOGIC;C:OUTSTD_LOGIC);ENDComponent;ENDmy_pkg;