Chapterبەش 10 · Lectureوانە 10.1

Multiplexers, Decoders and Encodersمەڵتیپلێکسەرەکان، کۆدهەڵوەشێنەرەکان و کۆدکەرەکان

The first chapter of building blocks: multiplexers choose one input with select lines, demultiplexers send one input to one of many outputs, decoders turn a code into one active line (and drive 7-segment displays), encoders and priority encoders do the reverse, any function can be built from a decoder or a multiplexer, and comparators decide which number is larger.

یەکەم وانەی بلۆکە بنیاتنەرەکان: بە هێڵەکانی هەڵبژاردن یەک هەڵدەبژێرن، یەک دەنێرن بۆ یەکێک لە چەند ، کۆدێک دەکەن بە یەک هێڵی چالاک (و دەجووڵێنن)، و پێچەوانەکەی دەکەن، هەر بە یان دروست دەکرێت و بڕیار دەدەن کام ژمارە گەورەترە.

23 min read26 خولەک خوێندنەوە · 21 stepsهەنگاو

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

  • Explain how a multiplexer selects one of 2n2^n inputs with n select lines, and write Y=S‾D0+SD1Y = \overline{S}D_0 + SD_1.
  • Use demultiplexers, decoders (with enable and active-low outputs) and BCD-to-7-segment decoders.
  • Explain why a simple encoder fails with two active inputs and how a priority encoder solves it.
  • Build any Boolean function with a decoder and an OR gate, or with a multiplexer.
  • Compare two binary numbers with a magnitude comparator.
  • ڕوون بکەیتەوە چۆن بە n هێڵی هەڵبژاردن یەکێک لە 2n2^n هەڵدەبژێرێت و Y=S‾D0+SD1Y = \overline{S}D_0 + SD_1 بنووسیت.
  • ، (بە چالاککردن و چالاک بە LOW) و BCD بۆ حەوت بەش بەکار بهێنیت.
  • ڕوون بکەیتەوە بۆچی سادە بە دوو چالاک شکست دەهێنێت و چۆن چارەسەری دەکات.
  • هەر بە و ، یان بە دروست بکەیت.
  • دوو ژمارەی بە قەبارە بەراورد بکەیت.

From gates to building blocksلە گەیتەکانەوە بۆ بلۆکە بنیاتنەرەکان

So far you have built every circuit gate by gate: an adder is a few XOR, AND and OR gates wired together. Real designers rarely start from single gates. They reuse ready-made building blocks — small circuits with one clear job, such as choosing one signal out of four or turning a binary number into one lit lamp. A chip with such a block holds roughly 10 to 100 gates: an MSI chip, one step up from the SSI gate chips in Power, delay and fan-out.

تا ئێستا هەموو بە دروست کرد: بریتییە لە چەند XOR، AND و OR کە پێکەوە بەستراون. دیزاینەرە ڕاستەقینەکان کەم لە تاکە دەست پێ دەکەن. ئەوان بلۆکی بنیاتنەری ئامادە دووبارە بەکار دەهێننەوە — بچووک کە هەر یەکەیان کارێکی ڕوونی هەیە، وەک هەڵبژاردنی یەک لە چوار، یان گۆڕینی ژمارەیەکی بۆ ڕووناککردنەوەی تەنها یەک چرا. کە بلۆکێکی وەهای تێدا بێت نزیکەی ⁦10⁩ تا ⁦100⁩ لەخۆ دەگرێت: MSI، یەک پلە سەرووی SSIـی لە وزە، دواکەوتن و ⁦fan-out⁩.

The course's list of topics ends with sequential circuits, digital registers, digital counters and memory devices. This last chapter teaches them in three lessons:

لیستی بابەتەکانی کۆرسەکە بە ، ، و ئامێرەکانی کۆتایی دێت. ئەم کۆتا بەشە لە سێ وانەدا فێریان دەکات:

  • This lesson — building blocks that are still combinational (no memory): multiplexers, demultiplexers, decoders, encoders and comparators.
  • Latches and flip-flops — the first circuits that remember: one bit each.
  • Registers and counters — many flip-flops working together, up to the parts of a CPU.
  • ئەم وانەیە — ئەو بلۆکە بنیاتنەرانەی هێشتا تێکەڵەیین (بێ ): ، ، ، و .
  • لاچەکان و فلیپ-فلۆپەکان — یەکەم خاوەن : هەر یەکەیان یەک .
  • تۆمارگەکان و ژمێرەرە دیجیتاڵەکان — زۆر کە پێکەوە کار دەکەن، تا دەگاتە بەشەکانی .
Quick checkپشکنینی خێراWhich of these is still a combinational circuit — its output depends only on its present inputs?کام لەمانە هێشتا — واتە تەنها بەندە بە ئێستاوە؟

The multiplexer: choosing one inputمەڵتیپلێکسەر: هەڵبژاردنی یەک نێوخستە

Definitionپێناسە

A circuit with several data inputs, one output and select inputs that choose which data input reaches the output.

سووڕێکە کە چەند دراوە، یەک و چەند هەڵبژاردنی هەیە کە دیاری دەکەن کام دراوە بگاتە .

A multiplexer (MUX), also called a data selector, has several data inputs, one output and a few select lines. The number on the select lines says which data input is copied to the output; all the other data inputs are ignored.

⁦(MUX)⁩، کە پێی دەوترێت هەڵبژێری ش، چەند ، یەک و چەند هێڵێکی هەڵبژاردنی هەیە. ئەو ژمارەیەی لەسەر هێڵەکانی هەڵبژاردنە دیاری دەکات کام کۆپی دەکرێت بۆ ؛ هەموو تر پشتگوێ دەخرێن.

The TV input buttonدوگمەی Inputـی تەلەفزیۆن

A television has several inputs: an HDMI socket for the satellite receiver, another for a game console, and the aerial. The Input (or Source) button on the remote chooses which one appears on the screen. The screen is the single output, the sockets are the data inputs, and the button is the select line.

تەلەفزیۆنێک چەند هەیە: سۆکێتێکی HDMI بۆ ڕیسیڤەری ستەلایت، یەکێکی تر بۆ ئامێری یاری و ئەنتێنا. دوگمەی Input (یان Source) لەسەر ڕیمۆتەکە هەڵدەبژێرێت کامیان لەسەر شاشەکە دەربکەوێت. شاشەکە تاکە ، سۆکێتەکان و دوگمەکە هێڵی هەڵبژاردنە.

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

A person presses the TV button; a multiplexer's select lines are bits set by another circuit, and they can change millions of times a second.

مرۆڤ دوگمەی تەلەفزیۆنەکە دادەگرێت؛ بەڵام هێڵەکانی هەڵبژاردنی کە تر دایان دەنێت و دەتوانن لە چرکەیەکدا ملیۆنان جار بگۆڕێن.

The smallest one, the 2-to-1 multiplexer, has data inputs D0D_0 and D1D_1 and one select line S. When S=0S = 0 the output is D0D_0; when S=1S = 1 it is D1D_1. As a Boolean expression:

بچووکترینیان، دوو بۆ یەک، D0D_0 و D1D_1 و یەک هێڵی هەڵبژاردنی S هەیە. کاتێک S=0S = 0 بێت D0D_0ـە؛ کاتێک S=1S = 1 بێت D1D_1ـە. وەک :

Y=S‾ D0+S D1Y = \overline{S}\,D_0 + S\,D_1

Read it as (NOT S AND D0D_0) OR (S AND D1D_1). Only one of the two AND terms can be open at a time, so Y simply copies the chosen input.

بیخوێنەوە بەم شێوەیە: (⁦NOT S AND⁩ D0D_0) ⁦OR (S AND⁩ D1D_1). لە هەر کاتێکدا تەنها یەکێک لە دوو بڕە ANDـەکە دەتوانێت کراوە بێت، بۆیە Y تەنها هەڵبژێردراوەکە کۆپی دەکات.

Quick checkپشکنینی خێراIn a 2-to-1 multiplexer, S=1S = 1, D0=0D_0 = 0 and D1=1D_1 = 1. What is Y?لە دوو بۆ یەکدا، S=1S = 1، D0=0D_0 = 0 و D1=1D_1 = 1. Y چەندە؟

The multiplexer: choosing one inputمەڵتیپلێکسەر: هەڵبژاردنی یەک نێوخستە

A 4-to-1 multiplexer: two select linesمەڵتیپلێکسەرێکی چوار بۆ یەک: دوو هێڵی هەڵبژاردن

With n select lines you can number 2n2^n inputs. That is why multiplexers come with 2, 4, 8 or 16 data inputs and 1, 2, 3 or 4 select lines. A 4-to-1 multiplexer reads its select lines S1S0S_1S_0 as a 2-bit number from 0 to 3 and passes that input to Y.

بە n هێڵی هەڵبژاردن دەتوانیت 2n2^n ژمارە بکەیت. بۆیە بە 2، 4، 8 یان ⁦16⁩ و 1، 2، 3 یان 4 هێڵی هەڵبژاردن دێن. چوار بۆ یەک هێڵەکانی هەڵبژاردنی S1S0S_1S_0 وەک ژمارەیەکی دوو لە 0ـەوە تا 3 دەخوێنێتەوە و ئەو دەنێرێت بۆ Y.

Left: an everyday selector knob. Four input wires D0 to D3 carry 1, 0, 1, 1 and end at contacts on an arc; a pointer from the knob touches the D2 contact, and the knob's output wire Y carries 1. Caption: the knob is the select lines, S1 S0 = 10 (two) picks D2. Right: the circuit symbol, a trapezoid labelled MUX 4:1 with inputs D0 to D3 on the long left side, select inputs S1 = 1 and S0 = 0 from below, and output Y = 1 on the right; the D2 path is highlighted.لای چەپ: دەسکێکی هەڵبژاردنی ڕۆژانە. چوار وایەری نێوخستە D0 تا D3 بەهاکانی 1، 0، 1، 1 هەڵدەگرن و لەسەر کەوانەیەک بە خاڵی پەیوەندی کۆتایی دێن؛ نیشانەیەک لە دەسکەکەوە بەر خاڵی D2 دەکەوێت و وایەری دەرخستەی دەسکەکە، Y، بەهای 1 هەڵدەگرێت. ژێرنووس: دەسکەکە هێڵەکانی هەڵبژاردنە، S1 S0 = 10 (دوو) D2 هەڵدەبژێرێت. لای ڕاست: هێمای سووڕ، شێوەیەکی لاکێشەیی لار بە ناوی MUX 4:1 کە نێوخستەکانی D0 تا D3 لە لای درێژی چەپیدان، نێوخستەکانی هەڵبژاردن S1 = 1 و S0 = 0 لە خوارەوە و دەرخستەی Y = 1 لە لای ڕاست؛ ڕێگای D2 ڕەنگکراوە.
The select lines work like a selector knob: their number, 102=210_2 = 2, connects D2D_2 to Y.هێڵەکانی هەڵبژاردن وەک دەسکی هەڵبژاردن کار دەکەن: ژمارەکەیان، 102=210_2 = 2، D2D_2 بە Yـەوە دەبەستێت.CêIT
The 4-to-1 multiplexer in four rows چوار بۆ یەک لە چوار ڕیزدا
S₁ S₀Y
0 0D0D_0
0 1D1D_1
1 0D2D_2
1 1D3D_3
Y=S1‾ S0‾ D0+S1‾ S0 D1+S1 S0‾ D2+S1 S0 D3Y = \overline{S_1}\,\overline{S_0}\,D_0 + \overline{S_1}\,S_0\,D_1 + S_1\,\overline{S_0}\,D_2 + S_1\,S_0\,D_3

One product term per data input. Each term is 1 only for its own select code, so exactly one input reaches Y.

بۆ هەر یەک . هەر بڕێک تەنها بۆ کۆدی هەڵبژاردنی خۆی 1ـە، بۆیە تەنها یەک دەگاتە Y.

Quick checkپشکنینی خێراA 4-to-1 multiplexer has D0=0D_0 = 0, D1=1D_1 = 1, D2=1D_2 = 1, D3=0D_3 = 0. The select lines are S1S0=11S_1S_0 = 11. What is Y? چوار بۆ یەک D0=0D_0 = 0، D1=1D_1 = 1، D2=1D_2 = 1، D3=0D_3 = 0ـی هەیە. هێڵەکانی هەڵبژاردن S1S0=11S_1S_0 = 11ن. Y چەندە؟

The multiplexer: choosing one inputمەڵتیپلێکسەر: هەڵبژاردنی یەک نێوخستە

Inside a 4-to-1 multiplexerناوەوەی مەڵتیپلێکسەرێکی چوار بۆ یەک

Built from gates, each data input gets its own 3-input AND gate. Two of its inputs come from the select lines — through an inversion bubble wherever that gate's code has a 0 — so the gate opens only for its own code. The four AND outputs meet in one OR gate. Watch the select lines count from 00 to 11:

ئەگەر بە دروستی بکەیت، هەر خۆی هەیە کە سێ هەیە. دوو لە لە هێڵەکانی هەڵبژاردنەوە دێن — لە هەر شوێنێک کۆدی ئەو 0ـی تێدا بێت بە — بۆیە تەنها بۆ کۆدی خۆی دەکرێتەوە. چوار ANDـەکە لە یەک بە یەک دەگەن. سەیر بکە هێڵەکانی هەڵبژاردن چۆن لە ⁦00⁩ـەوە تا ⁦11⁩ دەژمێرن:

Animation in five frames of a 4-to-1 multiplexer built from four 3-input AND gates and a 4-input OR gate. Data inputs D0 to D3 are 1, 0, 1, 1. Frame by frame the select lines S1 S0 are 00, 01, 10 and 11; in each frame only the AND gate with the matching number is highlighted, its output is the data bit, and Y shows D0 = 1, D1 = 0, D2 = 1, D3 = 1. A table at the right fills one row per frame. The last frame shows the complete table.
Animation in five frames of a 4-to-1 multiplexer built from four 3-input AND gates and a 4-input OR gate. Data inputs D0 to D3 are 1, 0, 1, 1. Frame by frame the select lines S1 S0 are 00, 01, 10 and 11; in each frame only the AND gate with the matching number is highlighted, its output is the data bit, and Y shows D0 = 1, D1 = 0, D2 = 1, D3 = 1. A table at the right fills one row per frame. The last frame shows the complete table.
The select code opens one AND gate at a time; the OR gate passes its data bit to Y.کۆدی هەڵبژاردن لە هەر جارێکدا تەنها یەک دەکاتەوە؛ ئەو دەگەیەنێتە Y.CêIT

The AND gates with their bubbles turn the select code into "exactly one gate open". That part of the circuit is a decoder — you will meet it on its own further down.

لەگەڵ کۆدی هەڵبژاردن دەکەن بە «تەنها یەک کراوەیە». ئەو بەشەی — لە خوارەوە بە تەنها دەیبینیت.

Quick checkپشکنینی خێراIn the animated circuit, which AND gate has a bubble on both select inputs?لە جووڵاوەکەدا، کام لەسەر هەردوو هەڵبژاردن هەیە؟

The multiplexer: choosing one inputمەڵتیپلێکسەر: هەڵبژاردنی یەک نێوخستە

Why datasheets print short truth tablesبۆچی خشتەکانی ڕاستی کورتکراوە بەکار دێن

A full truth table lists every combination of all inputs. An 8-to-1 multiplexer has 3 select lines and 8 data inputs — 11 inputs — so its full table would have 211=20482^{11} = 2048 rows, almost all saying the same thing. In general a multiplexer with n select lines has n+2nn + 2^n inputs, so its full table has 2 n+2n2^{\,n + 2^n} rows.

تەواو هەموو تێکەڵەیەکی هەموو دەنووسێت. هەشت بۆ یەک 3 هێڵی هەڵبژاردن و 8 هەیە — ⁦11⁩ — بۆیە خشتە تەواوەکەی 211=20482^{11} = 2048 ڕیزی دەبوو کە نزیکەی هەموویان هەمان شت دەڵێن. بە گشتی بە n هێڵی هەڵبژاردن n+2nn + 2^n هەیە، بۆیە خشتە تەواوەکەی 2 n+2n2^{\,n + 2^n} ڕیزی هەیە.

So datasheets print an abbreviated table. Each row gives only the select code, and the output column names the input that is copied, instead of listing every 0 and 1 of the other inputs. Eight rows replace 2048:

بۆیە پەڕەی زانیاریی ⁦(datasheet)⁩ خشتەیەکی کورتکراوە چاپ دەکەن. هەر ڕیزێک تەنها کۆدی هەڵبژاردن دەدات و ستوونی ناوی ئەو دەنووسێت کە کۆپی دەکرێت، لە جیاتی نووسینی هەموو 0 و 1ـەکانی تر. هەشت ڕیز جێگەی ⁦2048⁩ دەگرنەوە:

Abbreviated truth table of an 8-to-1 multiplexer کورتکراوەی هەشت بۆ یەک
S₂ S₁ S₀Y
0 0 0D0D_0
0 0 1D1D_1
0 1 0D2D_2
0 1 1D3D_3
1 0 0D4D_4
1 0 1D5D_5
1 1 0D6D_6
1 1 1D7D_7
Quick checkپشکنینی خێراHow many rows would a full truth table of a 4-to-1 multiplexer have? تەواو بۆ چوار بۆ یەک چەند ڕیزی دەبێت؟

The demultiplexer: one input, many outputsدیمەڵتیپلێکسەر: یەک نێوخستە، چەند دەرخستەیەک

Definitionپێناسە

A circuit with one data input, several outputs and select inputs. The select inputs decide which output receives the data; all other outputs stay 0. It does the opposite of a .

سووڕێکە بە یەک دراوە، چەند و چەند هەڵبژاردن. هەڵبژاردن بڕیار دەدەن کام دراوەکە وەربگرێت؛ هەموو تر 0 دەمێننەوە. پێچەوانەی کاری دەکات.

A demultiplexer (DEMUX) does the opposite job. It has one data input D, n select lines (also called address inputs) and 2n2^n outputs. The select number decides which output receives D; every other output stays 0. For a 1-to-4 demultiplexer:

⁦(DEMUX)⁩ کارە پێچەوانەکە دەکات. یەک D، n هێڵی هەڵبژاردن (کە پێیان دەوترێت هێڵەکانی ناونیشانیش) و 2n2^n هەیە. ژمارەی هەڵبژاردن بڕیار دەدات کام D وەربگرێت؛ هەموو تر 0 دەمێننەوە. بۆ یەک بۆ چوار:

1-to-4 demultiplexer: D goes to the selected output یەک بۆ چوار: D دەچێت بۆ هەڵبژێردراوەکە
S₁ S₀Y₀Y₁Y₂Y₃
0 0D000
0 10D00
1 000D0
1 1000D
Y0=D S1‾ S0‾Y1=D S1‾ S0Y2=D S1 S0‾Y3=D S1 S0Y_0 = D\,\overline{S_1}\,\overline{S_0} \qquad Y_1 = D\,\overline{S_1}\,S_0 \qquad Y_2 = D\,S_1\,\overline{S_0} \qquad Y_3 = D\,S_1\,S_0

The same four select terms as in the multiplexer, each ANDed with D.

هەمان چوار بڕی هەڵبژاردنی ناو ، هەر یەکەیان لەگەڵ D بە AND کراوە.

Why have both? Together they let several signals share one wire. The multiplexer at the sending end and the demultiplexer at the receiving end get the same select number, which counts 00, 01, 10, 11 again and again, so each signal uses the wire in turn. This is time-division multiplexing, used in telephone networks and digital links.

بۆچی هەردووکیان؟ پێکەوە ڕێگە دەدەن چەند یەک وایەر بەکار بهێنن. لە لای نێرەر و لە لای وەرگر هەمان ژمارەی هەڵبژاردن وەردەگرن کە بەردەوام ⁦00⁩، ⁦01⁩، ⁦10⁩، ⁦11⁩ دەژمێرێت، بۆیە هەر بە نۆرە وایەرەکە بەکار دەهێنێت. ئەمە فرەکردنی بە دابەشکردنی کاتە (time-division multiplexing) کە لە ڕایەڵەکانی تەلەفۆن و پەیوەندیی بەکار دێت.

Four inputs A, B, C, D enter a multiplexer (MUX); its output travels along one shared wire to a demultiplexer (DEMUX) with outputs A, B, C, D. Both blocks get the same select lines S1 S0 from one box below. The B path is highlighted on both sides, with the note: now B (select 01).چوار نێوخستە A، B، C، D دەچنە ناو مەڵتیپلێکسەرێک (MUX)؛ دەرخستەکەی بە یەک وایەری هاوبەشدا دەڕوات بۆ دیمەڵتیپلێکسەرێک (DEMUX) کە دەرخستەکانی A، B، C، Dـی هەیە. هەردوو بلۆکەکە هەمان هێڵەکانی هەڵبژاردنی S1 S0 لە سندووقێکی خوارەوە وەردەگرن. ڕێگای B لە هەردوو لا ڕەنگ کراوە، لەگەڵ تێبینی: ئێستا B (هەڵبژاردن 01).
A multiplexer and a demultiplexer with the same select number let four signals take turns on one wire. و بە هەمان ژمارەی هەڵبژاردن ڕێگە دەدەن چوار بە نۆرە یەک وایەر بەکار بهێنن.CêIT
Quick checkپشکنینی خێراA 1-to-4 demultiplexer has D=1D = 1 and S1S0=10S_1S_0 = 10. Which outputs are 1? یەک بۆ چوار D=1D = 1 و S1S0=10S_1S_0 = 10ـی هەیە. کام 1ـن؟

The decoder: one output for each codeکۆدهەڵوەشێنەر: دەرخستەیەک بۆ هەر کۆدێک

Definitionپێناسە

A circuit that turns a binary code on its inputs into one active output line. A 3-to-8 decoder turns the input 101 into output line 5.

سووڕێکە کە کۆدێکی لەسەر دەگۆڕێت بۆ یەک هێڵی چالاک. کۆدهەڵوەشێنەرێکی 3 بۆ 8 ⁦101⁩ دەگۆڕێت بۆ هێڵی 5.

Look again at the AND gates inside the multiplexer: for each select code exactly one of them opens. On its own, that circuit is a decoder. It has n inputs and 2n2^n outputs, and for every input number exactly one output is 1 — the output with that number. All the others are 0. A 2-to-4 decoder:

دووبارە سەیری ناو بکە: بۆ هەر کۆدێکی هەڵبژاردن ڕێک یەکێکیان دەکرێتەوە. ئەو بە تەنها . n و 2n2^n هەیە و بۆ هەر ژمارەیەکی ڕێک یەک 1ـە — ئەو هەمان ژمارەی هەیە. هەموو ئەوانی تر 0ـن. دوو بۆ چوار:

2-to-4 decoder (A is the more significant bit) دوو بۆ چوار (A گرنگترەکەیە)
A BY₀Y₁Y₂Y₃
0 01000
0 10100
1 00010
1 10001

Each output is one AND term of all the inputs, so each output is a minterm: Y0=A‾ B‾Y_0 = \overline{A}\,\overline{B}, Y1=A‾BY_1 = \overline{A}B, Y2=AB‾Y_2 = A\overline{B}, Y3=ABY_3 = AB (see Minterms and maxterms).

هەر یەک بڕی ANDـی هەموو ، بۆیە هەر : Y0=A‾ B‾Y_0 = \overline{A}\,\overline{B}، Y1=A‾BY_1 = \overline{A}B، Y2=AB‾Y_2 = A\overline{B}، Y3=ABY_3 = AB (بڕوانە مینتێرمەکان و ماکستێرمەکان).

Quick checkپشکنینی خێراIn a 2-to-4 decoder, AB=10AB = 10. Which output is 1, and which minterm is it?لە دوو بۆ چواردا AB=10AB = 10ـە. کام 1ـە و کام ؟

The decoder: one output for each codeکۆدهەڵوەشێنەر: دەرخستەیەک بۆ هەر کۆدێک

The 3-to-8 decoderکۆدهەڵوەشێنەری سێ بۆ هەشت

A 3-to-8 decoder works the same way with three inputs A, B and C (A is the most significant bit). Its eight outputs are the eight minterms of three variables, so for every input code exactly one of them is 1:

سێ بۆ هەشت بە هەمان شێوە بە سێ ، A، B و C، کار دەکات (A ). هەشت بریتین لە هەشت سێ ، بۆیە بۆ هەر کۆدێکی ڕێک یەکێکیان 1ـە:

A 3-to-8 decoder block. Inputs A = 1 (MSB), B = 0 and C = 1 (LSB) and an enable input E = 1 enter on the left. Eight outputs Y0 to Y7 leave on the right, each with a lamp; only Y5 is lit and shows 1, all others show 0. A note box says: 101 is five, Y5 = A B-bar C, the minterm m5, every other output is 0.بلۆکی کۆدهەڵوەشێنەرێکی سێ بۆ هەشت. نێوخستەکانی A = 1 (MSB)، B = 0 و C = 1 (LSB) و نێوخستەی چالاککردن E = 1 لە لای چەپەوە دێنە ژوورەوە. هەشت دەرخستە، Y0 تا Y7، لە لای ڕاستەوە دەردەچن و هەر یەکەیان چرایەکی هەیە؛ تەنها Y5 ڕووناکە و 1 پیشان دەدات، هەموو ئەوانی تر 0. سندووقێکی تێبینی دەڵێت: 101 واتە پێنج، Y5 = A·B̄·C، مینتێرمی m5، هەموو دەرخستەی تر 0ـە.
One output per input code: 101 lights Y5, which is the minterm AB‾CA\overline{B}C.بۆ هەر کۆدێکی یەک : ⁦101 Y5⁩ ڕووناک دەکاتەوە کە AB‾CA\overline{B}Cـە.CêIT
3-to-8 decoder: the one output that is 1 for each input code سێ بۆ هەشت: ئەو تاکە بۆ هەر کۆدێکی 1ـە
A B COutput that is 1ئەو 1ـەIts minterm
0 0 0Y0Y_0m0=A‾ B‾ C‾m_0 = \overline{A}\,\overline{B}\,\overline{C}
0 0 1Y1Y_1m1=A‾ B‾ Cm_1 = \overline{A}\,\overline{B}\,C
0 1 0Y2Y_2m2=A‾ B C‾m_2 = \overline{A}\,B\,\overline{C}
0 1 1Y3Y_3m3=A‾ B Cm_3 = \overline{A}\,B\,C
1 0 0Y4Y_4m4=A B‾ C‾m_4 = A\,\overline{B}\,\overline{C}
1 0 1Y5Y_5m5=A B‾ Cm_5 = A\,\overline{B}\,C
1 1 0Y6Y_6m6=A B C‾m_6 = A\,B\,\overline{C}
1 1 1Y7Y_7m7=A B Cm_7 = A\,B\,C
Quick checkپشکنینی خێراA 3-to-8 decoder receives ABC=011ABC = 011. Which output is 1? سێ بۆ هەشت ABC=011ABC = 011 وەردەگرێت. کام 1ـە؟

The decoder: one output for each codeکۆدهەڵوەشێنەر: دەرخستەیەک بۆ هەر کۆدێک

The enable input and active-low outputsنێوخستەی چالاککردن و دەرخستەکانی چالاک بە LOW

Most decoder chips have an enable input E. When E=0E = 0 every output stays 0, whatever the other inputs say; when E=1E = 1 the decoder works normally. In the table an X means "any value":

زۆربەی چالاککردن Eـیان هەیە. کاتێک E=0E = 0 بێت هەموو 0 دەمێننەوە، تر هەرچییەک بڵێن؛ کاتێک E=1E = 1 بێت بە ئاسایی کار دەکات. لە خشتەکەدا X واتە «هەر بەهایەک»:

2-to-4 decoder with an enable input دوو بۆ چوار بە چالاککردن
EA BY₀ Y₁ Y₂ Y₃
0X X0 0 0 0
10 01 0 0 0
10 10 1 0 0
11 00 0 1 0
11 10 0 0 1

Now feed a data bit into E. When the bit is 1, the selected output is 1; when it is 0, all outputs are 0. The selected output simply copies the data bit — that is exactly a demultiplexer, with A and B as its select lines. This is why the 74HC138 chip is sold as a 3-to-8 decoder/demultiplexer.

ئێستا بدە بە E. کاتێک 1 بێت، هەڵبژێردراوەکە 1ـە؛ کاتێک 0 بێت، هەموو 0ـن. هەڵبژێردراوەکە تەنها کۆپی دەکات — ئەمە ڕێک کە A و B هێڵەکانی هەڵبژاردنین. بۆیە ⁦74HC138⁩ وەک / سێ بۆ هەشت دەفرۆشرێت.

Many decoder chips, the 74HC138 among them, have active-low outputs: the selected output goes LOW (0) and all the others stay HIGH (1). The symbol shows an inversion bubble on each output. Enable inputs let a designer switch on one decoder among several — the same idea as the enable inputs of chips on a shared bus.

زۆرێک لە ، ⁦74HC138⁩یش لەناویاندا، چالاک بە LOWیان هەیە: هەڵبژێردراوەکە دەبێتە ⁦LOW (0)⁩ و هەموو ئەوانی تر ⁦HIGH (1)⁩ دەمێننەوە. لەسەر هەر پیشان دەدات. چالاککردن ڕێگە دەدەن دیزاینەر لە نێوان چەند تەنها یەکێکیان هەڵبکات — هەمان بیرۆکەی چالاککردن لە سەر تێپەڕگەیەکی هاوبەش.

Quick checkپشکنینی خێراA 74HC138 (enabled, active-low outputs) receives the input 110. What do its outputs Y7…Y0Y_7 \ldots Y_0 show?⁦74HC138⁩ (چالاککراو، چالاک بە LOW) ⁦110⁩ وەردەگرێت. Y7…Y0Y_7 \ldots Y_0 چی پیشان دەدەن؟

The decoder: one output for each codeکۆدهەڵوەشێنەر: دەرخستەیەک بۆ هەر کۆدێک

Where decoders work in a computerکۆدهەڵوەشێنەرەکان لە کۆمپیوتەردا لە کوێ کار دەکەن

  • Choosing a memory chip. A computer has several memory chips on the same buses. A decoder reads the top bits of the address and enables exactly one chip; all the others stay switched off.
  • Decoding instructions. In the fetch–decode–execute cycle, the decode step uses decoders to turn the operation code of an instruction into the one control signal that starts the right action.
  • Lamps and displays. A decoder lights one LED in a row, or switches on one digit of a multi-digit display at a time, so that each digit gets its turn.
  • هەڵبژاردنی . چەند لەسەر هەمان هەیە. سەرەوەی ناونیشانەکە دەخوێنێتەوە و ڕێک یەک چالاک دەکات؛ هەموو ئەوانی تر کوژاوە دەمێننەوە.
  • ڕاڤەکردنی . لە سووڕی ڕێکارنامەدا، هەنگاوی decode بەکار دەهێنێت بۆ ئەوەی کۆدی کارەکەی بکات بە یەک کۆنترۆڵ کە کارە دروستەکە دەست پێ دەکات.
  • چرا و پیشاندەرەکان. یەک لە ڕیزێکدا ڕووناک دەکاتەوە، یان لە هەر جارێکدا یەک لە پیشاندەرێکی چەند هەڵدەکات تاکو هەر نۆرەی خۆی وەربگرێت.
Quick checkپشکنینی خێراA computer has 4 memory chips. How many address bits must the decoder read to enable exactly one of them? 4 هەیە. دەبێت چەند ناونیشان بخوێنێتەوە بۆ ئەوەی ڕێک یەکێکیان چالاک بکات؟

The decoder: one output for each codeکۆدهەڵوەشێنەر: دەرخستەیەک بۆ هەر کۆدێک

A decoder you see every day: 7-segment displaysکۆدهەڵوەشێنەرێک کە هەموو ڕۆژێک دەیبینیت: پیشاندەرە حەوت بەشییەکان

The digits on a microwave oven, a petrol pump or an old calculator are seven-segment displays: seven light bars named a to g. To show a digit, a BCD-to-7-segment decoder turns the digit's BCD code into the right pattern of segments. Unlike the decoders above, several of its outputs are 1 at the same time: it is a code converter.

سەر مایکرۆوەیڤ، پەمپی بەنزین یان کۆن ن: حەوت هێڵی ڕووناک کە ناویان a تا gـیە. بۆ پیشاندانی ، BCD بۆ حەوت بەش کۆدی دەیی دووانیی ئەو دەگۆڕێت بۆ نەخشەی دروستی بەشەکان. بە پێچەوانەی سەرەوە، چەند لە هەمان کاتدا 1ـن: ئەم گۆڕەری کۆدـە.

A BCD-to-7-segment decoder. The BCD input 0101 (weights 8, 4, 2, 1) enters a block; its outputs a to g carry 1, 0, 1, 1, 0, 1, 1. On the right a large seven-segment display with segments labelled a (top), b (upper right), c (lower right), d (bottom), e (lower left), f (upper left) and g (middle) shows the digit 5 with segments a, c, d, f and g lit. Below, the digits 0 to 9 are drawn as small seven-segment patterns.کۆدهەڵوەشێنەرێکی BCD بۆ حەوت بەش. نێوخستەی کۆدی دەیی دووانی 0101 (کێشەکانی 8، 4، 2، 1) دەچێتە ناو بلۆکێک؛ دەرخستەکانی a تا g بەهاکانی 1، 0، 1، 1، 0، 1، 1 هەڵدەگرن. لە لای ڕاست پیشاندەرێکی حەوت بەشی گەورە کە بەشەکانی ناونراون a (سەرەوە)، b (سەرەوەی ڕاست)، c (خوارەوەی ڕاست)، d (خوارەوە)، e (خوارەوەی چەپ)، f (سەرەوەی چەپ) و g (ناوەڕاست)، تاکژمارەی 5 پیشان دەدات کە بەشەکانی a، c، d، f و g ڕووناکن. لە خوارەوە تاکژمارەکانی 0 تا 9 وەک نەخشەی بچووکی حەوت بەشی کێشراون.
A code converter: the BCD code of 5 lights five of the seven segments.گۆڕەری کۆد: 5 پێنج بەش لە حەوت بەشەکە ڕووناک دەکاتەوە.CêIT
Segments lit for each digit (1 = lit)ئەو بەشانەی بۆ هەر ڕووناک دەبنەوە (⁦1⁩ = ڕووناک)
DigitBCDa b c d e f g
000001 1 1 1 1 1 0
100010 1 1 0 0 0 0
200101 1 0 1 1 0 1
300111 1 1 1 0 0 1
401000 1 1 0 0 1 1
501011 0 1 1 0 1 1
601101 0 1 1 1 1 1
701111 1 1 0 0 0 0
810001 1 1 1 1 1 1
910011 1 1 1 0 1 1

The six codes 1010 to 1111 are not BCD digits. A designer may treat them as don't-cares when simplifying the circuit of each segment. Ready-made chips such as the CMOS 4511 do the whole job.

شەش کۆدی ⁦1010⁩ تا ⁦1111⁩ نین. دیزاینەر دەتوانێت لە کاتی کورتکردنەوەی هەر بەشێکدا وەک دۆخە بێبایەخەکان سەیریان بکات. ئامادەی وەک ⁦CMOS 4511⁩ هەموو کارەکە دەکات.

Quick checkپشکنینی خێراWhich segments are lit for the digit 7?بۆ 7 کام بەشانە ڕووناک دەبنەوە؟

The encoder: from one active line to a codeکۆدکەر: لە یەک هێڵی چالاکەوە بۆ کۆدێک

Definitionپێناسە

A circuit that does the opposite of a decoder: it gives the binary code of the one input line that is active.

سووڕێکە کە پێچەوانەی کار دەکات: کۆدی ئەو تاکە هێڵەی دەدات کە چالاکە.

An encoder does the reverse of a decoder. It has 2n2^n input lines and n outputs, and it outputs the number of the one input that is active. A 4-to-2 encoder:

پێچەوانەی کار دەکات. 2n2^n هێڵی و n هەیە و ژمارەی ئەو تاکە دەدات کە چالاکە. چوار بۆ دوو:

4-to-2 encoder: exactly one input is 1 چوار بۆ دوو: ڕێک یەک 1ـە
D₃ D₂ D₁ D₀Y₁ Y₀
0 0 0 10 0
0 0 1 00 1
0 1 0 01 0
1 0 0 01 1

Read the table column by column: Y1Y_1 is 1 for inputs 2 and 3, and Y0Y_0 is 1 for inputs 1 and 3. So an encoder needs only OR gates — and D0D_0 is not even connected, because input 0 gives the code 00 anyway:

خشتەکە ستوون بە ستوون بخوێنەوە: Y1Y_1 بۆ 2 و ⁦3 1⁩ـە و Y0Y_0 بۆ 1 و ⁦3 1⁩ـە. کەواتە تەنها پێویستی بە هەیە — و D0D_0 تەنانەت نابەسترێتەوە، چونکە 0 لە هەر حاڵدا کۆدی ⁦00⁩ دەدات:

Y1=D2+D3Y0=D1+D3Y_1 = D_2 + D_3 \qquad Y_0 = D_1 + D_3

The simple encoder trusts that only one input is active. Activate two at once — D1D_1 and D2D_2 — and the OR gates give Y1Y0=11Y_1Y_0 = 11, the code of input 3, which nobody activated.

سادەکە متمانە دەکات کە تەنها یەک چالاکە. ئەگەر دووان پێکەوە چالاک بکەیت — D1D_1 و D2D_2 — Y1Y0=11Y_1Y_0 = 11 دەدەن، کە کۆدی 3ـە و کەس چالاکی نەکردووە.

Quick checkپشکنینی خێراIn the simple 4-to-2 encoder, only D3D_3 is active. What is Y1Y0Y_1Y_0?لە سادەی چوار بۆ دوودا، تەنها D3D_3 چالاکە. Y1Y0Y_1Y_0 چییە؟

The encoder: from one active line to a codeکۆدکەر: لە یەک هێڵی چالاکەوە بۆ کۆدێک

The priority encoder: the highest input winsکۆدکەری پێشینەیی: بەرزترین نێوخستە دەباتەوە

Definitionپێناسە

An that still gives a correct code when several inputs are active at once: the active input with the highest number wins. A valid output (V) says whether any input is active at all.

کە کاتێک چەند پێکەوە چالاک بن هێشتا کۆدێکی دروست دەدات: ئەو چالاکەی ژمارەی گەورەتری هەیە دەباتەوە. V دەڵێت ئایا هیچ چالاکە یان نا.

A priority encoder fixes this. Each input has a priority — here D3D_3 is the highest — and when several inputs are active, the output is the number of the highest one. An extra output V (valid) is 1 when at least one input is active, so the circuit can tell "input 0 is active" apart from "nothing is active".

ئەم کێشەیە چارەسەر دەکات. هەر پێشینەییەکی هەیە — لێرەدا D3D_3 بەرزترینە — و کاتێک چەند چالاک بن، ژمارەی بەرزترینیانە. زیادە، V (valid، واتە دروست)، کاتێک لانیکەم یەک چالاک بێت 1ـە، بۆیە دەتوانێت « 0 چالاکە» لە «هیچ شتێک چالاک نییە» جیا بکاتەوە.

4-to-2 priority encoder (X = don't care)، چوار بۆ دوو (X = )
D₃ D₂ D₁ D₀Y₁ Y₀V
0 0 0 00 00
0 0 0 10 01
0 0 1 X0 11
0 1 X X1 01
1 X X X1 11

Each X is a don't-care: once a higher input is active, the lower ones cannot change the answer. One row with Xs stands for several rows of the full 16-row table — the row 1XXX alone covers eight. From the table:

هەر X دۆخێکی بێبایەخە: هەر کە بەرزتر چالاک بێت، نزمترەکان ناتوانن وەڵامەکە بگۆڕن. یەک ڕیز بە Xـەکانەوە جێگەی چەند ڕیزێکی خشتە ⁦16⁩ ڕیزییە تەواوەکە دەگرێتەوە — تەنها ڕیزی ⁦1XXX⁩ هەشت ڕیز دەگرێتەوە. لە خشتەکەوە:

Y1=D3+D2Y0=D3+D2‾ D1V=D3+D2+D1+D0Y_1 = D_3 + D_2 \qquad Y_0 = D_3 + \overline{D_2}\,D_1 \qquad V = D_3 + D_2 + D_1 + D_0

Priority matters wherever several requests can arrive together: an interrupt controller decides which device the CPU serves first, and a keypad must give one answer when two keys are pressed together. Real chips: the 74HC148 (8 inputs to 3 outputs) and the 74HC147 (10 inputs to a 4-bit BCD code, for a decimal keypad).

پێشینەیی لە هەر شوێنێکدا گرنگە کە چەند داواکارییەک پێکەوە بگەن: کۆنترۆڵەری پچڕاندن (interrupt controller) بڕیار دەدات سەرەتا خزمەتی کام ئامێر بکات و تەختەیەکی ژمارە دەبێت کاتێک دوو پێکەوە دادەگیرێن یەک وەڵام بدات. ڕاستەقینە: ⁦74HC148 (8⁩ بۆ 3 ) و ⁦74HC147 (10⁩ بۆ ، واتە 4 ، بۆ تەختەیەکی ژمارەی ).

Quick checkپشکنینی خێراA priority encoder (D3D_3 highest) gets D3D2D1D0=0110D_3D_2D_1D_0 = 0110. What are Y1Y0Y_1Y_0 and V? (D3D_3 بەرزترینە) D3D2D1D0=0110D_3D_2D_1D_0 = 0110 وەردەگرێت. Y1Y0Y_1Y_0 و V چین؟

Any function from a decoder and an OR gateهەر نەخشەیەکی بوولی بە کۆدهەڵوەشێنەرێک و گەیتێکی OR

Because a decoder's outputs are the minterms, a decoder can build any function of its inputs: write the function as a sum of minterms and OR those outputs together. Example: the odd-parity bit P for three data bits A, B, C must be 1 when the data has an even number of 1s, so that the total number of 1s becomes odd. That happens for 000, 011, 101 and 110:

چونکە ، دەتوانێت هەر خۆی دروست بکات: وەک کۆی مینتێرمەکان بنووسە و هاوتای ئەو بە OR پێکەوە ببەستە. نموونە: تاک P بۆ سێ A، B، C دەبێت 1 بێت کاتێک ژمارەیەکی جووتی 1ـی تێدا بێت، تاکو کۆی ژمارەی 1ـەکان ببێتە تاک. ئەمە بۆ ⁦000⁩، ⁦011⁩، ⁦101⁩ و ⁦110⁩ ڕوو دەدات:

P=Σm(0,3,5,6)=A⊕B⊕C‾P = \Sigma m(0, 3, 5, 6) = \overline{A \oplus B \oplus C}

All eight rows were checked: P is the XNOR of the three bits.

هەر هەشت ڕیزەکە پشکنران: ⁦P XNOR⁩ـی سێ .

One function built two ways, the odd-parity bit P = sum of minterms 0, 3, 5, 6. Left: a 3-to-8 decoder with inputs A, B, C; its outputs 0, 3, 5 and 6 are highlighted and wired into a 4-input OR gate whose output is P; outputs 1, 2, 4 and 7 are unused. Caption: outputs 0, 3, 5, 6 are the minterms. Right: a 4-to-1 multiplexer whose select lines are A (S1) and B (S0), with data inputs D0 = C-bar, D1 = C, D2 = C, D3 = C-bar, and output P.یەک نەخشەی بوولی کە بە دوو ڕێگا دروست کراوە، بیتی پاریتیی تاک P = کۆی مینتێرمەکانی 0، 3، 5، 6. لای چەپ: کۆدهەڵوەشێنەرێکی سێ بۆ هەشت بە نێوخستەکانی A، B، C؛ دەرخستەکانی 0، 3، 5 و 6 ڕەنگ کراون و بە گەیتێکی OR چوار نێوخستەی بەستراون کە دەرخستەکەی Pـیە؛ دەرخستەکانی 1، 2، 4 و 7 بەکار نەهاتوون. ژێرنووس: دەرخستەکانی 0، 3، 5، 6 مینتێرمەکانن. لای ڕاست: مەڵتیپلێکسەرێکی چوار بۆ یەک کە هێڵەکانی هەڵبژاردنی A (S1) و B (S0)ن، بە نێوخستەکانی دراوە D0 = C̄، D1 = C، D2 = C، D3 = C̄ و دەرخستەی P.
Left: one decoder and one OR gate. Right: one multiplexer and a NOT gate for C‾\overline{C}. Both give the same P.چەپ: یەک و یەک . ڕاست: یەک و بۆ C‾\overline{C}. هەردووکیان هەمان P دەدەن.CêIT

The decoder version needs no simplifying at all: the minterm list is the circuit. (Parity bits are explained with the ASCII code.)

وەشانی هیچ کورتکردنەوەیەکی ناوێت: لیستی خودی . (بیتی پاریتی لەگەڵ کۆدی ڕوون کراوەتەوە.)

Quick checkپشکنینی خێراTo build F=Σm(1,4,7)F = \Sigma m(1, 4, 7) with a 3-to-8 decoder, which decoder outputs go into the OR gate?بۆ دروستکردنی F=Σm(1,4,7)F = \Sigma m(1, 4, 7) بە سێ بۆ هەشت، کام دەچنە ناو ؟

Any function from a decoder and an OR gateهەر نەخشەیەکی بوولی بە کۆدهەڵوەشێنەرێک و گەیتێکی OR

Any function from a multiplexerهەر نەخشەیەکی بوولی بە مەڵتیپلێکسەرێک

A multiplexer can do the same job. Put the function's variables on the select lines and wire each data input to the value the truth table wants in that row. With an 8-to-1 multiplexer and A, B, C on S2S1S0S_2S_1S_0, the parity bit needs D0…D7=1,0,0,1,0,1,1,0D_0 \ldots D_7 = 1, 0, 0, 1, 0, 1, 1, 0 — the output column of the truth table, copied onto the inputs.

دەتوانێت هەمان کار بکات. بخەرە سەر هێڵەکانی هەڵبژاردن و هەر ببەستە بەو بەهایەی لەو ڕیزەدا دەیەوێت. بە هەشت بۆ یەک و A، B، C لەسەر S2S1S0S_2S_1S_0، پێویستی بە D0…D7=1,0,0,1,0,1,1,0D_0 \ldots D_7 = 1, 0, 0, 1, 0, 1, 1, 0 هەیە — ستوونی ، کە کۆپی کراوەتە سەر .

A smaller trick uses a 4-to-1 multiplexer with only A and B on the select lines. Each data input then gets 0, 1, C or C‾\overline{C}. Look at each pair of rows that share the same A and B:

فێڵێکی بچووکتر چوار بۆ یەک بەکار دەهێنێت کە تەنها A و B لەسەر هێڵەکانی هەڵبژاردنن. ئەو کاتە هەر 0، 1، C یان C‾\overline{C} وەردەگرێت. سەیری هەر جووتە ڕیزێک بکە کە هەمان A و Bـیان هەیە:

The parity bit with a 4-to-1 multiplexer بە چوار بۆ یەک
A BP when C=0C = 0P کاتێک C=0C = 0P when C=1C = 1P کاتێک C=1C = 1Data input
0 010D0=C‾D_0 = \overline{C}
0 101D1=CD_1 = C
1 001D2=CD_2 = C
1 110D3=C‾D_3 = \overline{C}

That is the right half of the figure above: one 4-to-1 multiplexer and one NOT gate replace the whole parity circuit. When both rows of a pair give 0 (or both give 1), the data input is simply wired to 0 (or 1).

ئەمە نیوەی ڕاستی وێنەکەی سەرەوەیە: یەک چوار بۆ یەک و یەک جێگەی هەموو پاریتییەکە دەگرنەوە. کاتێک هەردوو ڕیزی جووتێک 0 بدەن (یان هەردووکیان ⁦1⁩)، تەنها بە 0 (یان ⁦1⁩) دەبەسترێتەوە.

Quick checkپشکنینی خێراWith A and B on the select lines of a 4-to-1 multiplexer, the truth table gives F=1F = 1 in both rows with AB=11AB = 11. What should D3D_3 be?کاتێک A و B لەسەر هێڵەکانی هەڵبژاردنی چوار بۆ یەکن، لە هەردوو ڕیزی AB=11AB = 11ـدا F=1F = 1 دەدات. D3D_3 دەبێت چی بێت؟

Comparators: equal, greater or smaller?بەراوردکەرەکان: یەکسان، گەورەتر یان بچووکتر؟

A comparator compares two binary numbers A and B. Equality you already know: one XNOR per pair of bits and an AND gate. A magnitude comparator also says which number is larger. For one bit, with G for A>BA > B, E for A=BA = B and L for A<BA < B:

دوو ژمارەی A و B بەراورد دەکات. یەکسانی پێشتر دەیزانیت: بۆ هەر جووتە بیتێک یەک XNOR و گەیتێکی AND. قەبارە هەروەها دەڵێت کام ژمارە گەورەترە. بۆ یەک ، کە G بۆ A>BA > B، E بۆ A=BA = B و L بۆ A<BA < Bـە:

G=A B‾E=A⊕B‾L=A‾ BG = A\,\overline{B} \qquad E = \overline{A \oplus B} \qquad L = \overline{A}\,B

For longer numbers, compare from the most significant bit down, the way you compare 47 and 45: the first position where the numbers differ decides. A=1011A = 1011 (11) and B=1001B = 1001 (9) agree in bits 3 and 2; in bit 1 A has the 1, so A>BA > B. The 7485 / 74HC85 chip does this for 4 bits and has extra inputs so that several chips can be chained for longer numbers.

بۆ ژمارەی درێژتر، لە بەرەو خوار بەراورد بکە، وەک چۆن ⁦47⁩ و ⁦45⁩ بەراورد دەکەیت: یەکەم شوێن کە ژمارەکان تێیدا جیاوازن بڕیار دەدات. A=1011A = 1011 ⁦(11)⁩ و B=1001B = 1001 ⁦(9)⁩ لە 3 و 2دا وەک یەکن؛ لە 1دا ⁦A 1⁩ـەکەی هەیە، بۆیە A>BA > B. ⁦7485 / 74HC85⁩ ئەمە بۆ 4 دەکات و زیادەی هەیە تاکو چەند بۆ ژمارەی درێژتر بە یەکەوە زنجیر بکرێن.

Quick checkپشکنینی خێراCompare A=0110A = 0110 and B=0111B = 0111. Which output of a magnitude comparator is 1?A=0110A = 0110 و B=0111B = 0111 بەراورد بکە. کام قەبارە 1ـە؟

These blocks as real chipsئەم بلۆکانە وەک چیپەکانی ڕاستەقینە

Every block in this lesson is sold as a small chip of the 7400 family (and its CMOS relatives). Inside a modern processor the same blocks are parts of one huge circuit, but they work exactly as here.

هەموو بلۆکێکی ئەم وانەیە وەک بچووکی خێزانی ⁦7400⁩ (و خزمە CMOSـەکانی) دەفرۆشرێت. لەناو پرۆسێسەرێکی نوێدا هەمان بلۆکەکان بەشێکن لە یەک زۆر گەورە، بەڵام ڕێک وەک ئێرە کار دەکەن.

Building blocks you can buyبلۆکە بنیاتنەرەکان کە دەتوانیت بیانکڕیت
ChipBlockبلۆک
74HC157four 2-to-1 multiplexersچوار دوو بۆ یەک
74HC153two 4-to-1 multiplexersدوو چوار بۆ یەک
74HC151one 8-to-1 multiplexerیەک هەشت بۆ یەک
74HC1383-to-8 decoder/demultiplexer, active-low outputs/ سێ بۆ هەشت، چالاک بە LOW
74HC139two 2-to-4 decodersدوو دوو بۆ چوار
74HC1488-to-3 priority encoder، هەشت بۆ سێ
74HC14710-to-4 priority encoder (keypad to BCD)، دە بۆ چوار (تەختەی ژمارە بۆ )
4511BCD-to-7-segment decoder and display driver BCD بۆ حەوت بەش و لێخوڕی پیشاندەر
74HC854-bit magnitude comparator قەبارەی 4 بیتی
Quick checkپشکنینی خێراYou want a 3-bit number to light exactly one of eight LEDs. Which chip fits best?دەتەوێت ژمارەیەکی 3 بیتی ڕێک یەک لە هەشت ڕووناک بکاتەوە. کام باشترین گونجاوە؟

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

  • Counting select lines wrongly. 8 inputs need 3 select lines, not 8: n select lines choose among 2n2^n inputs. For 12 inputs you still need 4 (and 4 inputs stay unused).
  • Mixing up MUX and DEMUX. A multiplexer has many inputs and one output; a demultiplexer has one input and many outputs.
  • Forgetting active-low outputs. On a 74HC138 the selected output is the one that is 0. An LED wired from an output to ground would light for every output except the selected one.
  • Confusing decoder and encoder. A decoder turns a code into one active line; an encoder turns one active line into a code.
  • Trusting a simple encoder with two active inputs. Two active inputs give a wrong code; use a priority encoder.
  • Forgetting the enable. A decoder with E=0E = 0 keeps every output inactive, however correct the other inputs are.
  • Reading select bits in the wrong order. S1S0=10S_1S_0 = 10 means input 2: S1S_1 is the more significant bit, not input 1.
  • هەڵە ژماردنی هێڵەکانی هەڵبژاردن. 8 پێویستیان بە 3 هێڵی هەڵبژاردنە، نەک ⁦8: n⁩ هێڵی هەڵبژاردن لە نێوان 2n2^n هەڵدەبژێرن. بۆ ⁦12⁩ هێشتا 4ت پێویستە (و 4 بەکار نایەن).
  • تێکەڵکردنی MUX و DEMUX. چەند و یەک هەیە؛ یەک و چەند هەیە.
  • لەبیرکردنی چالاک بە LOW. لە ⁦74HC138⁩دا هەڵبژێردراوەکە ئەوەیە کە 0ـە. کە لە بۆ GND ببەسترێت بۆ هەموو ڕووناک دەبێتەوە جگە لە هەڵبژێردراوەکە.
  • تێکەڵکردنی و . کۆدێک دەکات بە یەک هێڵی چالاک؛ یەک هێڵی چالاک دەکات بە کۆدێک.
  • متمانەکردن بە سادە کاتێک دوو چالاکن. دوو چالاک کۆدێکی هەڵە دەدەن؛ بەکار بهێنە.
  • لەبیرکردنی چالاککردن. کە E=0E = 0 بێت هەموو ناچالاک دەهێڵێتەوە، تر هەرچەند دروست بن.
  • خوێندنەوەی هەڵبژاردن بە ڕیزبەندیی هەڵە. S1S0=10S_1S_0 = 10 واتە 2: S1S_1 گرنگترەکەیە، نەک 1.

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

Original exercises in the spirit of the course's exercise set: build functions with a decoder and external gates, simplify with don't-cares, and read MSI blocks. Try each one before you open the answer.

ڕاهێنانی تازە لەسەر شێوەی ڕاهێنانەکانی کۆرسەکە: دروستکردنی بە و دەرەکی، کورتکردنەوە بە و خوێندنەوەی بلۆکەکانی MSI. پێش کردنەوەی وەڵام هەر یەکێکیان تاقی بکەرەوە.

ExerciseڕاهێنانA multiplexer in disguiseمەڵتیپلێکسەرێک بە دەمامکەوە

A 4-to-1 multiplexer has D0=0D_0 = 0, D1=1D_1 = 1, D2=1D_2 = 1, D3=0D_3 = 0. Its select lines S1S0S_1S_0 go through 00, 01, 10, 11, 10. Write the output for each step. Which gate does this multiplexer imitate?

چوار بۆ یەک D0=0D_0 = 0، D1=1D_1 = 1، D2=1D_2 = 1، D3=0D_3 = 0ـی هەیە. هێڵەکانی هەڵبژاردنی S1S0S_1S_0 بە ڕیز دەبنە ⁦00⁩، ⁦01⁩، ⁦10⁩، ⁦11⁩، ⁦10⁩. هەر هەنگاوێک بنووسە. ئەم لاسایی کام دەکاتەوە؟

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

Y=0,1,1,0,1Y = 0, 1, 1, 0, 1. Y is 1 exactly when S1S_1 and S0S_0 differ, so the multiplexer behaves like an XOR gate: Y=S1⊕S0Y = S_1 \oplus S_0. This is the "any function from a multiplexer" idea: the data inputs hold the XOR truth table.

Y=0,1,1,0,1Y = 0, 1, 1, 0, 1. Y ڕێک کاتێک 1ـە کە S1S_1 و S0S_0 جیاواز بن، بۆیە وەک ڕەفتار دەکات: Y=S1⊕S0Y = S_1 \oplus S_0. ئەمە بیرۆکەی «هەر بە »ـە: XOR هەڵدەگرن.

ExerciseڕاهێنانSelect lines and table rowsهێڵەکانی هەڵبژاردن و ڕیزەکانی خشتە

(a) How many select lines do multiplexers with 32, 12 and 2 data inputs need? (b) How many rows would the full truth table of a 16-to-1 multiplexer have, and how many rows does its abbreviated table have?

(أ) بە ⁦32⁩، ⁦12⁩ و 2 پێویستیان بە چەند هێڵی هەڵبژاردنە؟ (ب) تەواوی شازدە بۆ یەک چەند ڕیزی دەبێت و خشتە کورتکراوەکەی چەند ڕیزی هەیە؟

Show answerوەڵامەکە پیشان بدە
  • (a) 32 inputs: 5 select lines (25=322^5 = 32). 12 inputs: 4 select lines, because 3 lines reach only 8; four of the 16 positions stay unused. 2 inputs: 1 select line.
  • (b) 4 select lines and 16 data inputs make 20 inputs, so 220=1 048 5762^{20} = 1\,048\,576 rows. The abbreviated table has one row per select code: 16 rows.
  • (أ) ⁦32⁩ : 5 هێڵی هەڵبژاردن (25=322^5 = 32). ⁦12⁩ : 4 هێڵی هەڵبژاردن، چونکە 3 هێڵ تەنها دەگەنە 8؛ چوار شوێن لە ⁦16⁩ـەکە بەکار نایەن. 2 : 1 هێڵی هەڵبژاردن.
  • (ب) 4 هێڵی هەڵبژاردن لەگەڵ ⁦16⁩ دەبنە ⁦20⁩ ، بۆیە 220=1 048 5762^{20} = 1\,048\,576 ڕیز. خشتە کورتکراوەکە بۆ هەر کۆدێکی هەڵبژاردن یەک ڕیزی هەیە: ⁦16⁩ ڕیز.
ExerciseڕاهێنانA bigger multiplexer from smaller onesمەڵتیپلێکسەرێک گەورەتر لە بچووکترەکان

Build an 8-to-1 multiplexer from two 4-to-1 multiplexers and one 2-to-1 multiplexer. Which select line goes to the 2-to-1 multiplexer? Trace the select code 110.

هەشت بۆ یەک لە دوو چوار بۆ یەک و یەک دوو بۆ یەک دروست بکە. کام هێڵی هەڵبژاردن دەچێت بۆ دوو بۆ یەک؟ کۆدی هەڵبژاردنی ⁦110⁩ هەنگاو بە هەنگاو بپشکنە.

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

The first 4-to-1 multiplexer takes D0…D3D_0 \ldots D_3, the second D4…D7D_4 \ldots D_7; S1S0S_1S_0 go to both. Their two outputs enter the 2-to-1 multiplexer, whose select line is the most significant bit S2S_2. For 110: both 4-to-1 multiplexers pick their input 2 (D2D_2 and D6D_6); S2=1S_2 = 1 chooses the upper group, so Y=D6Y = D_6 — and 110 is six.

یەکەمی چوار بۆ یەک D0…D3D_0 \ldots D_3 وەردەگرێت و دووەمیان D4…D7D_4 \ldots D_7؛ S1S0S_1S_0 دەچن بۆ هەردووکیان. دوو دەچنە ناو دوو بۆ یەک کە هێڵی هەڵبژاردنەکەی ، S2S_2ـە. بۆ ⁦110⁩: هەردوو چوار بۆ یەک 2ـی خۆیان هەڵدەبژێرن (D2D_2 و D6D_6)؛ S2=1S_2 = 1 گرووپی سەرەوە هەڵدەبژێرێت، بۆیە Y=D6Y = D_6 — و ⁦110⁩ واتە شەش.

ExerciseڕاهێنانReading an active-low decoderخوێندنەوەی کۆدهەڵوەشێنەرێک چالاک بە LOW

A 74HC138 is enabled and receives the binary input 011. Write its outputs Y7…Y0Y_7 \ldots Y_0. Which output is selected, and how do you recognise it?

⁦74HC138⁩ چالاک کراوە و ⁦011⁩ وەردەگرێت. Y7…Y0Y_7 \ldots Y_0 بنووسە. کام هەڵبژێردراوە و چۆن دەیناسیتەوە؟

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

Y7…Y0=1111 0111Y_7 \ldots Y_0 = 1111\,0111. 011 is three, so Y3Y_3 is selected; on an active-low chip it is the only output that is 0.

Y7…Y0=1111 0111Y_7 \ldots Y_0 = 1111\,0111. ⁦011⁩ واتە سێ، بۆیە Y3Y_3 هەڵبژێردراوە؛ لە چالاک بە LOWـدا ئەوە تاکە کە 0ـە.

ExerciseڕاهێنانA full adder from one decoderکۆکەرەوەی تەواو لە یەک کۆدهەڵوەشێنەر

Build a full adder — inputs A, B and the carry-in C, outputs S and CoutC_{out} — from one 3-to-8 decoder and two OR gates. Which outputs feed each OR gate?

کۆکەرەوەی تەواو — A، B و هاتوو C، S و CoutC_{out} — لە یەک سێ بۆ هەشت و دوو دروست بکە. کام ژمارانە دەچنە ناو هەر یەکێک لە ؟

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

S is 1 when an odd number of inputs are 1: rows 001, 010, 100, 111, so S=Σm(1,2,4,7)S = \Sigma m(1, 2, 4, 7). CoutC_{out} is 1 when at least two inputs are 1: Cout=Σm(3,5,6,7)C_{out} = \Sigma m(3, 5, 6, 7). Output 7 feeds both OR gates; output 0 is not used. All eight rows were checked.

S کاتێک 1ـە کە ژمارەیەکی تاک لە 1 بن: ڕیزەکانی ⁦001⁩، ⁦010⁩، ⁦100⁩، ⁦111⁩، بۆیە S=Σm(1,2,4,7)S = \Sigma m(1, 2, 4, 7). CoutC_{out} کاتێک 1ـە کە لانیکەم دوو 1 بن: Cout=Σm(3,5,6,7)C_{out} = \Sigma m(3, 5, 6, 7). 7 دەچێتە ناو هەردوو ؛ 0 بەکار نایەت. هەر هەشت ڕیزەکە پشکنران.

ExerciseڕاهێنانAn identity, then a circuitیەکسانییەک، پاشان سووڕێک

Show with Boolean algebra that A‾ B‾ C‾+A‾BC+AB‾C+ABC‾=A⊕B⊕C‾\overline{A}\,\overline{B}\,\overline{C} + \overline{A}BC + A\overline{B}C + AB\overline{C} = \overline{A \oplus B \oplus C}. Then say which decoder outputs build this function. Where in this lesson have you met it?

بە پیشانی بدە کە A‾ B‾ C‾+A‾BC+AB‾C+ABC‾=A⊕B⊕C‾\overline{A}\,\overline{B}\,\overline{C} + \overline{A}BC + A\overline{B}C + AB\overline{C} = \overline{A \oplus B \oplus C}. پاشان بڵێ کام ئەم دروست دەکەن. لە کوێی ئەم وانەیەدا بینیوتە؟

Show answerوەڵامەکە پیشان بدە
A‾ (B‾ C‾+BC)+A (B‾C+BC‾)=A‾  (B⊕C)‾+A (B⊕C)=A⊕(B⊕C)‾\begin{aligned} &\overline{A}\,(\overline{B}\,\overline{C} + BC) + A\,(\overline{B}C + B\overline{C}) \\ &= \overline{A}\;\overline{(B \oplus C)} + A\,(B \oplus C) \\ &= \overline{A \oplus (B \oplus C)} \end{aligned}

Group the terms by A. The first bracket is 1 when B and C are equal — the XNOR of B and C; the second is their XOR. Write W=B⊕CW = B \oplus C: then A‾ W‾+AW\overline{A}\,\overline{W} + AW is 1 exactly when A and W are equal, which is A⊕W‾\overline{A \oplus W}. The four minterms are 0, 3, 5 and 6, so decoder outputs 0, 3, 5 and 6 go into one OR gate. It is the odd-parity bit P of Any function from a decoder and an OR gate.

بڕەکان بەپێی A گرووپ بکە. کەوانەی یەکەم کاتێک 1ـە کە B و C وەک یەک بن — XNORـی B و C؛ دووەمیان XORـەکەیانە. با W=B⊕CW = B \oplus C بێت: ئەو کاتە A‾ W‾+AW\overline{A}\,\overline{W} + AW ڕێک کاتێک 1ـە کە A و W وەک یەک بن، واتە A⊕W‾\overline{A \oplus W}. چوار 0، 3، 5 و 6ـن، بۆیە 0، 3، 5 و 6ـی دەچنە ناو یەک . ئەمە تاک Pـیە لە هەر نەخشەیەکی بوولی بە کۆدهەڵوەشێنەرێک و گەیتێکی OR.

ExerciseڕاهێنانA function on a 4-to-1 multiplexerنەخشەیەکی بوولی لەسەر مەڵتیپلێکسەرێکی چوار بۆ یەک

Build G(A,B,C)=Σm(1,2,6,7)G(A, B, C) = \Sigma m(1, 2, 6, 7) with one 4-to-1 multiplexer, A and B on the select lines. What goes on D0…D3D_0 \ldots D_3?

G(A,B,C)=Σm(1,2,6,7)G(A, B, C) = \Sigma m(1, 2, 6, 7) بە یەک چوار بۆ یەک دروست بکە کە A و B لەسەر هێڵەکانی هەڵبژاردنن. چی دەخرێتە سەر D0…D3D_0 \ldots D_3؟

Show answerوەڵامەکە پیشان بدە
A BG when C=0C = 0G کاتێک C=0C = 0G when C=1C = 1G کاتێک C=1C = 1Data input
0 00 (m0)1 (m1)D0=CD_0 = C
0 11 (m2)0 (m3)D1=C‾D_1 = \overline{C}
1 00 (m4)0 (m5)D2=0D_2 = 0
1 11 (m6)1 (m7)D3=1D_3 = 1

Checked for all eight rows of A, B, C.

بۆ هەر هەشت ڕیزی A، B، C پشکنرا.

ExerciseڕاهێنانDon't-cares in the priority encoderدۆخە بێبایەخەکان لە کۆدکەری پێشینەییدا

Use the rows of the priority-encoder table (with their Xs) to show that Y1=D3+D2Y_1 = D_3 + D_2.

ڕیزەکانی خشتەی (لەگەڵ Xـەکانیان) بەکار بهێنە بۆ ئەوەی پیشان بدەیت Y1=D3+D2Y_1 = D_3 + D_2.

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

Y1=1Y_1 = 1 in two rows: 01XX and 1XXX. Row 01XX is D3‾D2\overline{D_3}D_2 (the Xs drop out); row 1XXX is D3D_3. So Y1=D3+D3‾D2=D3+D2Y_1 = D_3 + \overline{D_3}D_2 = D_3 + D_2 by the rule A+A‾B=A+BA + \overline{A}B = A + B. The don't-cares did the simplifying: each X row stands for 4 or 8 full rows.

Y1=1Y_1 = 1 لە دوو ڕیزدا: ⁦01XX⁩ و ⁦1XXX⁩. ڕیزی ⁦01XX⁩ D3‾D2\overline{D_3}D_2ـە (Xـەکان لادەچن)؛ ڕیزی ⁦1XXX⁩ D3D_3ـە. کەواتە Y1=D3+D3‾D2=D3+D2Y_1 = D_3 + \overline{D_3}D_2 = D_3 + D_2 بەپێی یاسای A+A‾B=A+BA + \overline{A}B = A + B. کورتکردنەوەکەیان کرد: هەر ڕیزێکی X جێگەی 4 یان 8 ڕیزی تەواو دەگرێتەوە.

Summaryپوختە

  • Building blocks (MSI) are small ready-made circuits; this lesson's blocks are still combinational.
  • A multiplexer copies one of 2n2^n data inputs to its output, chosen by n select lines: Y=S‾D0+SD1Y = \overline{S}D_0 + SD_1. Datasheets use abbreviated tables (a full 8-to-1 table has 2048 rows).
  • A demultiplexer sends one input to one of 2n2^n outputs; a MUX–DEMUX pair lets signals share one wire.
  • A decoder turns an n-bit code into one active output out of 2n2^n; its outputs are the minterms. Decoder + enable = demultiplexer. BCD-to-7-segment decoders drive digit displays.
  • An encoder turns one active line into its code; a priority encoder lets the highest active input win and adds a valid output V.
  • Any function can be built from a decoder plus an OR gate (OR the minterms) or from a multiplexer (variables on the select lines).
  • A comparator tests A=BA = B with XNORs and finds A>BA > B or A<BA < B at the first differing bit from the left.
  • بلۆکە بنیاتنەرەکان ⁦(MSI)⁩ بچووکی ئامادەن؛ بلۆکەکانی ئەم وانەیە هێشتا تێکەڵەیین.
  • یەکێک لە 2n2^n کۆپی دەکات بۆ کە n هێڵی هەڵبژاردن هەڵیدەبژێرن: Y=S‾D0+SD1Y = \overline{S}D_0 + SD_1. پەڕەکانی زانیاری خشتەی کورتکراوە بەکار دەهێنن (خشتەی تەواوی هەشت بۆ یەک ⁦2048⁩ ڕیزی هەیە).
  • یەک دەنێرێت بۆ یەکێک لە 2n2^n ؛ جووتێکی MUX و DEMUX ڕێگە دەدەن یەک وایەر بەکار بهێنن.
  • کۆدێکی n دەکات بە یەک چالاک لە 2n2^n؛ . + چالاککردن = . BCD بۆ حەوت بەش دەجووڵێنن.
  • یەک هێڵی چالاک دەکات بە کۆدەکەی؛ ڕێگە دەدات بەرزترین چالاک ببەتەوە و V زیاد دەکات.
  • هەر دەتوانرێت بە و (OR کردنی ) یان بە (گۆڕاوەکان لەسەر هێڵەکانی هەڵبژاردن) دروست بکرێت.
  • بە XNOR A=BA = B تاقی دەکاتەوە و لە یەکەم جیاوازەوە لە لای چەپەوە A>BA > B یان A<BA < B دەدۆزێتەوە.

Videoڤیدیۆ

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

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

Multiplexers and DecodersComputer Engineering with Colin · Englishئینگلیزی · 78K viewsبینین · 1.3K likesلایک

How select lines choose one input in 4-to-1 and 8-to-1 multiplexers, and how a 2-to-4 decoder activates one output.

هێڵەکانی هەڵبژاردن چۆن یەک لە 4 بۆ 1 و 8 بۆ 1ـدا هەڵدەبژێرن، هەروەها 2 بۆ 4 چۆن یەک چالاک دەکات.

Chapters: 1:33 4-to-1 MUX, 3:33 8-to-1 MUX, 6:41 2-to-4 decoder.

بەشەکان: ⁦1:33 MUX⁩ـی 4 بۆ 1، ⁦3:33 MUX⁩ـی 8 بۆ 1، ⁦6:41⁩ 2 بۆ 4.

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

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

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

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

Latches and Flip-Flops: One Bit of Memoryلاچەکان و فلیپ-فلۆپەکان: بیرگەی یەک بیتی

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

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