XOR gate - Wikipedia
文章推薦指數: 80 %
XOR gate is a digital logic gate that gives a true (1 or HIGH) output when the number of ... An XOR gate circuit can be made from four NAND gates. XORgate FromWikipedia,thefreeencyclopedia Jumptonavigation Jumptosearch Logicgate ThisarticleisaboutXORdigitallogicgate(e.g.SN7486orCD4030B).ForXORlogicaloperation,seeExclusiveor.Forotheruses,seeXOR(disambiguation). Input Output A B AXORB 0 0 0 0 1 1 1 0 1 1 1 0 CMOSXORgate XORgate(sometimesEOR,orEXORandpronouncedasExclusiveOR)isadigitallogicgatethatgivesatrue(1orHIGH)outputwhenthenumberoftrueinputsisodd.AnXORgateimplementsanexclusiveor( ↮ {\displaystyle\nleftrightarrow} )frommathematicallogic;thatis,atrueoutputresultsifone,andonlyone,oftheinputstothegateistrue.Ifbothinputsarefalse(0/LOW)orbotharetrue,afalseoutputresults.XORrepresentstheinequalityfunction,i.e.,theoutputistrueiftheinputsarenotalikeotherwisetheoutputisfalse.AwaytorememberXORis"musthaveoneortheotherbutnotboth". XORcanalsobeviewedasadditionmodulo2.Asaresult,XORgatesareusedtoimplementbinaryadditionincomputers.AhalfadderconsistsofanXORgateandanANDgate.Otherusesincludesubtractors,comparators,andcontrolledinverters.[1] Thealgebraicexpressions A ⋅ B ¯ + A ¯ ⋅ B {\displaystyleA\cdot{\overline{B}}+{\overline{A}}\cdotB} or ( A + B ) ⋅ ( A ¯ + B ¯ ) {\displaystyle(A+B)\cdot({\overline{A}}+{\overline{B}})} or A ⊕ B {\displaystyleA\oplusB} allrepresenttheXORgatewithinputsAandB.ThebehaviorofXORissummarizedinthetruthtableshownontheright. Contents 1Symbols 2Pass-gate-logicwiring 2.1Analyticalrepresentation 3Alternatives 4Morethantwoinputs 5Applications 5.1Usesinaddition 5.2Pseudo-randomnumbergenerator 5.3Correlationandsequencedetection 5.4Phasedetectors 6Seealso 7References Symbols[edit] TherearethreeschematicsymbolsforXORgates:thetraditionalANSIandDINsymbolsandtheIECsymbol.Insomecases,theDINsymbolisusedwith⊕insteadof≢.FormoreinformationseeLogicGateSymbols. ANSIXORSchematicSymbol IECXORSchematicSymbol DINXORSchematicSymbol Thelogicsymbols⊕,Jpq,and⊻canbeusedtodenoteanXORoperationinalgebraicexpressions. C-likelanguagesusethecaretsymbol^todenotebitwiseXOR.(Notethatthecaretdoesnotdenotelogicalconjunction(AND)intheselanguages,despitethesimilarityofsymbol.) Pass-gate-logicwiring[edit] AnXORgatecanbeconstructedusingMOSFETs.HereisadiagramofapasstransistorlogicimplementationofanXORgate.[2][3][4][5][6] TransmissionGateLogicwiringofanXORgate Note:The"Rss"resistorpreventsshuntingcurrentdirectlyfrom"A"and"B"totheoutput.Withoutit,ifthecircuitthatprovidesinputsAandBdoesnothavetheproperdrivingcapability,theoutputmightnotswingrailtorailorbeseverelyslew-ratelimited.The"Rss"resistoralsolimitsthecurrentfromVddtogroundwhichprotectsthetransistorsandsavesenergywhenthetransistorsaretransitioningbetweenstates. Analyticalrepresentation[edit] f ( a , b ) = a + b − 2 a b {\displaystylef(a,b)=a+b-2ab} isananalyticalrepresentationofXORgate: f ( 0 , 0 ) = 0 + 0 − 2 ⋅ 0 ⋅ 0 = 0 {\displaystylef(0,0)=0+0-2\cdot0\cdot0=0} f ( 0 , 1 ) = 0 + 1 − 2 ⋅ 0 ⋅ 1 = 1 {\displaystylef(0,1)=0+1-2\cdot0\cdot1=1} f ( 1 , 0 ) = 1 + 0 − 2 ⋅ 1 ⋅ 0 = 1 {\displaystylef(1,0)=1+0-2\cdot1\cdot0=1} f ( 1 , 1 ) = 1 + 1 − 2 ⋅ 1 ⋅ 1 = 0 {\displaystylef(1,1)=1+1-2\cdot1\cdot1=0} f ( a , b ) = | a − b | {\displaystylef(a,b)=|a-b|} isanalternativeanalyticalrepresentation. Alternatives[edit] XORgatecircuitusingthreemixedgates Ifaspecifictypeofgateisnotavailable,acircuitthatimplementsthesamefunctioncanbeconstructedfromotheravailablegates.AcircuitimplementinganXORfunctioncanbetriviallyconstructedfromanXNORgatefollowedbyaNOTgate.Ifweconsidertheexpression ( A ⋅ B ¯ ) + ( A ¯ ⋅ B ) {\displaystyle(A\cdot{\overline{B}})+({\overline{A}}\cdotB)} ,wecanconstructanXORgatecircuitdirectlyusingAND,ORandNOTgates.However,thisapproachrequiresfivegatesofthreedifferentkinds. Asalternative,ifdifferentgatesareavailablewecanapplyBooleanalgebratotransform ( A ⋅ B ¯ ) + ( A ¯ ⋅ B ) ≡ ( A + B ) ⋅ ( A ¯ + B ¯ ) {\displaystyle(A\cdot{\overline{B}})+({\overline{A}}\cdotB)\equiv(A+B)\cdot({\overline{A}}+{\overline{B}})} asstatedabove,andapplydeMorgan'sLawtothelasttermtoget ( A + B ) ⋅ ( A ⋅ B ) ¯ {\displaystyle(A+B)\cdot{\overline{(A\cdotB)}}} whichcanbeimplementedusingonlythreegatesasshownontheright. AnXORgatecircuitcanbemadefromfourNANDgates.Infact,bothNANDandNORgatesareso-called"universalgates"andanylogicalfunctioncanbeconstructedfromeitherNANDlogicorNORlogicalone.IfthefourNANDgatesarereplacedbyNORgates,thisresultsinanXNORgate,whichcanbeconvertedtoanXORgatebyinvertingtheoutputoroneoftheinputs(e.g.withafifthNORgate). Desiredgate NANDconstruction NORconstruction AnalternativearrangementisoffiveNORgatesinatopologythatemphasizestheconstructionofthefunctionfrom ( A + B ) ⋅ ( A ¯ + B ¯ ) {\displaystyle(A+B)\cdot({\overline{A}}+{\overline{B}})} ,notingfromdeMorgan'sLawthataNORgateisaninverted-inputANDgate.AnotheralternativearrangementisoffiveNANDgatesinatopologythatemphasizestheconstructionofthefunctionfrom ( A ⋅ B ¯ ) + ( A ¯ ⋅ B ) {\displaystyle(A\cdot{\overline{B}})+({\overline{A}}\cdotB)} ,notingfromdeMorgan'sLawthataNANDgateisaninverted-inputORgate. Desiredgate NANDconstruction NORconstruction FortheNANDconstructions,theupperarrangementrequiresfewergates.FortheNORconstructions,thelowerarrangementofferstheadvantageofashorterpropagationdelay(thetimedelaybetweenaninputchangingandtheoutputchanging). Morethantwoinputs[edit] Literalinterpretationofthename"exclusiveor",orobservationoftheIECrectangularsymbol,raisesthequestionofcorrectbehaviourwithadditionalinputs.Ifalogicgateweretoacceptthreeormoreinputsandproduceatrueoutputifexactlyoneofthoseinputsweretrue,thenitwouldineffectbeaone-hotdetector(andindeedthisisthecaseforonlytwoinputs).However,itisrarelyimplementedthiswayinpractice. Itismostcommontoregardsubsequentinputsasbeingappliedthroughacascadeofbinaryexclusive-oroperations:thefirsttwosignalsarefedintoanXORgate,thentheoutputofthatgateisfedintoasecondXORgatetogetherwiththethirdsignal,andsoonforanyremainingsignals.Theresultisacircuitthatoutputsa1whenthenumberof1satitsinputsisodd,anda0whenthenumberofincoming1siseven.Thismakesitpracticallyusefulasaparitygeneratororamodulo-2adder. Forexample,the74LVC1G386microchipisadvertisedasathree-inputlogicgate,andimplementsaparitygenerator.[7] Applications[edit] ExamplehalfaddercircuitdiagramExamplefulladdercircuitdiagram XORgatesandANDgatesarethetwomost-usedstructuresinVLSIapplications.[8] Usesinaddition[edit] TheXORlogicgatecanbeusedasaone-bitadderthataddsanytwobitstogethertooutputonebit.Forexample,ifweadd1plus1inbinary,weexpectatwo-bitanswer,10(i.e.2indecimal).SincethetrailingsumbitinthisoutputisachievedwithXOR,theprecedingcarrybitiscalculatedwithanANDgate.ThisisthemainprincipleinHalfAdders.AslightlylargerFullAddercircuitmaybechainedtogetherinordertoaddlongerbinarynumbers. Pseudo-randomnumbergenerator[edit] Pseudo-randomnumber(PRN)generators,specificallylinear-feedbackshiftregisters(LFSR),aredefinedintermsoftheexclusive-oroperation.Hence,asuitablesetupofXORgatescanmodelalinear-feedbackshiftregister,inordertogeneraterandomnumbers. Correlationandsequencedetection[edit] XORgatesproducea0whenbothinputsmatch.WhensearchingforaspecificbitpatternorPRNsequenceinaverylongdatasequence,aseriesofXORgatescanbeusedtocompareastringofbitsfromthedatasequenceagainstthetargetsequenceinparallel.Thenumberof0outputscanthenbecountedtodeterminehowwellthedatasequencematchesthetargetsequence.CorrelatorsareusedinmanycommunicationsdevicessuchasCDMAreceiversanddecodersforerrorcorrectionandchannelcodes.InaCDMAreceiver,correlatorsareusedtoextractthepolarityofaspecificPRNsequenceoutofacombinedcollectionofPRNsequences. Acorrelatorlookingfor11010inthedatasequence1110100101wouldcomparetheincomingdatabitsagainstthetargetsequenceateverypossibleoffsetwhilecountingthenumberofmatches(zeros): 1110100101(data) 11010(target) 00111(XOR)2zerobits 1110100101 11010 000005zerobits 1110100101 11010 011102zerobits 1110100101 11010 100112zerobits 1110100101 11010 010004zerobits 1110100101 11010 111110zerobits Matchesbyoffset: . : : : : : : : ----------- 012345 Inthisexample,thebestmatchoccurswhenthetargetsequenceisoffsetby1bitandallfivebitsmatch.Whenoffsetby5bits,thesequenceexactlymatchesitsinverse.BylookingatthedifferencebetweenthenumberofonesandzerosthatcomeoutofthebankofXORgates,itiseasytoseewherethesequenceoccursandwhetherornotitisinverted.Longersequencesareeasiertodetectthanshortsequences. Phasedetectors[edit] XORgatesmaybeusedinsimplestphasedetectors.[9]: 425 Seealso[edit] Exclusiveor ANDgate ORgate Inverter(NOTgate) NANDgate NORgate XNORgate IMPLYgate Booleanalgebra Logicgate WikimediaCommonshasmediarelatedtoXORgates. References[edit] ^Fletcher,William(1980).Anengineeringapproachtodigitaldesign.Prentice-Hall.p. 98.ISBN 0-13-277699-5. ^ "DesigningcombinationallogicgatesinCMOS".p.233 ^"TransmissionGateXOR"Archived2017-08-16attheWaybackMachine. ^ "transmission-gateXOR(tinyXOR)"(via[1]) ^ "Figure3,ExclusiveORandXNORgate". ^ "Pass-TransistorLogic:TransmissionGateXOR"(p.11) ^74LVC1G386Archived2009-12-29attheWaybackMachinedatasheet ^"ComparisonofdifferentdesigntechniquesofXOR&ANDgateusingEDAsimulationtool".XOR&ANDgatesaremostimportantbasicbuildingblocksofanyVLSIapplications. ^Rabaey,JanM.(1996).Digitalintegratedcircuits :adesignperspective.UpperSaddleRiver,N.J.:Prentice-Hall.ISBN 978-0-13-178609-7. vteLogicalconnectives Tautology/True ⊤ {\displaystyle\top} Alternativedenial (NANDgate) ↑ {\displaystyle\uparrow} Converseimplication ← {\displaystyle\leftarrow} Implication (IMPLYgate) → {\displaystyle\rightarrow} Disjunction (ORgate) ∨ {\displaystyle\lor} Negation (NOTgate) ¬ {\displaystyle\neg} Exclusiveor (XORgate) ↮ {\displaystyle\not\leftrightarrow} Biconditional (XNORgate) ↔ {\displaystyle\leftrightarrow} Statement (Digitalbuffer) Jointdenial (NORgate) ↓ {\displaystyle\downarrow} Nonimplication (NIMPLYgate) ↛ {\displaystyle\nrightarrow} Conversenonimplication ↚ {\displaystyle\nleftarrow} Conjunction (ANDgate) ∧ {\displaystyle\land} Contradiction/False ⊥ {\displaystyle\bot} Philosophyportal Thisarticleneedsadditionalormorespecificcategories.Pleasehelpoutbyaddingcategoriestoitsothatitcanbelistedwithsimilararticles.(May2021) Retrievedfrom"https://en.wikipedia.org/w/index.php?title=XOR_gate&oldid=1097355929" Categories:LogicgatesHiddencategories:WebarchivetemplatewaybacklinksArticleswithshortdescriptionShortdescriptionmatchesWikidataCommonscategorylinkisonWikidataArticlesneedingadditionalcategoriesfromMay2021Pagesthatuseadeprecatedformatofthemathtags Navigationmenu Personaltools NotloggedinTalkContributionsCreateaccountLogin Namespaces ArticleTalk English Views ReadEditViewhistory More Search Navigation MainpageContentsCurrenteventsRandomarticleAboutWikipediaContactusDonate Contribute HelpLearntoeditCommunityportalRecentchangesUploadfile Tools WhatlinkshereRelatedchangesUploadfileSpecialpagesPermanentlinkPageinformationCitethispageWikidataitem Print/export DownloadasPDFPrintableversion Inotherprojects WikimediaCommons Languages አማርኛالعربيةAzərbaycancaCatalàČeštinaDeutschEspañolEuskaraفارسی한국어ՀայերենLatinaLombardМакедонскиNederlands日本語RomânăSimpleEnglishSlovenčinaСрпски/srpskiSuomiSvenskaதமிழ்TürkçeУкраїнська粵語中文 Editlinks
延伸文章資訊
- 1logic gate (AND, OR, XOR, NOT, NAND, NOR and XNOR)
The NAND gate operates as an AND gate followed by a NOT gate. It acts in the manner of the logica...
- 2XOR gate circuit diagram using only NAND or NOR gate
One can construct an XOR gate by using minimum four NAND gates. However, It is also possible to d...
- 3How to construct XOR gate using only 4 NAND gate?
Assuming we are on the right track, we need two NAND gates to produce X and Y. So that leaves us ...
- 4How do I construct a NAND gate using XOR? - Quora
The most straightforward way I know of is to make a 2-input XOR gate from 4 NAND gates, and then ...
- 5Drive XOR using either NAND gates or NOR gates.
Drive XOR using either NAND gates or NOR gates. · XOR equation = A'B+ AB' · NAND equation = A' + ...