Chapterبەش 6 · Lectureوانە 6.5

XOR, XNOR and All Gates at a Glanceگەیتی XOR، گەیتی XNOR و هەموو گەیتەکان بە یەک سەیرکردن

The exclusive-OR gate gives 1 when its inputs differ, and with more inputs when the number of 1s is odd — the idea behind parity bits. XNOR, its inverse, detects equality. Symbols, expressions, timing diagrams, the many names of these gates, and a summary chart of all seven gates.

1 دەدات کاتێک جیاواز بن و بە زیاتر کاتێک ژمارەی 1ـەکان تاک بێت — ئەمە بیرۆکەی پشت . ، پێچەوانەکەی، یەکسانی دەدۆزێتەوە. ، ، ، ناوە جۆراوجۆرەکانی ئەم و هێڵکارییەکی کۆتایی بۆ هەر حەوت .

16 min read18 خولەک خوێندنەوە · 17 stepsهەنگاو

What you will learnچی فێر دەبیت

  • Describe XOR correctly (1 when the inputs differ) and tell it apart from OR.
  • Use the odd-number rule for XOR with many inputs and explain how it makes and checks parity bits.
  • Describe XNOR as an equality detector and write it as A⊕B‾\overline{A \oplus B}.
  • Draw XOR and XNOR outputs in a timing diagram.
  • Recognise all seven gates by symbol, expression and truth table.
  • XOR بە دروستی وەسف بکەیت (⁦1⁩ کاتێک جیاواز بن) و لە OR جیای بکەیتەوە.
  • یاسای ژمارەی تاک بۆ XORـی چەند بەکار بهێنیت و ڕوونی بکەیتەوە چۆن دروست دەکات و دەیپشکنێت.
  • XNOR وەک دۆزەرەوەی یەکسانی وەسف بکەیت و وەک A⊕B‾\overline{A \oplus B} بینووسیت.
  • XOR و XNOR لە بکێشیت.
  • هەر حەوت لە ، و بناسیتەوە.

The XOR gateگەیتی XOR

The exclusive-OR gate, XOR for short, compares its two inputs. Its output is 1 when the inputs are different — exactly one of them is 1 — and 0 when they are the same (both 0 or both 1). We write it with a circled plus: X=A⊕BX = A \oplus B.

(⁦exclusive-OR⁩، بە کورتی XOR) دوو بەراورد دەکات. 1ـە کاتێک جیاواز بن — ڕێک یەکێکیان 1 بێت — و 0ـە کاتێک وەک یەک بن (هەردووکیان 0 یان هەردووکیان ⁦1⁩). بە نیشانەی کۆی ناو بازنەیەک دەینووسین: X=A⊕BX = A \oplus B.

Definitionپێناسە

A gate whose output is 1 when its two inputs are different. With more inputs, the output is 1 when an odd number of inputs are 1; it is written A⊕BA \oplus B.

کە 1ـە کاتێک دوو جیاواز بن. ئەگەر ژمارەی زیاتر بێت، 1ـە کاتێک ژمارەیەکی تاک لە 1 بن؛ بە A⊕BA \oplus B دەنووسرێت.

Truth table of the XOR gate
ABX=A⊕BX = A \oplus B
000
011
101
110
Two panels. XOR: the distinctive symbol is an OR shape with an extra curved line behind the inputs; the IEC symbol is a box marked =1; X equals A XOR B; the output is 1 when A and B differ; truth table 0 1 1 0. XNOR: the same shapes with a bubble on the output; X equals the complement of A XOR B; the output is 1 when A and B are equal; truth table 1 0 0 1.دوو بەش. XOR: هێما تایبەتەکەی شێوەی ORـە بە هێڵێکی کەوانەیی زیادە لە پشت نێوخستەکانەوە؛ هێما IECـەکەی سندووقێکە بە نیشانەی =1؛ X یەکسانە بە A XOR B؛ دەرخستە 1ـە کاتێک A و B جیاواز بن؛ خشتەی ڕاستی: 0 1 1 0. XNOR: هەمان شێوەکان بە بازنەیەک لەسەر دەرخستە؛ X یەکسانە بە تەواوکەری A XOR B؛ دەرخستە 1ـە کاتێک A و B وەک یەک بن؛ خشتەی ڕاستی: 1 0 0 1.
XOR and XNOR in both symbol styles, with their tables.XOR و XNOR لە هەردوو شێوازی ، لەگەڵ خشتەکانیان.CêIT
Quick checkپشکنینی خێراWhat is 1⊕11 \oplus 1?1⊕11 \oplus 1 چەندە؟

The XOR gateگەیتی XOR

XOR versus OR: the 1-1 rowXOR بەرامبەر OR: ڕیزی ⁦1-1⁩

XOR and OR agree in three rows of the table. They differ in one row only: when both inputs are 1, OR says 1 but XOR says 0. Watch the two lamps in the animation; the same switches drive both gates.

XOR و OR لە سێ ڕیزی خشتەکەدا وەک یەکن. تەنها لە یەک ڕیزدا جیاوازن: کاتێک هەردوو 1ـن، OR دەڵێت 1 بەڵام XOR دەڵێت 0. سەیری دوو گڵۆپەکەی ناو ئەنیمەیشنەکە بکە؛ هەمان هەردوو کار پێدەکەن.

Animation. Two input switches A and B feed both an OR gate and an XOR gate, each with its own lamp. The inputs step through 00, 01, 10 and 11. For 01 and 10 both lamps light. For 11 the OR lamp is on but the XOR lamp is off, and that row of the truth table is marked. The last frame says the gates differ only when A = B = 1.
Animation. Two input switches A and B feed both an OR gate and an XOR gate, each with its own lamp. The inputs step through 00, 01, 10 and 11. For 01 and 10 both lamps light. For 11 the OR lamp is on but the XOR lamp is off, and that row of the truth table is marked. The last frame says the gates differ only when A = B = 1.
OR and XOR side by side: only the 1-1 row tells them apart.OR و XOR لە تەنیشت یەکەوە: تەنها ڕیزی ⁦1-1⁩ لێکیان جیا دەکاتەوە.CêIT
The stairwell lightگڵۆپی پەیژەکە

In many Kurdish houses the stairwell light has one switch downstairs and one upstairs. Flip either switch and the light changes. The light is on when the two switches are in different positions and off when they are in the same position — that is XOR. Electricians call it a two-way switch circuit.

لە زۆر ماڵی کوردیدا گڵۆپی پەیژە لە خوارەوە و لە سەرەوە هەیە. هەر کام لە بگۆڕیت، گڵۆپەکە دەگۆڕێت. گڵۆپەکە هەڵکراوە کاتێک دوو لە دوو دۆخی جیاوازدا بن و کوژاوەیە کاتێک لە هەمان دۆخدا بن — ئەمە XORـە. کارەباچییەکان پێی دەڵێن سووڕی دوو ڕێگا.

Where the analogy stops workingسنووری ئەم نموونەیە

Depending on how it was wired, the light may be on when the switches are the same (that is XNOR). Either way, one flip always changes the light.

بەپێی شێوەی بەستنەکەی، لەوانەیە گڵۆپەکە کاتێک هەڵکراو بێت کە وەک یەک بن (ئەوە XNORـە). بە هەر حاڵ، یەک گۆڕین هەمیشە گڵۆپەکە دەگۆڕێت.

Quick checkپشکنینی خێراFor which inputs do OR and XOR give different outputs?بۆ کام ، OR و XOR جیاواز دەدەن؟

The XOR gateگەیتی XOR

XOR from AND, OR and NOTXOR لە AND، OR و NOT

XOR is not a basic gate; we can build it from the three basic ones. Look at the two rows where XOR is 1: A=1A = 1, B=0B = 0 and A=0A = 0, B=1B = 1. The product term AB‾A\overline{B} is 1 only in the first, and A‾B\overline{A}B only in the second. OR them together:

XOR بنەڕەتی نییە؛ دەتوانین لە سێ دروستی بکەین. سەیری ئەو دوو ڕیزە بکە کە XOR تێیاندا 1ـە: A=1A = 1، B=0B = 0 و A=0A = 0، B=1B = 1. AB‾A\overline{B} تەنها لە یەکەمیاندا 1ـە و A‾B\overline{A}B تەنها لە دووەمیاندا. بە OR کۆیان بکەرەوە:

A⊕B=AB‾+A‾BA \oplus B = A\overline{B} + \overline{A}B

Two NOT gates, two AND gates and one OR gate: five basic gates for one XOR.

دوو ، دوو و یەک : پێنج بنەڕەتی بۆ یەک XOR.

Another way to read the name exclusive OR: it is OR but not AND. In symbols A⊕B=(A+B) AB‾A \oplus B = (A + B)\,\overline{AB} — “at least one is 1, and not both”.

ڕێگایەکی تر بۆ تێگەیشتن لە ناوی exclusive OR: واتە «OR، بەڵام نەک AND». بە : A⊕B=(A+B) AB‾A \oplus B = (A + B)\,\overline{AB} — «لانیکەم یەکێکیان 1ـە، بەڵام نەک هەردووکیان».

Quick checkپشکنینی خێراWhich expression equals A⊕BA \oplus B?کام یەکسانە بە A⊕BA \oplus B؟

Boolean Logic & Logic Gates: Crash Course Computer Science #3CrashCourse · Englishئینگلیزی · 3.4M viewsبینین · 65K likesلایک · Partبەشی 7:19–8:49 (ofلە 10:07)

How transistors make NOT and AND gates: an inverter flips its input; two transistors in series give 1 only when both inputs are 1.

دروستکردنی NOT و AND لە : پێچەوانەکەر پێچەوانە دەکاتەوە؛ دوو بە تەنها کاتێک 1 دەدەن کە هەردوو 1 بن.

Chapter 'Exclusive or and abstraction' (7:19-8:49): XOR and OR tables differ only in the 1-1 row; XOR built as (A OR B) AND NOT (A AND B).

بەشی Exclusive or and abstraction (⁦7:19⁩ تا ⁦8:49⁩): XOR و OR تەنها لە دێڕی ⁦1-1⁩دا جیاوازن؛ XOR وەک (A OR B) AND NOT (A AND B) دروست دەکرێت.

XOR with more inputs: an odd number of 1sXOR بە نێوخستەی زیاتر: ژمارەیەکی تاکی 1

A 3-input XOR is built as a chain of 2-input XORs: X=(A⊕B)⊕CX = (A \oplus B) \oplus C. The grouping does not matter, so we just write A⊕B⊕CA \oplus B \oplus C. Follow one row: each XOR flips the result whenever a new 1 arrives. So the output is 1 exactly when the number of 1s is odd.

سێ وەک زنجیرەیەک لە XORـی دوو دروست دەکرێت: X=(A⊕B)⊕CX = (A \oplus B) \oplus C. کۆمەڵکردنەکە گرنگ نییە، بۆیە تەنها دەنووسین A⊕B⊕CA \oplus B \oplus C. یەک ڕیز پەیڕەو بکە: هەر XORـێک ئەنجامەکە پێچەوانە دەکاتەوە هەر کاتێک 1ـێکی نوێ بگات. کەواتە ڕێک کاتێک 1ـە کە ژمارەی 1ـەکان تاک بێت.

Two XOR gates in a chain: A and B go into the first, its output A XOR B goes into the second together with C, and the output is X = A XOR B XOR C. With A = B = C = 1 the first gate gives 0 and the second gives 1. A table below lists the eight inputs 000 to 111, the number of 1s in each (0 1 1 2 1 2 2 3) and X (0 1 1 0 1 0 0 1); X is 1 where the count is odd.دوو گەیتی XOR بە زنجیرە: A و B دەچنە ناو یەکەمیان، دەرخستەکەی (A XOR B) لەگەڵ C دەچێتە ناو دووەمیان و دەرخستە X = A XOR B XOR Cـە. بە A = B = C = 1، یەکەمیان 0 و دووەمیان 1 دەدات. خشتەیەک لە خوارەوە هەشت نێوخستەکەی 000 تا 111، ژمارەی 1ـەکانی هەر یەکێکیان (0 1 1 2 1 2 2 3) و X (0 1 1 0 1 0 0 1) ڕیز دەکات؛ X لەو شوێنانەدا 1ـە کە ژمارەکە تاکە.
A chain of XOR gates outputs 1 for an odd number of 1s.زنجیرەیەک لە بۆ ژمارەیەکی تاکی 1، 1 دەدات.CêIT
3-input XOR and XNORXOR و XNORـی سێ
ABCNumber of 1sژمارەی 1ـەکانA⊕B⊕CA \oplus B \oplus CA⊕B⊕C‾\overline{A \oplus B \oplus C}
000001
001110
010110
011201
100110
101201
110201
111310
Quick checkپشکنینی خێراWhat is 1⊕0⊕1⊕11 \oplus 0 \oplus 1 \oplus 1?1⊕0⊕1⊕11 \oplus 0 \oplus 1 \oplus 1 چەندە؟

XOR with more inputs: an odd number of 1sXOR بە نێوخستەی زیاتر: ژمارەیەکی تاکی 1

XOR finds errors: parityXOR هەڵە دەدۆزێتەوە: پاریتی

The odd-number rule is exactly what a parity bit needs. The sender XORs all the data bits. The result is 1 when the data has an odd number of 1s, so sending it as the even-parity bit makes the total number of 1s even. The receiver XORs every bit it gets, the parity bit included. A 0 means “the count is even, no error seen”; a 1 means at least one bit changed on the way.

یاسای ژمارەی تاک ڕێک ئەوەیە کە بیتی پاریتی پێویستیەتی. نێرەر هەموو XOR دەکات. ئەنجامەکە 1ـە کاتێک ژمارەیەکی تاکی 1ـی تێدا بێت، بۆیە ناردنی وەک جووت، کۆی ژمارەی 1ـەکان دەکاتە جووت. وەرگر هەموو ئەو وەریدەگرێت، ، XOR دەکات. 0 واتە «ژمارەکە جووتە، هیچ هەڵەیەک نەبینرا»؛ 1 واتە لانیکەم لە ڕێگادا گۆڕاوە.

Left: a parity generator. Data bits D3 to D0 = 1 0 1 1 enter two XOR gates (1 XOR 0 = 1, 1 XOR 1 = 0) whose outputs enter a third XOR, giving P = 1. Right: a parity checker. The received word 1011 with parity 1 gives XOR 0, no error found; 1001 with parity 1 (one bit flipped) gives 1, an error; 1101 with parity 1 (two bits flipped) gives 0, so the error is missed.لای چەپ: دروستکەری پاریتی. بیتەکانی دراوە، D3 تا D0 = 1 0 1 1، دەچنە ناو دوو گەیتی XOR (1 XOR 0 = 1 و 1 XOR 1 = 0) و دەرخستەکانیان دەچنە ناو XORـێکی سێیەم کە P = 1 دەدات. لای ڕاست: پشکنەری پاریتی. وشەی وەرگیراوی 1011 بە پاریتیی 1، XORـی 0 دەدات و هیچ هەڵەیەک نادۆزرێتەوە؛ 1001 بە پاریتیی 1 (یەک بیت گۆڕاوە) 1 دەدات، واتە هەڵە؛ 1101 بە پاریتیی 1 (دوو بیت گۆڕاون) 0 دەدات، بۆیە هەڵەکە نابینرێت.
A tree of XOR gates makes the parity bit; another XOR tree checks it.دارێک لە دروست دەکات؛ دارێکی تری XOR دەیپشکنێت.CêIT

Try it with ASCII: the letter C is 1000011, which has three 1s. Its XOR is 1, so with even parity the byte sent is 11000011. If noise flips one bit, the receiver's XOR becomes 1 and the error is caught; if two bits flip, the XOR is 0 again and the error slips through.

بە ASCII تاقی بکەرەوە: پیتی C بریتییە لە 1000011 کە سێ دانە 1ـی تێدایە. XORـەکەی 1ـە، بۆیە بە جووت ئەو دەنێردرێت 11000011ـە. ئەگەر یەک بگۆڕێت، XORـی وەرگر دەبێتە 1 و هەڵەکە دەگیرێت؛ ئەگەر دوو بگۆڕێن، XOR دیسان دەبێتە 0 و هەڵەکە تێدەپەڕێت.

Quick checkپشکنینی خێراA receiver XORs all 8 bits of the byte 10110100 (parity bit included). What does it conclude?وەرگرێک هەر 8 10110100 (لەگەڵ ) XOR دەکات. چ ئەنجامێک وەردەگرێت؟

Error detection: Parity checkingBen Eater · Englishئینگلیزی · 392K viewsبینین · 11K likesلایک · Partبەشی 5:03–14:05 (ofلە 21:41)

How one parity bit catches a bit flipped on a wire, and how XOR gates compute parity, using ASCII text such as "hello world".

یەک چۆن دەدۆزێتەوە کە لەسەر وایەرێک پێچەوانە بووەتەوە، هەروەها چۆن هەژمار دەکەن، بە نموونەی دەقی وەک «⁦hello world⁩».

5:03-14:05: the XOR parity idea (odd number of 1s), building the circuit and testing that it catches an error.

لە ⁦5:03⁩ تا ⁦14:05⁩: بیرۆکەی بە XOR (ژمارەی تاکی 1ـەکان)، دروستکردنی و تاقیکردنەوەی ئەوەی کە هەڵەیەک دەدۆزێتەوە.

XOR with more inputs: an odd number of 1sXOR بە نێوخستەی زیاتر: ژمارەیەکی تاکی 1

Other jobs for XORکارەکانی تری XOR

  • A controlled inverter. A⊕0=AA \oplus 0 = A and A⊕1=A‾A \oplus 1 = \overline{A}. One input decides whether the other passes through unchanged or is inverted — useful for making 1's complements on demand.
  • The sum bit of binary addition. In binary addition 1+1=101 + 1 = 10: the sum bit is 0 and the carry is 1. The sum bit of two bits is always A⊕BA \oplus B, and the carry is ABAB. This pair is called a half adder.
  • Gray code. Converting between binary and the Gray code uses XOR on neighbouring bits.
  • پێچەوانەکەرێکی کۆنترۆڵکراو. A⊕0=AA \oplus 0 = A و A⊕1=A‾A \oplus 1 = \overline{A}. یەکێک لە بڕیار دەدات کە ئەوی تر وەک خۆی تێبپەڕێت یان پێچەوانە بکرێتەوە — بەسوودە بۆ دروستکردنی هەر کاتێک پێویست بێت.
  • کۆی . لە کۆکردنەوەی دووانیـدا 1+1=101 + 1 = 10: کۆ 0ـە و 1ـە. کۆی دوو هەمیشە A⊕BA \oplus Bـە و ABABـە. ئەم جووتە پێی دەوترێت نیوەکۆکەرەوە.
  • . گۆڕین لە نێوان و کۆدی گرەی XOR لەسەر دراوسێ بەکار دەهێنێت.
Quick checkپشکنینی خێراYou want a circuit that inverts A only when a control input K is 1. Which gate do you use?سووڕێکت دەوێت کە A تەنها کاتێک پێچەوانە بکاتەوە کە کۆنترۆڵی ⁦K 1⁩ بێت. کام بەکار دەهێنیت؟

The XNOR gateگەیتی XNOR

The exclusive-NOR gate, XNOR, is an XOR followed by a NOT; its symbol is the XOR symbol with a bubble on the output. Its output is the opposite of XOR in every row: 1 when the inputs are the same (both LOW or both HIGH) and 0 when they are different. That is why it is also called an equality or equivalence gate.

(⁦exclusive-NOR⁩) بریتییە لە XOR و پاشان NOT؛ XORـە بە بازنەیەک لەسەر . لە هەموو ڕیزێکدا پێچەوانەی XORـە: 1ـە کاتێک وەک یەک بن (هەردووکیان LOW یان هەردووکیان HIGH) و 0ـە کاتێک جیاواز بن. بۆیە پێشی دەوترێت یەکسانی.

Definitionپێناسە

An XOR gate followed by a NOT gate: its output is 1 when the inputs are equal. It is written A⊕B‾\overline{A \oplus B}.

بریتییە لە کە بەدوایدا دێت: 1ـە کاتێک یەکسان بن. بە A⊕B‾\overline{A \oplus B} دەنووسرێت.

Truth table of the XNOR gate
ABX=A⊕B‾X = \overline{A \oplus B}
001
010
100
111
A⊕B‾=AB+A‾ B‾\overline{A \oplus B} = AB + \overline{A}\,\overline{B}

The two product terms pick the two “same” rows: AB for 11 and A‾ B‾\overline{A}\,\overline{B} for 00.

هەردوو دوو ڕیزە «وەک یەک»ـەکە هەڵدەبژێرن: AB بۆ ⁦11⁩ و A‾ B‾\overline{A}\,\overline{B} بۆ ⁦00⁩.

Quick checkپشکنینی خێراAn XNOR gate has A=0A = 0 and B=0B = 0. What is the output? A=0A = 0 و B=0B = 0ـی هەیە. چییە؟

The XNOR gateگەیتی XNOR

One gate, three namesیەک گەیت، سێ ناو

The slides use three spellings for each gate, and you will meet all of them in books and data sheets: XOR = EXOR = EOR (exclusive-OR) and XNOR = EXNOR = ENOR (exclusive-NOR). The IEC rectangular symbol of XOR carries the mark =1; XNOR adds a bubble. A common chip is the 74HC86 with four 2-input XOR gates.

سلایدەکان سێ شێوەی نووسین بۆ هەر بەکار دەهێنن و هەموویان لە کتێب و پەڕەی زانیاریی دەبینیت: ⁦XOR = EXOR = EOR⁩ ⁦(exclusive-OR)⁩ و ⁦XNOR = EXNOR = ENOR⁩ ⁦(exclusive-NOR)⁩. لاکێشەییەکەی IECـی XOR نیشانەی =1ـی هەیە؛ XNOR بازنەیەکی بۆ زیاد دەکات. باو ⁦74HC86⁩ـە کە چوار دوو تێدایە.

Quick checkپشکنینی خێراA data sheet lists an “EXNOR” gate. Which gate is it?پەڕەی زانیاریی باسی «EXNOR» دەکات. ئەمە کام ؟

The XNOR gateگەیتی XNOR

XNOR as an equality detectorXNOR وەک دۆزەرەوەی یەکسانی

Because XNOR says 1 for equal bits, it can compare numbers. Put one XNOR on each pair of matching bits and send all their outputs into an AND gate. The AND output is 1 only if every pair matches, that is, only if the two numbers are equal. This is the heart of a Comparator.

چونکە XNOR بۆ یەکسان 1 دەڵێت، دەتوانێت ژمارە بەراورد بکات. بۆ هەر جووتێک لە هاوشوێن XNORـێک دابنێ و هەموو بنێرە بۆ ناو . AND تەنها کاتێک 1ـە کە هەموو جووتەکان وەک یەک بن، واتە تەنها کاتێک دوو ژمارەکە یەکسان بن. ئەمە دڵی بەراوردکەرێکە.

Four XNOR gates compare A3 with B3, A2 with B2, A1 with B1 and A0 with B0, for A = 1011 and B = 1011. Each XNOR outputs 1, and a 4-input AND gate gives EQUAL = 1.چوار گەیتی XNOR، A3 لەگەڵ B3، A2 لەگەڵ B2، A1 لەگەڵ B1 و A0 لەگەڵ B0 بەراورد دەکەن، بۆ A = 1011 و B = 1011. هەر XNORـێک 1 دەدات و گەیتێکی ANDـی چوار نێوخستە یەکسان = 1 دەدات.
A 4-bit equality check: four XNORs and one AND.پشکنینی یەکسانیی 4 : چوار XNOR و یەک AND.CêIT
Quick checkپشکنینی خێراThe circuit compares A=1011A = 1011 with B=1001B = 1001. Which XNOR gives 0, and what is EQUAL?سووڕەکە A=1011A = 1011 لەگەڵ B=1001B = 1001 بەراورد دەکات. کام ⁦XNOR 0⁩ دەدات و یەکسان چەندە؟

XOR and XNOR in a timing diagramXOR و XNOR لە هێڵکاریی کاتبەندیدا

Feed the same two waveforms to an XOR gate and to an XNOR gate. The XOR output is HIGH in every interval where A and B differ. The XNOR output is HIGH where they are equal. So the XNOR waveform is the XOR waveform turned upside down.

هەمان دوو بدە بە و بە . XOR لە هەموو ئەو ماوانەدا HIGHـە کە A و B جیاوازن. XNOR لەو شوێنانەدا HIGHـە کە وەک یەکن. کەواتە XNOR هەمان XORـە بە سەرەوژێری.

Timing diagram over eight intervals. A is 0 1 1 0 1 0 1 1 and B is 0 0 1 1 1 0 0 1. XOR is 0 1 0 1 0 0 1 0, high where A and B differ. XNOR is 1 0 1 0 1 1 0 1, the exact inverse of XOR.هێڵکاریی کاتبەندی لە هەشت ماوەدا. A بریتییە لە 0 1 1 0 1 0 1 1 و B لە 0 0 1 1 1 0 0 1. XOR بریتییە لە 0 1 0 1 0 0 1 0 کە لەو شوێنانەدا HIGHـە کە A و B جیاوازن. XNOR بریتییە لە 1 0 1 0 1 1 0 1، ڕێک پێچەوانەی XOR.
XOR marks the intervals where A≠BA \neq B; XNOR marks those where A=BA = B.XOR ماوەکانی A≠BA \neq B نیشان دەدات؛ XNOR ماوەکانی A=BA = B.CêIT
Quick checkپشکنینی خێراIn some interval A=1A = 1 and B=1B = 1. What are the XOR and XNOR outputs there?لە ماوەیەکدا A=1A = 1 و B=1B = 1ـە. XOR و XNOR لەوێدا چین؟

All gates at a glanceهەموو گەیتەکان بە یەک سەیرکردن

You now know all seven gates of this chapter. The chart puts each one's symbol, expression and outputs side by side. NOT has one input; the others are shown with two inputs A and B.

ئێستا هەر حەوت ئەم بەشە دەناسیت. ئەم هێڵکارییە ، و هەر یەکێکیان لە تەنیشت یەکەوە دادەنێت. NOT یەک هەیە؛ ئەوانی تر بە دوو A و B پیشان دراون.

A chart with one row per gate. NOT: triangle with bubble, X = A-bar, A = 0 gives 1 and A = 1 gives 0. AND: X = AB, outputs 0 0 0 1. NAND: X = complement of AB, 1 1 1 0. OR: X = A + B, 0 1 1 1. NOR: complement of A + B, 1 0 0 0. XOR: A XOR B, 0 1 1 0. XNOR: complement of A XOR B, 1 0 0 1. The outputs are for AB = 00, 01, 10, 11.هێڵکارییەک کە بۆ هەر گەیتێک ڕیزێکی هەیە. NOT: سێگۆشە بە بازنە، X = Ā، A = 0 دەبێتە 1 و A = 1 دەبێتە 0. AND: X = AB، دەرخستەکان: 0 0 0 1. NAND: تەواوکەری AB، 1 1 1 0. OR: X = A + B، 0 1 1 1. NOR: تەواوکەری A + B، 1 0 0 0. XOR: A XOR B، 0 1 1 0. XNOR: تەواوکەری A XOR B، 1 0 0 1. دەرخستەکان بۆ AB = 00، 01، 10، 11ـن.
The seven gates: symbol, expression and outputs.حەوت : ، و .CêIT
Summary truth table of the 2-input gates کۆتایی بۆ دوو
ABANDNANDORNORXORXNOR
00010101
01011010
10011010
11101001
The NOT gate has one input تەنها یەک هەیە
AA‾\overline{A}
01
10

Read the summary table in pairs: NAND is the column of AND inverted, NOR is OR inverted and XNOR is XOR inverted. Notice also which gates give 1 for exactly one row (AND, NOR) and which give 0 for exactly one row (NAND, OR).

خشتە کۆتاییەکە دوو بە دوو بخوێنەوە: NAND ستوونی ANDـە بە پێچەوانەکراوی، NOR ستوونی ORـە بە پێچەوانەکراوی و XNOR ستوونی XORـە بە پێچەوانەکراوی. هەروەها سەرنج بدە کام تەنها بۆ یەک ڕیز 1 دەدەن (AND، NOR) و کامیان تەنها بۆ یەک ڕیز 0 دەدەن (NAND، OR).

Quick checkپشکنینی خێراWhich gate's output column for AB=00AB = 00, 01, 10, 11 is 1 0 0 0?ستوونی کام بۆ AB=00AB = 00، ⁦01⁩، ⁦10⁩، ⁦11⁩ بریتییە لە ⁦1 0 0 0⁩؟

All gates at a glanceهەموو گەیتەکان بە یەک سەیرکردن

Why only these gates?بۆچی تەنها ئەم گەیتانە؟

A gate is fully described by the output column of its truth table. With 2 inputs the table has 4 rows, so the column has 4 cells, each 0 or 1. That gives exactly 24=162^4 = 16 different 2-input gates. With 3 inputs the table has 8 rows and there are 28=2562^8 = 256 gates; with n inputs, 22n2^{2^n}.

بە تەواوی بە ستوونی دیاری دەکرێت. بە دوو ، خشتەکە چوار ڕیزی هەیە، کەواتە ستوونەکە چوار خانەی هەیە و هەر خانەیەک 0 یان 1ـە. ئەمە ڕێک 24=162^4 = 16 جۆری جیاوازی بە دوو دەدات. بە سێ ، خشتەکە هەشت ڕیزی هەیە و 28=2562^8 = 256 جۆر هەیە؛ بە n ، 22n2^{2^n} جۆر.

Most of the 16 are not interesting. Two always give the same value (always 0, always 1). Four only pass or invert one input (A, B, A‾\overline{A}, B‾\overline{B}). Four more are an AND or an OR with one input inverted (AB‾A\overline{B}, A‾B\overline{A}B, A+B‾A + \overline{B}, A‾+B\overline{A} + B). The six that remain — AND, NAND, OR, NOR, XOR and XNOR — are the useful ones that got their own names and chips.

زۆربەی ئەم ⁦16⁩ جۆرە سەرنجڕاکێش نین. دووانیان هەمیشە هەمان نرخ دەدەن (هەمیشە 0، هەمیشە ⁦1⁩). چواریان تەنها وەک خۆی یان پێچەوانەکراو تێدەپەڕێنن (A، B، A‾\overline{A}، B‾\overline{B}). چواری تر AND یان ORـن کە یەکێک لە پێچەوانە کراوەتەوە (AB‾A\overline{B}، A‾B\overline{A}B، A+B‾A + \overline{B}، A‾+B\overline{A} + B). ئەو شەشەی دەمێننەوە — AND، NAND، OR، NOR، XOR و XNOR — بەسوودەکانن و ناو و تایبەتی خۆیان هەیە.

Quick checkپشکنینی خێراHow many different 2-input logic gates are possible?چەند جۆری جیاوازی بە دوو دەکرێت هەبێت؟

Common mistakesهەڵە باوەکان

MistakeهەڵەWhat is rightڕاستەکەی
Treating XOR like OR: “1 if either input is 1”.مامەڵەکردن لەگەڵ XOR وەک OR: «1ـە ئەگەر هەر 1 بێت».XOR is 1 only when the inputs differ; 1⊕1=01 \oplus 1 = 0.XOR تەنها کاتێک 1ـە کە جیاواز بن؛ 1⊕1=01 \oplus 1 = 0.
Writing XNOR as A⊕BA \oplus B.نووسینی XNOR وەک A⊕BA \oplus B.XNOR is A⊕B‾\overline{A \oplus B} (or A⊙BA \odot B).XNOR بریتییە لە A⊕B‾\overline{A \oplus B} (یان A⊙BA \odot B).
Thinking a 3-input XOR means “exactly one input is 1”.بیرکردنەوە لەوەی XORـی سێ واتە «ڕێک یەک 1ـە».A chain of XORs gives 1 for an odd number of 1s, so 111 gives 1.زنجیرەیەک XOR بۆ ژمارەیەکی تاکی 1، 1 دەدات، بۆیە ⁦111⁩ دەبێتە 1.
Confusing XOR with binary addition.تێکەڵکردنی XOR لەگەڵ .XOR gives only the sum bit; binary addition also produces a carry: 1+1=101 + 1 = 10.XOR تەنها کۆ دەدات؛ دروست دەکات: 1+1=101 + 1 = 10.
Forgetting the extra curved line when drawing XOR.لەبیرکردنی هێڵە کەوانەییە زیادەکە لە کاتی کێشانی XOR.Without it the symbol is an ordinary OR gate.بەبێ ئەو هێڵە ئاساییە.

Exercisesڕاهێنانەکان

ExerciseڕاهێنانOdd or even?تاک یان جووت؟

Find X=A⊕B⊕C⊕DX = A \oplus B \oplus C \oplus D for ABCD=1101ABCD = 1101, 0110 and 1111.

X=A⊕B⊕C⊕DX = A \oplus B \oplus C \oplus D بۆ ABCD=1101ABCD = 1101، ⁦0110⁩ و ⁦1111⁩ بدۆزەرەوە.

Hintئاماژە

Count the 1s; XOR of many bits is 1 for an odd count.

1ـەکان بژمێرە؛ XORـی چەند بۆ ژمارەیەکی تاک 1ـە.

Show answerوەڵامەکە پیشان بدە
  • 1101 has three 1s (odd) → X=1X = 1.
  • 0110 has two 1s (even) → X=0X = 0.
  • 1111 has four 1s (even) → X=0X = 0.
  • ⁦1101⁩ سێ دانە 1ـی هەیە (تاک) ← X=1X = 1.
  • ⁦0110⁩ دوو دانە 1ـی هەیە (جووت) ← X=0X = 0.
  • ⁦1111⁩ چوار دانە 1ـی هەیە (جووت) ← X=0X = 0.
ExerciseڕاهێنانMake the parity bitبیتی پاریتی دروست بکە

The 7-bit ASCII code of the letter S is 1010011. Find its even-parity bit with XOR and write the 8-bit byte that is sent (parity bit first).

کۆدی ASCIIـی پیتی S بە 7 بریتییە لە 1010011. جووتەکەی بە XOR بدۆزەرەوە و ئەو 8 بنووسە کە دەنێردرێن ( لە پێشەوە).

Show answerوەڵامەکە پیشان بدە

The code has four 1s, so the XOR of its bits is 0 and the parity bit is 0. The byte sent is 01010011, which still has four 1s (even).

کۆدەکە چوار دانە 1ـی هەیە، بۆیە XORـی 0ـە و 0ـە. ئەو دەنێردرێت 01010011ـە کە هێشتا چوار دانە 1ـی هەیە (جووت).

ExerciseڕاهێنانDesign a 3-bit parity generator and checkerدروستکەر و پشکنەری پاریتیی سێ بیت دیزاین بکە

Three data bits A, B and C are sent with an even-parity bit P. (a) Write the truth table of P and show that P=A⊕B⊕CP = A \oplus B \oplus C. How many 2-input XOR gates does the generator need? (b) The receiver gets A, B, C and P. Design the checker E, where E=1E = 1 means “error”. (c) The data 101 is sent and noise flips B on the way. What does the checker show?

سێ A، B و C لەگەڵ جووتی P دەنێردرێن. (أ) P بنووسە و پیشانی بدە کە P=A⊕B⊕CP = A \oplus B \oplus C. دروستکەرەکە پێویستی بە چەند دوو هەیە؟ (ب) وەرگر A، B، C و P وەردەگرێت. پشکنەری E دیزاین بکە کە E=1E = 1 واتە «هەڵە». (ج) ⁦101⁩ دەنێردرێت و لە ڕێگادا B دەگۆڕێت. پشکنەرەکە چی پیشان دەدات؟

Hintئاماژە

Use the generator and checker of the parity screen, with three data bits instead of four.

دروستکەر و پشکنەرەکەی پەڕەی بەکار بهێنە، بەڵام بە سێ لە جیاتی چوار.

Show answerوەڵامەکە پیشان بدە
Even-parity bit for three data bits جووت بۆ سێ
ABCNumber of 1sژمارەی 1ـەکانP=A⊕B⊕CP = A \oplus B \oplus C
00000
00111
01011
01120
10011
10120
11020
11131

(a) P is 1 exactly when the data has an odd number of 1s, so the four bits together always have an even number of 1s. That is the odd-number rule of XOR: P=A⊕B⊕CP = A \oplus B \oplus C, two 2-input XOR gates in a chain (A⊕BA \oplus B, then ⊕ C\oplus\, C).

(أ) P ڕێک کاتێک 1ـە کە ژمارەیەکی تاکی 1ـی تێدا بێت، بۆیە هەر چوار پێکەوە هەمیشە ژمارەیەکی جووتی 1ـیان هەیە. ئەمە یاسای ژمارەی تاکی XORـە: P=A⊕B⊕CP = A \oplus B \oplus C، دوو دوو بە زنجیرە (سەرەتا A⊕BA \oplus B، پاشان ⊕ C\oplus\, C).

(b) The checker XORs all four received bits: E=A⊕B⊕C⊕PE = A \oplus B \oplus C \oplus P, three 2-input XOR gates. Without an error the four bits have an even number of 1s, so E=0E = 0.

(ب) پشکنەرەکە هەموو ئەو چوار XOR دەکات کە وەریگرتوون: E=A⊕B⊕C⊕PE = A \oplus B \oplus C \oplus P، سێ دوو . ئەگەر هەڵە نەبێت، چوار ژمارەیەکی جووتی 1ـیان هەیە، بۆیە E=0E = 0.

(c) For 101 the generator sends P=1⊕0⊕1=0P = 1 \oplus 0 \oplus 1 = 0. The receiver gets 1 1 1 with P=0P = 0: E=1⊕1⊕1⊕0=1E = 1 \oplus 1 \oplus 1 \oplus 0 = 1, so the error is caught.

(ج) بۆ ⁦101⁩، دروستکەرەکە P=1⊕0⊕1=0P = 1 \oplus 0 \oplus 1 = 0 دەنێرێت. وەرگر ⁦1 1 1⁩ لەگەڵ P=0P = 0 وەردەگرێت: E=1⊕1⊕1⊕0=1E = 1 \oplus 1 \oplus 1 \oplus 0 = 1، بۆیە هەڵەکە دەدۆزرێتەوە.

ExerciseڕاهێنانDraw the outputsدەرخستەکان بکێشە

Over six intervals A=0 1 1 0 0 1A = 0\ 1\ 1\ 0\ 0\ 1 and B=1 1 0 0 1 1B = 1\ 1\ 0\ 0\ 1\ 1. Write the XOR and the XNOR output for each interval.

لە شەش ماوەدا A=0 1 1 0 0 1A = 0\ 1\ 1\ 0\ 0\ 1 و B=1 1 0 0 1 1B = 1\ 1\ 0\ 0\ 1\ 1ـە. XOR و XNOR بۆ هەر ماوەیەک بنووسە.

Show answerوەڵامەکە پیشان بدە
Intervalماوەt1t2t3t4t5t6
A011001
B110011
XOR101010
XNOR010101

Exercisesڕاهێنانەکان

More exercisesڕاهێنانی زیاتر

ExerciseڕاهێنانWhich gate?کام گەیت؟

Name the gate: (a) the output is 1 only when both inputs are equal; (b) the output is 0 only when all inputs are 1; (c) the output is 1 when an odd number of inputs are 1; (d) the output is 1 when at least one input is 1.

ناوی بنێ: (أ) تەنها کاتێک 1ـە کە هەردوو یەکسان بن؛ (ب) تەنها کاتێک 0ـە کە هەموو 1 بن؛ (ج) 1ـە کاتێک ژمارەیەکی تاک لە 1 بن؛ (د) 1ـە کاتێک لانیکەم یەک 1 بێت.

Show answerوەڵامەکە پیشان بدە
  • (a) XNOR — equality
  • (b) NAND — 0 only when all are 1
  • (c) XOR — odd number of 1s
  • (d) OR — at least one 1
  • (أ) — یەکسانی
  • (ب) — 0 تەنها کاتێک هەموو 1 بن
  • (ج) — ژمارەی تاکی 1
  • (د) — لانیکەم یەک 1
ExerciseڕاهێنانXOR from basic gatesXOR لە گەیتە بنەڕەتییەکان

Show with a truth table that AB‾+A‾BA\overline{B} + \overline{A}B and (A+B) AB‾(A + B)\,\overline{AB} both equal A⊕BA \oplus B.

بە پیشانی بدە کە AB‾+A‾BA\overline{B} + \overline{A}B و (A+B) AB‾(A + B)\,\overline{AB} هەردووکیان یەکسانن بە A⊕BA \oplus B.

Show answerوەڵامەکە پیشان بدە
ABAB‾A\overline{B}A‾B\overline{A}BAB‾+A‾BA\overline{B} + \overline{A}BA+BA + BAB‾\overline{AB}(A+B) AB‾(A + B)\,\overline{AB}A⊕BA \oplus B
000000100
010111111
101011111
110001000

All three last columns are 0 1 1 0, so the expressions are equal.

هەر سێ ستوونی کۆتایی ⁦0 1 1 0⁩ـن، بۆیە یەکسانن.

ExerciseڕاهێنانCompare two numbersدوو ژمارە بەراورد بکە

With four XNOR gates and an AND gate, compare A=0110A = 0110 and B=0111B = 0111. Give each XNOR output and the final result.

بە چوار و ، A=0110A = 0110 و B=0111B = 0111 بەراورد بکە. هەر XNORـێک و ئەنجامی کۆتایی بنووسە.

Show answerوەڵامەکە پیشان بدە

Bit 3: 0, 0 → 1. Bit 2: 1, 1 → 1. Bit 1: 1, 1 → 1. Bit 0: 0, 1 → 0. The AND of 1, 1, 1, 0 is 0, so the numbers are not equal.

⁦3: 0⁩، 0 ← 1. ⁦2: 1⁩، 1 ← 1. ⁦1: 1⁩، 1 ← 1. ⁦0: 0⁩، 1 ← ⁦0. AND⁩ـی 1، 1، 1، 0 دەبێتە 0، بۆیە ژمارەکان یەکسان نین.

Summaryپوختە

  • XOR, A⊕BA \oplus B: 1 when the inputs differ; A⊕B=AB‾+A‾BA \oplus B = A\overline{B} + \overline{A}B.
  • OR and XOR differ only in the row A=B=1A = B = 1.
  • Many-input XOR = 1 for an odd number of 1s, which makes and checks parity bits.
  • XNOR, A⊕B‾\overline{A \oplus B}: 1 when the inputs are equal (an equality detector).
  • Names: XOR = EXOR = EOR; XNOR = EXNOR = ENOR.
  • Pairs: NAND = NOT AND, NOR = NOT OR, XNOR = NOT XOR.
  • XOR، A⊕BA \oplus B: 1ـە کاتێک جیاواز بن؛ A⊕B=AB‾+A‾BA \oplus B = A\overline{B} + \overline{A}B.
  • OR و XOR تەنها لە ڕیزی A=B=1A = B = 1دا جیاوازن.
  • XORـی چەند بۆ ژمارەیەکی تاکی 1، 1 دەدات؛ بەمەش دروست دەکات و دەیپشکنێت.
  • XNOR، A⊕B‾\overline{A \oplus B}: 1ـە کاتێک یەکسان بن (دۆزەرەوەی یەکسانی).
  • ناوەکان: ⁦XOR = EXOR = EOR⁩؛ ⁦XNOR = EXNOR = ENOR⁩.
  • جووتەکان: ⁦NAND = NOT AND⁩، ⁦NOR = NOT OR⁩، ⁦XNOR = NOT XOR⁩.
Review questionsپرسیارەکانی پێداچوونەوە
When is the output of an XOR gate 1?دەرخستەی گەیتی XOR کەی 1ـە؟

When its two inputs are different (for many inputs: an odd number of 1s).

کاتێک دوو جیاواز بن (بۆ چەند : ژمارەیەکی تاکی ⁦1⁩).

How is XNOR written?XNOR چۆن دەنووسرێت؟

A⊕B‾\overline{A \oplus B}, which equals AB+A‾ B‾AB + \overline{A}\,\overline{B}.

A⊕B‾\overline{A \oplus B} کە یەکسانە بە AB+A‾ B‾AB + \overline{A}\,\overline{B}.

Which gate tells whether a byte has an odd number of 1s?کام گەیت دەڵێت ئایا بایتێک ژمارەیەکی تاکی 1ـی تێدایە؟

A tree of XOR gates (a parity generator/checker).

دارێک لە (دروستکەر/پشکنەری ).

Which three gates are “NOT” versions of AND, OR and XOR?کام سێ گەیت وەشانی «NOT»ـی AND، OR و XORـن؟

NAND, NOR and XNOR.

NAND، NOR و XNOR.

Videoڤیدیۆ

Watch a videoسەیری ڤیدیۆیەک بکە

A video that viewers liked a lot and praised in their comments, chosen for this lesson.ڤیدیۆیەک کە بینەران زۆریان پێ خۆش بووە و لە کۆمێنتەکانیاندا ستایشیان کردووە، بۆ ئەم وانەیە هەڵبژێردراوە.

Understanding Logic GatesSpanning Tree · Englishئینگلیزی · 1.5M viewsبینین · 34K likesلایک · Partبەشی 5:17–7:27 (ofلە 7:27)

From transistors to the seven logic gates: NOT, AND, OR, NAND, NOR, XOR and XNOR, with their symbols and truth tables.

لە بۆ حەوت : NOT، AND، OR، NAND، NOR، XOR و XNOR، لەگەڵ و .

Chapter 'XOR and XNOR' (5:17-end): XOR truth table 0 1 1 0 and XNOR as its inverse.

بەشی XOR and XNOR (لە ⁦5:17⁩ـەوە تا کۆتایی): ⁦XOR (0 1 1 0)⁩ و XNOR وەک پێچەوانەکەی.

Lesson complete!وانەکە تەواو بوو!

Well done. Review the key terms, then go on to the next lesson.دەستخۆش. سەیرێکی زاراوە سەرەکییەکان بکەرەوە، پاشان بڕۆ بۆ وانەی داهاتوو.

Key termsزاراوە سەرەکییەکان

Next lessonوانەی داهاتوو

Building Gates from Transistorsدروستکردنی گەیتەکان لە ترانزیستۆرەکانەوە

References and further readingسەرچاوەکان و خوێندنەوەی زیاتر

This lecture is a first edition. The Kurdish text and terminology are waiting for review by Kurdish IT teachers.ئەم وانەیە چاپی یەکەمە. دەقە کوردییەکە و زاراوەکانی چاوەڕێی پێداچوونەوەی مامۆستایانی کوردی بواری IT ن.