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

Registers and Countersتۆمارگەکان و ژمێرەرە دیجیتاڵەکان

Flip-flops working together: registers with a LOAD input, shift registers (SISO, SIPO, PISO, PIPO, bidirectional) and shifting as multiplying or dividing by 2, the 3-bit ripple counter of the simulator lab and why it is slow, synchronous counters designed with excitation tables, mod-n, decade, ring and Johnson counters, state tables and diagrams (Moore and Mealy), and how these blocks form a CPU.

ئەو پێکەوە کار دەکەن: بە LOAD، جووڵاندن (SISO، SIPO، PISO، PIPO، دوو-ئاڕاستە) و جووڵاندن وەک لێکدان و دابەشکردن بە 2، ناهاوکاتی سێ لە تاقیگەی و بۆچی هێواشە، هاوکات کە بە دیزاین دەکرێن، ⁦mod-n⁩، دەیی، ئەڵقەیی و Johnson، و (Moore و Mealy) و چۆن ئەم بلۆکانە پێک دەهێنن.

27 min read30 خولەک خوێندنەوە · 23 stepsهەنگاو

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

  • Explain how a register with LOAD and a shift register are built from D flip-flops, and use shifts to multiply and divide by 2.
  • Trace a ripple counter pulse by pulse and explain why it is slow.
  • Design a synchronous counter with an excitation table and Karnaugh maps.
  • Use mod-n, ring and Johnson counters, and read state tables and state diagrams.
  • Name the sequential and combinational blocks inside a CPU.
  • ڕوون بکەیتەوە بە LOAD و جووڵاندن چۆن لە D دروست دەکرێن و جووڵاندن بۆ لێکدان و دابەشکردن بە 2 بەکار بهێنیت.
  • ناهاوکات بە بپشکنیت و ڕوون بکەیتەوە بۆچی هێواشە.
  • هاوکات بە و دیزاین بکەیت.
  • ⁦mod-n⁩، ئەڵقەیی و Johnson بەکار بهێنیت و و بخوێنیتەوە.
  • ناوی بلۆکە زنجیرەیی و تێکەڵەییەکانی ناو بزانیت.

Registers: a row of flip-flopsتۆمارگەکان: ڕیزێک فلیپ-فلۆپ

Definitionپێناسە

A group of flip-flops that stores one binary word, for example 8, 32 or 64 bits. A processor keeps the numbers it is working on in registers.

کۆمەڵێک کە یەک هەڵدەگرێت، بۆ نموونە 8، ⁦32⁩ یان ⁦64⁩ بیت. ئەو ژمارانەی کاریان لەسەر دەکات لە تۆمارگەکاندا هەڵیان دەگرێت.

A register is a group of n D flip-flops that share one clock. Together they hold an n-bit word, and at the clock edge all n bits are stored at the same moment — a parallel load. What the CPU's registers are used for (the program counter, the accumulator…) is explained in Registers and buses; this lesson shows how registers and counters are built.

کۆمەڵەیەک لە n Dـیە کە یەک بەکار دەهێنن. پێکەوە n هەڵدەگرن و لە لێواری هەموو n لە هەمان ساتدا هەڵدەگیرێن — بارکردنی تەریب (parallel load). ئەوەی بۆ چی بەکار دێن (، کۆکەرەوە…) لە تۆمارگەکان و تێپەڕگەکان ڕوون کراوەتەوە؛ ئەم وانەیە پیشان دەدات و چۆن دروست دەکرێن.

Usually a register should not take a new value at every clock edge. A LOAD input decides: each flip-flop gets a 2-to-1 multiplexer in front of its D input. With LOAD=0\mathrm{LOAD} = 0 the multiplexer feeds the flip-flop's own Q back, so the edge stores the same bit again; with LOAD=1\mathrm{LOAD} = 1 it passes the new input.

زۆرجار نابێت لە هەموو لێوارێکی بەهایەکی نوێ وەربگرێت. LOAD بڕیار دەدات: هەر مەڵتیپلێکسەرێکی دوو بۆ یەک لە پێش Dـەکەیدا هەیە. بە LOAD=0\mathrm{LOAD} = 0، Qـی خودی دەگەڕێنێتەوە، بۆیە لێوارەکە هەمان دیسان هەڵدەگرێت؛ بە LOAD=1\mathrm{LOAD} = 1، نوێیەکە تێدەپەڕێنێت.

Two panels. Left: one bit of a register with LOAD. A 2-to-1 multiplexer feeds the D input of a D flip-flop; its input 0 is the flip-flop's own Q, fed back by a highlighted wire, and its input 1 is the new D. LOAD drives the multiplexer's select input and CLK the flip-flop's clock. Notes: LOAD = 0, Q is fed back and kept; LOAD = 1, the new D is stored at the edge. Right: a 4-bit register, four D flip-flops stacked, inputs D3 to D0, outputs Q3 to Q0, all clock inputs on one CLK line. Note: one edge stores all four bits at once.دوو بەش. چەپ: یەک بیتی تۆمارگەیەک بە LOAD. مەڵتیپلێکسەرێکی دوو بۆ یەک نێوخستەی Dـی فلیپ-فلۆپێکی D پڕ دەکاتەوە؛ نێوخستەی 0ـی Qـی خودی فلیپ-فلۆپەکەیە کە بە وایەرێکی ڕەنگکراو دەگەڕێتەوە و نێوخستەی 1ـی Dـی نوێیە. LOAD نێوخستەی هەڵبژاردنی مەڵتیپلێکسەرەکە و CLK سیگناڵی کاتژمێری فلیپ-فلۆپەکە دەجووڵێنن. تێبینی: LOAD = 0، Q دەگەڕێتەوە و دەپارێزرێت؛ LOAD = 1، Dـی نوێ لە لێوارەکەدا هەڵدەگیرێت. ڕاست: تۆمارگەیەکی چوار بیتی، چوار فلیپ-فلۆپی D لەسەر یەک، نێوخستەکانی D3 تا D0، دەرخستەکانی Q3 تا Q0، هەموو نێوخستەکانی سیگناڵی کاتژمێر لەسەر یەک هێڵی CLK. تێبینی: یەک لێوار هەر چوار بیتەکە پێکەوە هەڵدەگرێت.
Left: LOAD chooses between keeping Q and taking new data. Right: four flip-flops on one clock make a 4-bit register.چەپ: LOAD لە نێوان پاراستنی Q و وەرگرتنی نوێدا هەڵدەبژێرێت. ڕاست: چوار لەسەر یەک چوار پێک دەهێنن.CêIT
Quick checkپشکنینی خێراA 4-bit register holds 1010. The inputs show 0111 and LOAD=0\mathrm{LOAD} = 0. What does it hold after the next clock edge? چوار ⁦1010⁩ هەڵدەگرێت. ⁦0111⁩ پیشان دەدەن و LOAD=0\mathrm{LOAD} = 0ـە. دوای لێواری داهاتووی چی هەڵدەگرێت؟

Registers: a row of flip-flopsتۆمارگەکان: ڕیزێک فلیپ-فلۆپ

A register's short tableخشتە کورتکراوەکەی تۆمارگەیەک

Like a multiplexer, a register is described with an abbreviated table. An 8-bit register with LOAD has 8 data inputs, LOAD and 8 stored bits on the left of its table — 17 columns, so a full table would have 217=131 0722^{17} = 131\,072 rows. Two rows say everything:

وەک ، بە خشتەیەکی کورتکراوە وەسف دەکرێت. هەشت بە LOAD لە لای چەپی خشتەکەی 8 ، LOAD و 8 هەڵگیراوی هەیە — ⁦17⁩ ستوون، بۆیە خشتەیەکی تەواو 217=131 0722^{17} = 131\,072 ڕیزی دەبوو. دوو ڕیز هەموو شتێک دەڵێن:

An 8-bit register with LOAD (X = any value) هەشت بە ⁦LOAD (X⁩ = هەر بەهایەک)
LOADD₇ … D₀Q₇ … Q₀ after the edgeQ₇ … Q₀ دوای لێوار
0X … Xthe same as beforeوەک پێشوو
1d₇ … d₀d₇ … d₀
Quick checkپشکنینی خێراA 6-bit register has a LOAD input. How many rows would its full table have? شەش LOADـی هەیە. خشتە تەواوەکەی چەند ڕیزی دەبێت؟

Shift registers: bits on the moveتۆمارگەکانی جووڵاندن: بیتەکان لە جووڵەدا

Connect the flip-flops of a register in a chain: the Q of each one feeds the D of the next. Now every clock edge moves every bit one place along, and a new bit enters the first flip-flop from the serial input. Watch the bits 1, 0, 1, 1 march into a cleared 4-bit shift register:

بە زنجیر ببەستە: Qـی هەر یەکێک Dـی دواتر پڕ دەکاتەوە. ئێستا هەر لێوارێکی هەموو یەک خانە بەرەو پێش دەبات و نوێ لە زنجیرییەوە دەچێتە ناو یەکەم . سەیر بکە 1، 0، 1، 1 چۆن دەچنە ناو جووڵاندنی چوار سفرکراوەوە:

Animation in five frames of a 4-bit shift register made of four D flip-flops FF0 to FF3 on one clock line. The serial input holds the queue 1, 0, 1, 1. Frame 1: the register is cleared (0000). At each clock pulse one more bit enters FF0 and every bit moves one flip-flop to the right: Q0 Q1 Q2 Q3 = 1000, 0100, 1010 and finally 1101, when all four bits are inside and can be read at once.
Animation in five frames of a 4-bit shift register made of four D flip-flops FF0 to FF3 on one clock line. The serial input holds the queue 1, 0, 1, 1. Frame 1: the register is cleared (0000). At each clock pulse one more bit enters FF0 and every bit moves one flip-flop to the right: Q0 Q1 Q2 Q3 = 1000, 0100, 1010 and finally 1101, when all four bits are inside and can be read at once.
One bit enters and every bit moves one place per clock pulse.لە هەر یەک دێتە ژوورەوە و هەموو یەک خانە دەجووڵێت.CêIT
Shifting 1, 0, 1, 1 into a cleared 4-bit shift registerجووڵاندنی 1، 0، 1، 1 بۆ ناو جووڵاندنی چوار سفرکراو
Clock pulses Q₀ Q₁ Q₂ Q₃
00 0 0 0
11 0 0 0
20 1 0 0
31 0 1 0
41 1 0 1

After four pulses the first bit that entered is in the last flip-flop. Keep clocking and the bits leave Q₃ one by one, in the same order they came in — 1, 0, 1, 1. A serial-in, serial-out shift register is a queue: first in, first out, like the line at a bakery.

دوای چوار ، یەکەم کە هاتە ژوورەوە لە دوایین . لێدانی بەردەوام بکە و یەک یەک لە Q₃ دەردەچن، بە هەمان ڕیزبەندیی هاتنەژوورەوەیان — 1، 0، 1، 1. جووڵاندنی زنجیری بۆ زنجیری ڕیزێکە: هەرکەس یەکەم بێت یەکەم دەڕوات، وەک ڕیزی بەردەم نانەواخانە.

Quick checkپشکنینی خێراIn the table, after pulse 3 the register holds Q0Q1Q2Q3=1010Q_0Q_1Q_2Q_3 = 1010. The fourth bit entering is 1. What is in Q₃ after pulse 4?لە خشتەکەدا دوای 3، Q0Q1Q2Q3=1010Q_0Q_1Q_2Q_3 = 1010 هەڵدەگرێت. چوارەم کە دێتە ژوورەوە 1ـە. دوای 4 چی لە Q₃دایە؟

How Shift Registers Work - The Learning Circuitelement14 presents · Englishئینگلیزی · 168K viewsبینین · 3.7K likesلایک · Partبەشی 0:00–7:17 (ofلە 10:43)

How flip-flops chained in a shift register move the bits one place per clock pulse, and the serial and parallel modes.

چۆن لە جووڵاندندا بە زنجیر دەبەسترێن و لە هەر یەک خانە دەجووڵێنن، هەروەها شێوازی زنجیری و تەریب.

Plays 0:00–7:17: what a shift register is, how bits move one stage per clock, serial and parallel data, and the shift-register modes.

لە ⁦0:00⁩ تا ⁦7:17⁩ پەخش دەبێت: جووڵاندن چییە، چۆن لە هەر یەک قۆناغ دەجووڵێن، زنجیری و تەریب و شێوازەکانی جووڵاندن.

Shift registers: bits on the moveتۆمارگەکانی جووڵاندن: بیتەکان لە جووڵەدا

Four ways in and outچوار ڕێگای چوونە ژوورەوە و دەرچوون

Data can enter a shift register one bit at a time (serial) or all bits at once (parallel), and it can leave in either way too. The four combinations have names:

دەتوانێت یەک یەک (زنجیری) یان هەموو پێکەوە (تەریب) بچێتە ناو جووڵاندن و بە هەر دوو ڕێگاکەش دەربچێت. چوار تێکەڵەکە ناویان هەیە:

Shift register typesجۆرەکانی جووڵاندن
TypeجۆرIn → outژوورەوە ← دەرەوەTypical useبەکارهێنانی ئاساییExample chipنموونەی
SISOserial → serialزنجیری ← زنجیریa delay line, a queue of bitsدواخستنی ، ڕیزێک —
SIPOserial → parallelزنجیری ← تەریبreceive bits from a serial link; drive 8 LEDs from 3 pinsوەرگرتنی لە پەیوەندییەکی زنجیرییەوە؛ جووڵاندنی 8 بە 3 پین74HC595
PISOparallel → serialتەریب ← زنجیریsend a word over one wire; read 8 buttons with 3 pinsناردنی بە یەک وایەر؛ خوێندنەوەی 8 دوگمە بە 3 پین74HC165
PIPOparallel → parallelتەریب ← تەریبan ordinary register (no shifting needed) ئاسایی (جووڵاندنی پێویست نییە)74HC173
bidirectional / universalدوو-ئاڕاستە / گشتیleft or right; serial or parallelچەپ یان ڕاست؛ زنجیری یان تەریبshifting numbers both waysجووڵاندنی ژمارە بە هەردوو ئاڕاستەدا74HC194
A 4-bit serial-in, parallel-out shift register: four D flip-flops FF0 to FF3 in a row. The serial input enters D of FF0; each Q is wired to the D of the next flip-flop; every Q is also tapped upwards as a parallel output Q0 to Q3, showing 1, 1, 0, 1. All clock inputs hang on one CLK line at the bottom.تۆمارگەیەکی جووڵاندنی چوار بیتی (زنجیری بۆ تەریب): چوار فلیپ-فلۆپی D، FF0 تا FF3، لە ڕیزێکدا. نێوخستەی زنجیری دەچێتە ناو Dـی FF0؛ هەر Qـێک بە Dـی فلیپ-فلۆپی دواتر بەستراوە؛ هەر Qـێکیش بەرەو سەرەوە وەک دەرخستەی تەریب، Q0 تا Q3، دەردەهێنرێت کە 1، 1، 0، 1 پیشان دەدەن. هەموو نێوخستەکانی سیگناڵی کاتژمێر لەسەر یەک هێڵی CLK لە خوارەوەن.
Serial in, parallel out: four clock pulses bring four bits in; then all four can be read at once.زنجیری بۆ ژوورەوە، تەریب بۆ دەرەوە: چوار چوار دەهێننە ژوورەوە؛ پاشان هەر چواریان پێکەوە دەخوێنرێنەوە.CêIT

This is how serial links work. USB, SATA and Ethernet send the bits of a word one after another over a few wires, while the CPU handles whole words: a shift register at each end converts parallel to serial and back. A serial output can also be wired back to the serial input, so the data recirculates while it is read and is not lost.

پەیوەندییە زنجیرییەکان بەم شێوەیە کار دەکەن. ، SATA و Ethernet یەک لە دوای یەک بە چەند وایەرێکدا دەنێرن، لە کاتێکدا تەواوەکان بەکار دەهێنێت: جووڵاندن لە هەر لایەک تەریب دەکات بە زنجیری و بە پێچەوانەوە. زنجیری دەتوانرێت بگەڕێنرێتەوە بۆ زنجیری، تاکو لە کاتی خوێندنەوەدا بخولێتەوە و ون نەبێت.

Quick checkپشکنینی خێراA microcontroller must switch 16 LEDs but has only a few free pins. Which shift register type helps?مایکرۆکۆنترۆڵەرێک دەبێت ⁦16⁩ هەڵبکات و بکوژێنێتەوە بەڵام تەنها چەند پینێکی ئازادی هەیە. کام جۆری جووڵاندن یارمەتی دەدات؟

Shift registers: bits on the moveتۆمارگەکانی جووڵاندن: بیتەکان لە جووڵەدا

Shifting is multiplying and dividing by 2جووڵاندن واتە لێکدان و دابەشکردن بە 2

Shift a binary number one place to the left (a 0 enters on the right) and it doubles; shift it to the right and it halves, and the bit that falls out is the remainder — exactly as in Shifting left doubles a number. A bidirectional shift register can do both:

ژمارەیەکی یەک خانە بەرەو چەپ بجووڵێنە (⁦0⁩ـێک لە لای ڕاستەوە دێتە ژوورەوە) و دوو هێندە دەبێت؛ بەرەو ڕاست بیجووڵێنە و دەبێتە نیوە و ئەو دەکەوێتە دەرەوە پاشماوەکەیە — ڕێک وەک جووڵاندن بۆ چەپ ژمارە دوو هێندە دەکات. جووڵاندنی دوو-ئاڕاستە دەتوانێت هەردووکیان بکات:

Shifting 5-bit and 4-bit numbersجووڵاندنی ژمارەی پێنج و چوار
OperationکارBitsValueبەها
startسەرەتا001106
shift leftجووڵاندن بۆ چەپ0110012
shift right (from the start)جووڵاندن بۆ ڕاست (لە سەرەتاوە)000113
shift right 1011جووڵاندنی ⁦1011⁩ بۆ ڕاست01015, remainder 15، پاشماوە 1

In a rotate, the bit that falls out on one side comes back in on the other side, so nothing is lost: rotating 1011 right gives 1101. Processors have shift and rotate instructions, and they use shifts for fast multiplication and division by powers of 2.

لە سووڕاندندا (rotate)، ئەو لە لایەکەوە دەکەوێتە دەرەوە لە لایەکەی ترەوە دەگەڕێتەوە ژوورەوە، بۆیە هیچ شتێک ون نابێت: سووڕاندنی ⁦1011⁩ بۆ ڕاست ⁦1101⁩ دەدات. پرۆسێسەرەکان جووڵاندن و سووڕاندنیان هەیە و جووڵاندن بۆ لێکدان و دابەشکردنی خێرا بە توانەکانی 2 بەکار دەهێنن.

Quick checkپشکنینی خێراA shift register holds 0111 (7). It shifts left once, with a 0 entering on the right. What does it hold now? جووڵاندن ⁦0111 (7)⁩ هەڵدەگرێت. یەک جار بەرەو چەپ دەجووڵێت و 0ـێک لە لای ڕاستەوە دێتە ژوورەوە. ئێستا چی هەڵدەگرێت؟

Countersژمێرەرە دیجیتاڵەکان

Definitionپێناسە

A sequential circuit made of flip-flops that counts clock pulses in binary: 000, 001, 010 and so on.

کە لە دروست کراوە و بە دەژمێرێت: ⁦000⁩، ⁦001⁩، ⁦010⁩ و هتد.

A counter is a sequential circuit that steps through a fixed sequence of states, one step per clock pulse. With n flip-flops it can have at most 2n2^n states: 3 flip-flops count 000 to 111 (0 to 7) and then roll over to 000. Write binary counting in a column and a pattern appears:

کە بە زنجیرەیەکی دیاریکراوی دۆخەکاندا دەڕوات، لە هەر هەنگاوێک. بە n زۆرترین 2n2^n دۆخی دەبێت: 3 لە ⁦000⁩ـەوە تا ⁦111 (0⁩ تا ⁦7⁩) دەژمێرن و پاشان دەگەڕێنەوە بۆ ⁦000⁩. ژماردنی دووانی لە ستوونێکدا بنووسە و نەخشەیەک دەردەکەوێت:

A 3-bit counter, pulse by pulse سێ ، بە
CountژمارەQ₂ Q₁ Q₀
00 0 0
10 0 1
20 1 0
30 1 1
41 0 0
51 0 1
61 1 0
71 1 1
80 0 0

Read each column downwards: Q₀ changes at every count, Q₁ every second count, Q₂ every fourth count. A bit changes exactly when all the bits to its right are 1 — the moment a carry arrives. Changing at every pulse is what a T flip-flop with T=1T = 1 does.

هەر ستوونێک بەرەو خوار بخوێنەوە: Q₀ لە هەموو ژماردنێکدا دەگۆڕێت، Q₁ لە هەر دوو ژماردن جارێک، Q₂ لە هەر چوار ژماردن جارێک. ڕێک کاتێک دەگۆڕێت کە هەموو لای ڕاستی 1 بن — ساتی گەیشتنی . گۆڕان لە هەموو ئەوەیە کە T بە T=1T = 1 دەیکات.

Quick checkپشکنینی خێراHow many flip-flops does a counter need to count from 0 to 15 and roll over? چەند پێویستە بۆ ژماردن لە 0ـەوە تا ⁦15⁩ و گەڕانەوە؟

Countersژمێرەرە دیجیتاڵەکان

The ripple counter: each flip-flop clocks the nextژمێرەری دیجیتاڵی ناهاوکات: هەر فلیپ-فلۆپێک سیگناڵی کاتژمێری دواتر دەدات

The simplest counter uses that pattern directly. Take three JK flip-flops with J=K=1J = K = 1, so each one toggles at every active clock edge. The clock drives only the first one; the Q of each flip-flop is the clock of the next. These flip-flops change on the falling edge (like the 7476 of the lab), so a flip-flop toggles exactly when the one before it falls from 1 to 0 — which is when binary counting carries.

سادەترین ڕاستەوخۆ ئەو نەخشەیە بەکار دەهێنێت. سێ JK بە J=K=1J = K = 1 وەربگرە، بۆیە هەر یەکێکیان لە هەموو لێوارێکی چالاکی هەڵدەگەڕێتەوە. تەنها یەکەمیان دەجووڵێنێت؛ Qـی هەر دواترە. ئەم لە دەگۆڕێن (وەک ⁦7476⁩ـی تاقیگەکە)، بۆیە ڕێک کاتێک هەڵدەگەڕێتەوە کە ئەوەی پێشی لە 1ـەوە دەبێتە 0 — کە ڕێک ساتی ژماردنی .

Animation in nine frames of the 3-bit ripple counter with LEDs and a growing timing diagram of CLK, Q0, Q1 and Q2 over eight clock pulses. Frame 1: all LEDs off, 000. Frames 2 to 8: after each falling clock edge the count goes up by one — 001, 010, 011, 100, 101, 110, 111 — with Q0 toggling every pulse, Q1 every second pulse and Q2 every fourth pulse; a box shows the binary count and its decimal value. Frame 9: the eighth pulse turns 111 back into 000.
Animation in nine frames of the 3-bit ripple counter with LEDs and a growing timing diagram of CLK, Q0, Q1 and Q2 over eight clock pulses. Frame 1: all LEDs off, 000. Frames 2 to 8: after each falling clock edge the count goes up by one — 001, 010, 011, 100, 101, 110, 111 — with Q0 toggling every pulse, Q1 every second pulse and Q2 every fourth pulse; a box shows the binary count and its decimal value. Frame 9: the eighth pulse turns 111 back into 000.
Q0 toggles every pulse, Q1 every second, Q2 every fourth: the LEDs count 000 to 111 and roll over.⁦Q0⁩ لە هەموو ، ⁦Q1⁩ لە هەر دووان جارێک، ⁦Q2⁩ لە هەر چواران جارێک هەڵدەگەڕێتەوە: LEDـەکان لە ⁦000⁩ـەوە تا ⁦111⁩ دەژمێرن و دەگەڕێنەوە سەرەتا.CêIT

Each stage also halves the frequency: with a 1 kHz clock, Q₀ is a 500 Hz square wave, Q₁ 250 Hz and Q₂ 125 Hz. A counter is a frequency divider too.

هەر قۆناغێک دەکاتە نیوە: بە ⁦1 kHz⁩، Q₀ بە ⁦500 Hz⁩ـە، Q₁ بە ⁦250 Hz⁩ و Q₂ بە ⁦125 Hz⁩. دابەشکەری .

Quick checkپشکنینی خێراThe counter shows 101. Which flip-flops toggle at the next clock pulse? ⁦101⁩ پیشان دەدات. لە داهاتووی کام هەڵدەگەڕێنەوە؟

Binary counterBen Eater · Englishئینگلیزی · 246K viewsبینین · 5K likesلایک

Chains JK flip-flops in toggle mode, each one clocking the next, and shows that their outputs count in binary.

JK لە دۆخی هەڵگەڕانەوەدا بە زنجیر دەبەستێت، هەر یەکێکیان دەبێتە دواتر، پاشان پیشان دەدات کە بە دەژمێرن.

Ben Eater: toggling JK flip-flops make a binary (ripple) counter.

⁦Ben Eater⁩: JK کە هەڵدەگەڕێنەوە () دروست دەکەن.

Countersژمێرەرە دیجیتاڵەکان

Why ripple counters are slowبۆچی ژمێرەرە دیجیتاڵەکانی ناهاوکات هێواشن

In a ripple counter the flip-flops do not change together. Each one waits for the one before it, and each adds its own propagation delay (a few nanoseconds). Going from 011 to 100, the counter really passes through two wrong values:

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

011  →  010  →  000  →  100011 \;\to\; 010 \;\to\; 000 \;\to\; 100

Q0 falls first, then Q1, then Q2 rises. For a moment the outputs show 2 and 0. A circuit that watches for 000 would see a false "zero" between 3 and 4 — a glitch.

سەرەتا ⁦Q0⁩ دادەبەزێت، پاشان ⁦Q1⁩، پاشان ⁦Q2⁩ بەرز دەبێتەوە. بۆ ساتێک 2 و 0 پیشان دەدەن. کە چاوەڕێی ⁦000⁩ بێت لە نێوان 3 و 4دا «سفر»ێکی درۆ دەبینێت — گلیچ (glitch).

The worst case is when every bit changes, as in 111 → 000: the last flip-flop settles only after n delays. With 4 flip-flops of 10 ns each, the count is right only 40 ns after the clock edge, so the clock must stay slower than about 25 MHz. Ripple counters are fine for slow jobs such as dividing a clock, but fast circuits use synchronous counters.

خراپترین حاڵەت ئەوەیە کە هەموو دەگۆڕێت، وەک ⁦111⁩ ← ⁦000⁩: دوایین تەنها دوای n دواکەوتن جێگیر دەبێت. بە 4 کە هەر یەکەیان ⁦10 ns⁩ بێت، ژمارەکە تەنها ⁦40 ns⁩ دوای لێواری دروستە، بۆیە دەبێت لە نزیکەی ⁦25 MHz⁩ هێواشتر بێت. ناهاوکات بۆ کاری هێواش وەک دابەشکردنی باشن، بەڵام خێرا هاوکات بەکار دەهێنن.

Quick checkپشکنینی خێراA 5-bit ripple counter uses flip-flops with a delay of 8 ns each. How long after a clock edge can the count need to settle in the worst case? ناهاوکاتی پێنج بەکار دەهێنێت کە دواکەوتنی هەر یەکەیان ⁦8 ns⁩ـە. لە خراپترین حاڵەتدا ژمارەکە چەند دوای لێواری جێگیر دەبێت؟

Countersژمێرەرە دیجیتاڵەکان

Which edge? Counting up or downکام لێوار؟ ژماردن بەرەو سەرەوە یان خوارەوە

Which edge clocks the next flip-flop decides the direction. When counting up, a bit must change exactly when the bit before it falls from 1 to 0 — the moment of the carry. Falling-edge flip-flops clocked from Q do exactly that. Q‾\overline{Q} rises at the same moment as Q falls, so rising-edge flip-flops clocked from Q‾\overline{Q} count up too.

ئەوەی کام لێوار دواتر لێدەدات ئاڕاستەکە دیاری دەکات. لە ژماردن بەرەو سەرەوەدا، دەبێت ڕێک کاتێک بگۆڕێت کە پێش خۆی لە 1ـەوە دەبێتە 0 — ساتی . کە لە Qـەوە لێیان بدرێت ڕێک ئەوە دەکەن. Q‾\overline{Q} لە هەمان ساتدا بەرز دەبێتەوە کە Q دادەبەزێت، بۆیە کە لە Q‾\overline{Q}ـەوە لێیان بدرێت هەروەها بەرەو سەرەوە دەژمێرن.

Quick checkپشکنینی خێراA 3-bit ripple counter uses rising-edge flip-flops, and each one is clocked from the Q of the one before. It shows 000. What does it show after the next clock pulse? ناهاوکاتی سێ بەکار دەهێنێت و هەر یەکێکیان لە Qـی ئەوەی پێشی لێی دەدرێت. ⁦000⁩ پیشان دەدات. دوای داهاتووی چی پیشان دەدات؟

Countersژمێرەرە دیجیتاڵەکان

Lab: build the 3-bit counter in a simulatorتاقیگە: ژمێرەری دیجیتاڵی سێ بیتی لە هاوشێوەسازدا دروست بکە

The course's simulator lab builds exactly this counter with two 7476 chips (each holds two JK flip-flops with preset and clear). Build it in Multisim, as in the lab, or in the free browser simulator CircuitVerse; how to place parts and run a simulation is in Simulating and Testing Logic Circuits.

تاقیگەی کۆرسەکە ڕێک ئەم بە دوو ⁦7476⁩ دروست دەکات (هەر یەکەیان دوو JKـی بە preset و clear تێدایە). لە Multisimـدا دروستی بکە، وەک تاقیگەکە، یان لە CircuitVerse کە بێبەرانبەری ناو ؛ چۆنیەتیی دانانی پارچەکان و کارپێکردنی هاوشێوەکردن لە وانەی هاوشێوەکردن و تاقیکردنەوەی سووڕە لۆجیکییەکاندایە.

A 3-bit ripple counter: three JK flip-flops FF0, FF1, FF2 in a row, each with J = 1 and K = 1 and a clock input drawn with a bubble and a triangle (falling edge). CLK enters FF0; Q of FF0 goes to the clock of FF1, Q of FF1 to the clock of FF2. Each Q also drives an LED labelled Q0, Q1, Q2.ژمێرەری دیجیتاڵی ناهاوکاتی سێ بیتی: سێ فلیپ-فلۆپی JK، FF0، FF1، FF2، لە ڕیزێکدا، هەر یەکەیان J = 1 و K = 1 و نێوخستەی سیگناڵێکی کاتژمێری هەیە کە بە بازنە و سێگۆشە کێشراوە (لێواری نزمبوونەوە). CLK دەچێتە ناو FF0؛ Qـی FF0 دەچێت بۆ سیگناڵی کاتژمێری FF1 و Qـی FF1 بۆ سیگناڵی کاتژمێری FF2. هەر Qـێکیش LEDـێک دەجووڵێنێت بە ناوی Q0، Q1، Q2.
The circuit to build: J=K=1J = K = 1 makes each flip-flop toggle, and the clock ripples from one flip-flop to the next.ئەو دروستی دەکەیت: J=K=1J = K = 1 هەر هەڵدەگەڕێنێتەوە و لە بۆ دواتر دەڕوات.CêIT
  1. Place a 5 V DC source and a ground, and a clock source set to a slow rate (1 Hz) so that you can watch the LEDs.

    سەرچاوەیەکی DCـی ⁦5 V⁩ و GND دابنێ، لەگەڵ سەرچاوەیەکی کە لەسەر ڕێژەیەکی هێواش ⁦(1 Hz)⁩ ڕێکخراوە تاکو بتوانیت سەیری LEDـەکان بکەیت.

  2. Place three JK flip-flops (two 7476 chips). Tie every J, every K and every preset and clear pin to 5 V (logic 1).

    سێ JK دابنێ (دوو ⁦7476⁩). هەموو J، هەموو K و هەموو پینێکی preset و clear بە ⁦5 V⁩ ببەستە (⁦1⁩ـی لۆجیکی).

  3. Wire the clock to the clock input of FF0, Q0 to the clock of FF1 and Q1 to the clock of FF2.

    ببەستە بە ⁦FF0⁩، ⁦Q0⁩ بە ⁦FF1⁩ و ⁦Q1⁩ بە ⁦FF2⁩.

  4. Put a probe or an LED on Q0, Q1 and Q2. (The lab also adds a push-button switch so you can give single pulses by hand.)

    پرۆبێک یان لەسەر ⁦Q0⁩، ⁦Q1⁩ و ⁦Q2⁩ دابنێ. (تاقیگەکە دوگمەیی زیاد دەکات تاکو بتوانیت بە دەست یەک یەک بدەیت.)

  5. Run the simulation and write the table: after 0, 1, 2 … 8 pulses the probes C B A (Q2 Q1 Q0) show 000, 001, 010 … 111 and then 000 again.

    تاقیکردنەوەکە کار پێ بکە و خشتەکە بنووسە: دوای 0، 1، 2 … 8 ، پرۆبەکانی ⁦C B A (Q2 Q1 Q0) 000⁩، ⁦001⁩، ⁦010⁩ … ⁦111⁩ و پاشان دیسان ⁦000⁩ پیشان دەدەن.

Expected count table of the labخشتەی ژماردنی چاوەڕوانکراوی تاقیگەکە
PulsesC B A (Q₂ Q₁ Q₀)
00 0 0
10 0 1
20 1 0
30 1 1
41 0 0
51 0 1
61 1 0
71 1 1
80 0 0

Synchronous counters: one clock for allژمێرەرە دیجیتاڵەکانی هاوکات: یەک سیگناڵی کاتژمێر بۆ هەموویان

A synchronous counter connects the same clock to every flip-flop, so they all change at the same edge, and the count is correct one flip-flop delay after the edge, however many bits there are. Gates decide which flip-flops toggle. From the counting pattern: flip-flop i must toggle exactly when all lower bits are 1. With JK flip-flops (J=K=TJ = K = T):

هاوکات هەمان بە هەموو دەبەستێت، بۆیە هەموویان لە هەمان لێواردا دەگۆڕێن و ژمارەکە یەک دواکەوتنی دوای لێوارەکە دروستە، هەرچەند بن. بڕیار دەدەن کام هەڵبگەڕێتەوە. لە نەخشەی ژماردنەوە: i دەبێت ڕێک کاتێک هەڵبگەڕێتەوە کە هەموو نزمتر 1 بن. بە JK (J=K=TJ = K = T):

J0=K0=1J1=K1=Q0J2=K2=Q1Q0J_0 = K_0 = 1 \qquad J_1 = K_1 = Q_0 \qquad J_2 = K_2 = Q_1 Q_0

The same rule as adding 1 in binary: a bit flips when a carry reaches it.

هەمان یاسای زیادکردنی 1 بە : کاتێک هەڵدەگەڕێتەوە کە پێی دەگات.

A 3-bit synchronous counter. Three JK flip-flops FF0, FF1, FF2 with rising-edge clock inputs all hang on one CLK line at the bottom. FF0 has J = K = 1. Q0 is wired to both J and K of FF1. An AND gate takes Q0 and Q1; its output Q1·Q0 drives both J and K of FF2. Outputs Q0, Q1, Q2.ژمێرەری دیجیتاڵی هاوکاتی سێ بیتی. سێ فلیپ-فلۆپی JK، FF0، FF1، FF2، کە نێوخستەی سیگناڵی کاتژمێری لێواری بەرزبوونەوەیان هەیە، هەموویان لەسەر یەک هێڵی CLK لە خوارەوەن. FF0 J = K = 1ـی هەیە. Q0 بە J و Kـی FF1 بەستراوە. گەیتێکی AND Q0 و Q1 وەردەگرێت؛ دەرخستەکەی، Q1·Q0، J و Kـی FF2 دەجووڵێنێت. دەرخستەکان Q0، Q1، Q2.
One clock line for all; the AND gate lets FF2 toggle only when Q1=Q0=1Q_1 = Q_0 = 1.یەک هێڵی بۆ هەموویان؛ تەنها کاتێک Q1=Q0=1Q_1 = Q_0 = 1 بێت ڕێگە دەدات ⁦FF2⁩ هەڵبگەڕێتەوە.CêIT
Quick checkپشکنینی خێراThe synchronous counter shows 011. Which flip-flops toggle at the next edge? هاوکاتەکە ⁦011⁩ پیشان دەدات. لە لێواری داهاتوودا کام هەڵدەگەڕێنەوە؟

Synchronous counters: one clock for allژمێرەرە دیجیتاڵەکانی هاوکات: یەک سیگناڵی کاتژمێر بۆ هەموویان

The excitation table: which inputs cause a change?خشتەی ورووژاندن: کام نێوخستە گۆڕانێک دروست دەکات؟

Definitionپێناسە

The reverse of a : for each change of a (0→00 \to 0, 0→10 \to 1, 1→01 \to 0, 1→11 \to 1) it lists the inputs that cause it. It is used to design counters and other .

پێچەوانەی : بۆ هەر گۆڕانێکی (0→00 \to 0، 0→10 \to 1، 1→01 \to 0، 1→11 \to 1) ئەو دەنووسێت کە دروستی دەکەن. بۆ دیزاینکردنی و تر بەکار دێت.

To design a counter we ask the opposite question to the characteristic table: the flip-flop must go from Q to Q+Q^+ — which inputs make it do that? For a JK flip-flop, going from 0 to 1 needs J=1J = 1, and K does not matter (with J=1J = 1, K=0K = 0 sets and K=1K = 1 toggles — both give 1). That "does not matter" is a don't-care, X:

بۆ دیزاینکردنی پرسیارە پێچەوانەکەی دەکەین: دەبێت لە Qـەوە بچێت بۆ Q+Q^+ — کام وای لێ دەکات؟ بۆ JK، چوون لە 0ـەوە بۆ 1 پێویستی بە J=1J = 1ـە و K گرنگ نییە (بە J=1J = 1، K=0K = 0 دادەنێت و K=1K = 1 هەڵدەگەڕێنێتەوە — هەردووکیان 1 دەدەن). ئەو «گرنگ نییە»یە ، X:

Excitation tables of the JK, T, D and SR flip-flops JK، T، D و SR
Q→Q+Q \to Q^+J KTDS R
0→00 \to 00 X000 X
0→10 \to 11 X111 0
1→01 \to 0X 1100 1
1→11 \to 1X 001X 0
Quick checkپشکنینی خێراA JK flip-flop holds 1 and must stay 1 after the next edge. What must J and K be? ⁦JK 1⁩ هەڵدەگرێت و دەبێت دوای لێواری داهاتوو هەر 1 بمێنێت. J و K دەبێت چی بن؟

Synchronous counters: one clock for allژمێرەرە دیجیتاڵەکانی هاوکات: یەک سیگناڵی کاتژمێر بۆ هەموویان

Designing the 3-bit counter step by stepدیزاینکردنی ژمێرەری دیجیتاڵی سێ بیتی هەنگاو بە هەنگاو

  1. State table. List each present state Q₂Q₁Q₀ and the next state: 000 → 001 → … → 111 → 000.

    . هەر دۆخێکی ئێستای Q₂Q₁Q₀ و دۆخی داهاتووی بنووسە: ⁦000⁩ ← ⁦001⁩ ← … ← ⁦111⁩ ← ⁦000⁩.

  2. Excitation columns. For every flip-flop and every row, look up the J K that cause its change in the excitation table.

    ستوونەکانی ورووژاندن. بۆ هەر و هەر ڕیزێک، ئەو ⁦J K⁩ بدۆزەرەوە کە گۆڕانەکەی دروست دەکەن لە .

    Excitation table of the 3-bit counter سێ
    Q₂Q₁Q₀nextداهاتووJ₂ K₂J₁ K₁J₀ K₀
    0 0 00 0 10 X0 X1 X
    0 0 10 1 00 X1 XX 1
    0 1 00 1 10 XX 01 X
    0 1 11 0 01 XX 1X 1
    1 0 01 0 1X 00 X1 X
    1 0 11 1 0X 01 XX 1
    1 1 01 1 1X 0X 01 X
    1 1 10 0 0X 1X 1X 1
  3. Simplify. Put each column on a Karnaugh map and use the Xs as don't-cares. J₀ and K₀ are 1 or X everywhere, so they are 1. J₁ and K₁ are 1 exactly where Q0=1Q_0 = 1. J₂ and K₂ are 1 only where Q1Q0=11Q_1Q_0 = 11.

    کورتکردنەوە. هەر ستوونێک بخەرە سەر و Xـەکان وەک دۆخە بێبایەخەکان بەکار بهێنە. J₀ و K₀ لە هەموو شوێنێک 1 یان Xـن، بۆیە 1ـن. J₁ و K₁ ڕێک لەو شوێنانەدا 1ـن کە Q0=1Q_0 = 1ـە. J₂ و K₂ تەنها لەو شوێنەدا 1ـن کە Q1Q0=11Q_1Q_0 = 11ـە.

    J0=K0=1J1=K1=Q0J2=K2=Q1Q0J_0 = K_0 = 1 \qquad J_1 = K_1 = Q_0 \qquad J_2 = K_2 = Q_1Q_0
  4. Draw. One AND gate is all the extra logic. With T flip-flops the same reasoning gives T0=1T_0 = 1, T1=Q0T_1 = Q_0, T2=Q1Q0T_2 = Q_1Q_0; with D flip-flops, D0=Q0‾D_0 = \overline{Q_0}, D1=Q1⊕Q0D_1 = Q_1 \oplus Q_0, D2=Q2⊕Q1Q0D_2 = Q_2 \oplus Q_1Q_0.

    کێشان. یەک هەموو لۆجیکی زیادەیە. بە T هەمان بیرکردنەوە T0=1T_0 = 1، T1=Q0T_1 = Q_0، T2=Q1Q0T_2 = Q_1Q_0 دەدات؛ بە D، D0=Q0‾D_0 = \overline{Q_0}، D1=Q1⊕Q0D_1 = Q_1 \oplus Q_0، D2=Q2⊕Q1Q0D_2 = Q_2 \oplus Q_1Q_0.

Quick checkپشکنینی خێراIn the excitation table, why is J₂ an X in the rows where Q2=1Q_2 = 1?لە ، بۆچی J₂ لەو ڕیزانەدا کە Q2=1Q_2 = 1ـە Xـە؟

Counters that stop early: mod-nژمێرەرە دیجیتاڵەکانی ⁦mod-n⁩: گەڕانەوە پێش کۆتایی

The number of states a counter goes through is its modulus. A 3-bit binary counter is mod-8. Often we need another number: a mod-6 counter (0 to 5) still needs 3 flip-flops, and 2 of the 8 patterns are never used. The decade counter is mod-10: it counts 0000 to 1001 — the BCD digits — and then returns to 0000.

ژمارەی ئەو دۆخانەی پێیاندا تێدەپەڕێت مۆدیولـەکەیەتی (modulus). سێ ⁦mod-8⁩ـە. زۆرجار ژمارەیەکی ترمان پێویستە: ⁦mod-6⁩ (⁦0⁩ تا ⁦5⁩) هێشتا 3 پێویستە و 2 نەخشە لە 8 هەرگیز بەکار نایەن. دەیی ⁦mod-10⁩ـە: لە ⁦0000⁩ـەوە تا ⁦1001⁩ دەژمێرێت — کۆدی دەیی دووانی — و پاشان دەگەڕێتەوە بۆ ⁦0000⁩.

Quick checkپشکنینی خێراHow many flip-flops does a mod-12 counter need, and how many patterns stay unused? ⁦mod-12⁩ چەند پێویستە و چەند نەخشە بەکار نایەن؟

Counters that stop early: mod-nژمێرەرە دیجیتاڵەکانی ⁦mod-n⁩: گەڕانەوە پێش کۆتایی

The decade counterژمێرەری دیجیتاڵی دەیی

A quick way to make a ripple decade counter is to watch for the first unwanted state, 1010: a NAND gate on Q₃ and Q₁ pulls the clear inputs low the moment 1010 appears, and the counter jumps back to 0000. The wrong state lasts only a few nanoseconds, but it is a glitch, so careful designs use a synchronous decade counter such as the 74HC160 (or the binary 74HC161, which can also be loaded with a start value). Chained, a mod-10 and a mod-6 counter make the mod-60 seconds counter of a digital clock.

ڕێگایەکی خێرا بۆ دروستکردنی ناهاوکاتی دەیی چاودێریکردنی یەکەم دۆخی نەویستراوە، ⁦1010⁩: لەسەر Q₃ و Q₁ clear لەو ساتەدا کە ⁦1010⁩ دەردەکەوێت دەکات بە 0 و باز دەداتەوە بۆ ⁦0000⁩. دۆخە هەڵەکە تەنها چەند نانۆچرکەیەک دەمێنێت، بەڵام گلیچێکە، بۆیە دیزاینە ورددەکان هاوکاتی دەیی وەک ⁦74HC160⁩ بەکار دەهێنن (یان ⁦74HC161⁩، کە و دەتوانرێت بە بەهایەکی سەرەتاش بار بکرێت). ⁦mod-10⁩ و یەکێکی ⁦mod-6⁩ بە زنجیر ⁦mod-60⁩ـی چرکەکانی کاتژمێرێکی دروست دەکەن.

Quick checkپشکنینی خێراA 4-bit ripple counter must count 0 to 9 and then return to 0. Which state does its NAND gate watch for, to clear the flip-flops? ناهاوکاتی چوار دەبێت لە 0ـەوە تا 9 بژمێرێت و پاشان بگەڕێتەوە بۆ 0. چاودێریی کام دۆخ دەکات بۆ سفرکردنەوەی ؟

Counters that stop early: mod-nژمێرەرە دیجیتاڵەکانی ⁦mod-n⁩: گەڕانەوە پێش کۆتایی

Ring and Johnson countersژمێرەرە دیجیتاڵەکانی ئەڵقەیی و Johnson

A shift register whose last output is fed back to its first input becomes a counter. In a ring counter Q₃ goes back to D₀ and the register starts as 1000: the single 1 travels round, 1000 → 0100 → 0010 → 0001 → 1000. With n flip-flops it has n states (mod-n) and only one output is 1 at a time, so it needs no decoder — but it uses only 4 of the 16 possible patterns.

جووڵاندن کە دوایین بگەڕێنرێتەوە بۆ یەکەم دەبێتە . لە ئەڵقەییدا Q₃ دەگەڕێتەوە بۆ D₀ و بە ⁦1000⁩ دەست پێ دەکات: تاکە 1ـەکە دەخولێتەوە، ⁦1000⁩ ← ⁦0100⁩ ← ⁦0010⁩ ← ⁦0001⁩ ← ⁦1000⁩. بە n n دۆخی هەیە ⁦(mod-n)⁩ و لە هەر کاتێکدا تەنها یەک 1ـە، بۆیە پێویستی بە نییە — بەڵام تەنها 4 نەخشە لە ⁦16⁩ نەخشە دەکرێیەکە بەکار دەهێنێت.

A Johnson counter (twisted ring) feeds back the complement Q3‾\overline{Q_3} instead. Starting from 0000 it fills with 1s and then empties: 8 states with 4 flip-flops (mod-2n), and only one bit changes per step, as in the Gray code.

Johnson (ئەڵقەی بادراو) لە جیاتی ئەوە ، Q3‾\overline{Q_3}، دەگەڕێنێتەوە. لە ⁦0000⁩ـەوە بە 1 پڕ دەبێت و پاشان بەتاڵ دەبێتەوە: 8 دۆخ بە 4 ⁦(mod-2n)⁩ و لە هەر هەنگاوێکدا تەنها یەک دەگۆڕێت، وەک .

4-bit ring and Johnson counters ئەڵقەیی و Johnsonـی چوار
StepهەنگاوRing: Q₀Q₁Q₂Q₃ئەڵقەیی: Q₀Q₁Q₂Q₃Johnson: Q₀Q₁Q₂Q₃
010000000
101001000
200101100
300011110
41000 (again)⁦1000⁩ (دووبارە)1111
50111
60011
70001
80000 (again)⁦0000⁩ (دووبارە)

The CMOS 4017 chip is a Johnson counter with a small decoder: ten outputs light one after another, a favourite for LED chasers.

⁦CMOS 4017⁩ Johnsonـە لەگەڵ بچووک: دە یەک لە دوای یەک ڕووناک دەبنەوە، کە بۆ ڕیزە ڕاکردوو بەناوبانگە.

Quick checkپشکنینی خێراHow many states does a Johnson counter with 5 flip-flops have? Johnson بە 5 چەند دۆخی هەیە؟

State tables and state diagramsخشتەکانی دۆخ و هێڵکارییەکانی دۆخ

A counter is a small machine with states. Its behaviour is written in a state table — present state, input, next state — or drawn as a state diagram, with one circle per state and one arrow per transition. A circuit like this, where flip-flops on one clock change only at its edges, is a synchronous sequential circuit. A circuit whose gates feed back with no clock (like the basic SR latch) is asynchronous: it reacts at any moment and can be unstable, so it is used only in small, careful places.

ئامێرێکی بچووکی خاوەن دۆخـە. ڕەفتارەکەی لە ـدا دەنووسرێت — دۆخی ئێستا، ، دۆخی داهاتوو — یان وەک دەکێشرێت، بە یەک بازنە بۆ هەر دۆخێک و یەک تیر بۆ هەر گۆڕانێک. وەها، کە لەسەر یەک تەنها لە لێوارەکانیدا دەگۆڕێن، و پێی دەوترێت هاوکات. بەڵام کە بێ بکەن (وەک SRـی سادە) ناهاوکاتـە: لە هەر ساتێکدا وەڵام دەداتەوە و دەتوانێت ناجێگیر بێت، بۆیە تەنها لە شوێنی بچووک و ورددا بەکار دێت.

Two state diagrams. Left: a 3-bit up counter drawn as a ring of eight circles 000, 001, 010, 011, 100, 101, 110, 111 with arrows going clockwise; the arrow from 111 back to 000 is highlighted; note: each pulse, one step clockwise. Right: a 2-bit up/down counter with four circles 00, 01, 10, 11 in a square; arrows labelled U=1 go clockwise (counting up) and arrows labelled U=0 go the other way (counting down).دوو هێڵکاریی دۆخ. چەپ: ژمێرەرێکی دیجیتاڵی سەرەوەی سێ بیتی کە وەک ئەڵقەیەک لە هەشت بازنە کێشراوە، 000، 001، 010، 011، 100، 101، 110، 111، بە تیر بە ئاڕاستەی کاتژمێر؛ تیری 111 بۆ 000 ڕەنگ کراوە؛ تێبینی: هەر تڕپەیەک، هەنگاوێک بە ئاڕاستەی کاتژمێر. ڕاست: ژمێرەرێکی دیجیتاڵی سەرەوە/خوارەوەی دوو بیتی بە چوار بازنە، 00، 01، 10، 11، لە چوارگۆشەیەکدا؛ ئەو تیرانەی ناوی U=1یان لەسەرە بە ئاڕاستەی کاتژمێر دەڕۆن (ژماردن بەرەو سەرەوە) و ئەوانەی U=0 بە ئاڕاستەی پێچەوانە (ژماردن بەرەو خوارەوە).
A state diagram shows every state and every move between states. هەموو دۆخێک و هەموو چوونێک لە نێوان دۆخەکاندا پیشان دەدات.CêIT
State table of the 2-bit up/down counter سەرەوە/خوارەوەی دوو
Present state Q₁Q₀دۆخی ئێستا Q₁Q₀Next state, U=0U = 0دۆخی داهاتوو، U=0U = 0Next state, U=1U = 1دۆخی داهاتوو، U=1U = 1
001101
010010
100111
111000
Quick checkپشکنینی خێراIn the up/down counter, the present state is 00 and U=0U = 0. What is the next state?لە سەرەوە/خوارەوەدا دۆخی ئێستا ⁦00⁩ـە و U=0U = 0. دۆخی داهاتوو چییە؟

State tables and state diagramsخشتەکانی دۆخ و هێڵکارییەکانی دۆخ

Moore and Mealy, and fewer statesMoore، Mealy و دۆخی کەمتر

Sequential circuits with outputs come in two models. In a Moore machine the outputs depend only on the present state, so they are written inside the circles (a lamp that is on in state 11). In a Mealy machine the outputs depend on the state and the present input, so they are written on the arrows as input/output, such as 1/0. Hardware designers often prefer Moore machines because their outputs change only with the clock.

، کاتێک هەبێت، دوو مۆدێلیان هەیە. لە ئامێری Mooreدا تەنها بەندن بە دۆخی ئێستا، بۆیە لەناو بازنەکاندا دەنووسرێن (چرایەک کە لە دۆخی ⁦11⁩دا هەڵکراوە). لە ئامێری Mealyدا بەندن بە دۆخ و ئێستا، بۆیە لەسەر تیرەکان وەک / دەنووسرێن، وەک ⁦1/0⁩. دیزاینەرەکانی زۆرجار ئامێری Moore بە باشتر دەزانن چونکە تەنها لەگەڵ دەگۆڕێن.

State reduction. If two states give the same outputs and go to the same next states for every input, they can never be told apart, so one of them can be removed. Fewer states can mean fewer flip-flops and fewer gates.

کەمکردنەوەی دۆخەکان. ئەگەر دوو دۆخ بۆ هەموو هەمان بدەن و بچن بۆ هەمان دۆخی داهاتوو، هەرگیز جیا ناکرێنەوە، بۆیە دەتوانرێت یەکێکیان لاببرێت. دۆخی کەمتر دەتوانێت واتای و کەمتر بێت.

Quick checkپشکنینی خێراIn a state diagram an arrow is labelled 1/0. Which model is this, and what does the label mean?لە تیرێک ناوی ⁦1/0⁩ـی لەسەرە. ئەمە کام مۆدێلە و ناوەکە چی دەگەیەنێت؟

Where counters and registers workژمێرەرە دیجیتاڵەکان و تۆمارگەکان لە کوێ کار دەکەن

  • The program counter. The CPU's program counter is a register that counts: after each instruction it moves on to the next address, and a jump loads a new value — a counter with parallel load, like the 74HC161. How the CPU knows what comes next shows it at work.
  • Clocks and timers. A digital clock divides a crystal frequency down to 1 Hz, then counts seconds (mod-60), minutes (mod-60) and hours (mod-24). Microcontrollers have counter–timers for delays and for measuring time.
  • Counting things. Turnstiles at a stadium, products on a factory belt, the floor number of a lift (an up/down counter).
  • Serial links. Shift registers turn words into bit streams and back in USB, network and display links.
  • . ژمێرەری بەرنامەـی کە دەژمێرێت: دوای هەر دەچێت بۆ ناونیشانی داهاتوو و بازدانێک (jump) بەهایەکی نوێی تێدا بار دەکات — بە بارکردنی تەریب، وەک ⁦74HC161⁩. CPU چۆن دەزانێت دواتر چی دێت لە کاتی کارکردندا پیشانی دەدات.
  • کاتژمێر و کاتپێوەکان. کاتژمێرێکی کریستاڵێک دابەش دەکات تا دەگاتە ⁦1 Hz⁩، پاشان چرکەکان ⁦(mod-60)⁩، خولەکەکان ⁦(mod-60)⁩ و کاتژمێرەکان ⁦(mod-24)⁩ دەژمێرێت. مایکرۆکۆنترۆڵەرەکان و کاتپێوی ناوەکییان هەیە بۆ دواخستن و پێوانی کات.
  • ژماردنی شتەکان. دەروازە سووڕاوەکانی یاریگا، بەرهەمەکان لەسەر شریتی کارگە، ژمارەی نهۆمی ئاسانسۆر ( سەرەوە/خوارەوە).
  • پەیوەندییە زنجیرییەکان. جووڵاندن دەکەن بە ڕیزی و بە پێچەوانەوە لە پەیوەندییەکانی ، ڕایەڵە و شاشەدا.
Quick checkپشکنینی خێراA program is running and the CPU reaches a jump instruction. What happens to the program counter? کار دەکات و دەگاتە بازدان. چی بەسەر دێت؟

Program counter designBen Eater · Englishئینگلیزی · 219K viewsبینین · 3.9K likesلایک

Designs the program counter of a simple 8-bit computer: a counter chip that steps through addresses, with enable and output controls.

دیزاینی سادەی 8 : کە یەک بە یەک بە ناو دەڕوات، لەگەڵ کۆنترۆڵی چالاککردن و .

Ben Eater: the program counter as a real counter chip.

⁦Ben Eater⁩: وەک ڕاستەقینەی .

From building blocks to a CPUلە بلۆکە بنیاتنەرەکانەوە بۆ CPU

You can now name every part of a simple processor. The ALU is adders plus logic gates, with multiplexers choosing its inputs; the registers are rows of flip-flops; the program counter is a counter; the instruction decoder is a decoder; and the control unit is a small sequential circuit that steps through fetch, decode and execute on every clock tick.

ئێستا دەتوانیت ناوی هەموو بەشێکی پرۆسێسەرێکی سادە بزانیت. ALU لە و پێک دێت، کە هەڵدەبژێرن؛ ڕیزی ؛ ؛ ؛ و کە بچووکە و لە هەر لێدانێکی بە fetch، decode و executeـدا هەنگاو دەنێت.

Block diagram of a simple CPU. The program counter (a counter) points into memory (decoders choose a word); the word goes into the instruction register (a register), then to the instruction decoder (a decoder) and the control unit (flip-flops and gates). The control unit sends control signals to the multiplexers, which choose the inputs of the ALU (adders and logic) from the registers (rows of flip-flops); the ALU result goes back to the registers. Caption: counters, registers and memory store bits; multiplexers, decoders and the ALU are combinational; one clock drives every flip-flop.هێڵکارییەکی بلۆکی CPUـێکی سادە. ژمێرەری بەرنامە (ژمێرەرێکی دیجیتاڵ) ئاماژە بۆ بیرگە دەکات (کۆدهەڵوەشێنەرەکان وشە هەڵدەبژێرن)؛ وشەکە دەچێتە ناو تۆمارگەی ڕێکارنامە (تۆمارگەیەک)، پاشان بۆ کۆدهەڵوەشێنەری ڕێکارنامە و یەکەی جڵەوکردن (فلیپ-فلۆپەکان و گەیتەکان). یەکەی جڵەوکردن سیگناڵەکانی کۆنترۆڵ دەنێرێت بۆ مەڵتیپلێکسەرەکان، کە نێوخستەکانی ALU (کۆکەرەوەکان و لۆجیک) لە تۆمارگەکان (ڕیزی فلیپ-فلۆپەکان) هەڵدەبژێرن؛ ئەنجامی ALU دەگەڕێتەوە بۆ تۆمارگەکان. ژێرنووس: ژمێرەرە دیجیتاڵەکان، تۆمارگەکان و بیرگە بیت هەڵدەگرن؛ مەڵتیپلێکسەرەکان، کۆدهەڵوەشێنەرەکان و ALU تێکەڵەیین؛ یەک سیگناڵی کاتژمێر هەموو فلیپ-فلۆپێک دەجووڵێنێت.
Every block of a CPU is something this course has built.هەموو بلۆکێکی شتێکە کە ئەم کۆرسە دروستی کردووە.CêIT

This is where Logic Design hands over to computer architecture. The Information Technology course continues with the CPU and its parts and how a computer runs a program, where you can watch these blocks fetch, decode and execute real instructions.

ئێرە ئەو شوێنەیە کە دیزاینی دەستاودەست بە تەلارسازیی دەدات. کۆرسی بەردەوام دەبێت بە CPU و بەشەکانی و کۆمپیوتەر چۆن بەرنامەیەک جێبەجێ دەکات، کە تێیدا دەتوانیت سەیری ئەم بلۆکانە بکەیت کە ڕاستەقینە fetch، decode و execute دەکەن.

Quick checkپشکنینی خێراWhich block of a CPU is a counter with parallel load?کام بلۆکی بە بارکردنی تەریب؟

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

  • One flip-flop per state. A counter needs one flip-flop per bit: mod-60 needs 6 flip-flops (26=642^6 = 64), not 60.
  • Forgetting J=K=1J = K = 1 in a ripple counter. With J or K at 0 the flip-flops do not toggle and the counter stops.
  • The wrong edge. Rising-edge flip-flops clocked from Q make a ripple counter count down.
  • Reading a ripple counter too early. Right after an edge it may show wrong values for a few nanoseconds.
  • Mixing up the shift direction. Shifting toward the least significant bit (right) halves the number; toward the most significant bit (left) doubles it.
  • Starting a ring counter at 0000. A ring counter needs exactly one 1 to circulate; it must be preset to 1000.
  • بۆ هەر دۆخێک یەک . بۆ هەر یەک پێویستە: ⁦mod-60⁩ پێویستی بە 6 (26=642^6 = 64)، نەک ⁦60⁩.
  • لەبیرکردنی J=K=1J = K = 1 لە ناهاوکاتدا. ئەگەر J یان ⁦K 0⁩ بێت هەڵناگەڕێنەوە و دەوەستێت.
  • لێواری هەڵە. کە لە Qـەوە لێیان بدرێت، ناهاوکات بەرەو خوارەوە دەژمێرن.
  • خوێندنەوەی ناهاوکات زۆر زوو. ڕێک دوای لێوارێک لەوانەیە بۆ چەند نانۆچرکەیەک بەهای هەڵە پیشان بدات.
  • تێکەڵکردنی ئاڕاستەی جووڵاندن. جووڵاندن بەرەو (ڕاست) ژمارەکە دەکاتە نیوە؛ بەرەو (چەپ) دوو هێندەی دەکات.
  • دەستپێکردنی ئەڵقەیی بە ⁦0000⁩. ئەڵقەیی پێویستی بە ڕێک یەک 1ـە بۆ خولانەوە؛ دەبێت بە ⁦1000⁩ ئامادە بکرێت ⁦(preset)⁩.

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

Original exercises in the style of the course's sequential-circuit exercises: shift-register contents, counter design and circuit analysis.

ڕاهێنانی تازە لەسەر شێوەی ڕاهێنانەکانی کۆرسەکە: ناوەڕۆکی جووڵاندن، دیزاینی و شیکردنەوەی .

ExerciseڕاهێنانRotating a registerسووڕاندنی تۆمارگەیەک

A 6-bit shift register with rotation holds 101100. It rotates right three times (the bit leaving on the right enters on the left). Write its contents after each rotation.

جووڵاندنی شەش بە سووڕاندن ⁦101100⁩ هەڵدەگرێت. سێ جار بەرەو ڕاست دەسووڕێتەوە (ئەو لە لای ڕاستەوە دەردەچێت لە لای چەپەوە دێتە ژوورەوە). ناوەڕۆکەکەی دوای هەر سووڕانەوەیەک بنووسە.

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

010110, 001011, 100101. Nothing is lost: three more rotations give 101100 back after six in total.

⁦010110⁩، ⁦001011⁩، ⁦100101⁩. هیچ شتێک ون نابێت: سێ سووڕانەوەی تر دوای شەش سووڕانەوە ⁦101100⁩ دەگەڕێننەوە.

ExerciseڕاهێنانShifting right is dividingجووڵاندن بۆ ڕاست دابەشکردنە

A 6-bit register holds 110101 (53). It shifts right three times, with 0 entering on the left. Write each result and its decimal value.

شەش ⁦110101 (53)⁩ هەڵدەگرێت. سێ جار بەرەو ڕاست دەجووڵێت و 0 لە لای چەپەوە دێتە ژوورەوە. هەر ئەنجامێک و بەها بنووسە.

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

0110102=26011010_2 = 26, 0011012=13001101_2 = 13, 0001102=6000110_2 = 6. Each shift divides by 2 and drops the remainder (53 → 26 r 1 → 13 r 0 → 6 r 1).

0110102=26011010_2 = 26، 0011012=13001101_2 = 13، 0001102=6000110_2 = 6. هەر جووڵاندنێک بەسەر 2دا دابەش دەکات و پاشماوەکە فڕێ دەدات (⁦53⁩ ← ⁦26⁩، پاشماوە 1؛ ⁦26⁩ ← ⁦13⁩، پاشماوە 0؛ ⁦13⁩ ← 6، پاشماوە ⁦1⁩).

ExerciseڕاهێنانDesign a mod-6 counterدیزاینکردنی ژمێرەرێکی دیجیتاڵی ⁦mod-6⁩

Design a synchronous counter with JK flip-flops that counts 000, 001, 010, 011, 100, 101 and back to 000. Use the unused states 110 and 111 as don't-cares. Then check where the counter goes if it ever wakes up in 110 or 111.

هاوکات بە JK دیزاین بکە کە ⁦000⁩، ⁦001⁩، ⁦010⁩، ⁦011⁩، ⁦100⁩، ⁦101⁩ دەژمێرێت و دەگەڕێتەوە بۆ ⁦000⁩. دۆخە بەکارنەهاتووەکانی ⁦110⁩ و ⁦111⁩ وەک بەکار بهێنە. پاشان بپشکنە ئەگەر هەرگیز لە ⁦110⁩ یان ⁦111⁩دا هەڵبستێت، بۆ کوێ دەچێت.

Hintئاماژە

Fill the excitation columns row by row, then group the 1s with the Xs.

ستوونەکانی ورووژاندن ڕیز بە ڕیز پڕ بکەرەوە، پاشان 1ـەکان لەگەڵ Xـەکان گرووپ بکە.

Show answerوەڵامەکە پیشان بدە
Q₂Q₁Q₀nextداهاتووJ₂ K₂J₁ K₁J₀ K₀
0 0 00 0 10 X0 X1 X
0 0 10 1 00 X1 XX 1
0 1 00 1 10 XX 01 X
0 1 11 0 01 XX 1X 1
1 0 01 0 1X 00 X1 X
1 0 10 0 0X 10 XX 1
J0=K0=1J1=Q2‾ Q0,  K1=Q0J2=Q1Q0,  K2=Q0J_0 = K_0 = 1 \qquad J_1 = \overline{Q_2}\,Q_0,\; K_1 = Q_0 \qquad J_2 = Q_1Q_0,\; K_2 = Q_0

With 110 and 111 as don't-cares on the K-maps. Check: 110 → 111 → 000 and 111 → 000, so the counter always returns to its loop (it is self-starting).

بە ⁦110⁩ و ⁦111⁩ وەک لەسەر . پشکنین: ⁦110⁩ ← ⁦111⁩ ← ⁦000⁩ و ⁦111⁩ ← ⁦000⁩، بۆیە هەمیشە دەگەڕێتەوە بۆ ئەڵقەکەی خۆی (خۆی دەست پێ دەکاتەوە).

ExerciseڕاهێنانA frequency dividerدابەشکەرێکی لەرەلەر

A 1 MHz clock drives a 4-bit ripple counter. What frequency appears at each output Q₀ to Q₃?

⁦1 MHz⁩ ناهاوکاتی چوار دەجووڵێنێت. لە هەر Q₀ تا Q₃ چ دەردەکەوێت؟

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

Each stage halves the frequency: Q0Q_0 500 kHz, Q1Q_1 250 kHz, Q2Q_2 125 kHz and Q3Q_3 62.5 kHz, which is 1 MHz divided by 24=162^4 = 16.

هەر قۆناغێک دەکاتە نیوە: Q0Q_0 ⁦500 kHz⁩، Q1Q_1 ⁦250 kHz⁩، Q2Q_2 ⁦125 kHz⁩ و Q3Q_3 ⁦62.5 kHz⁩، کە ⁦1 MHz⁩ـە دابەشکراو بەسەر 24=162^4 = 16دا.

ExerciseڕاهێنانHow many flip-flops?چەند فلیپ-فلۆپ؟

How many flip-flops do binary counters with these moduli need, and how many patterns stay unused: mod-12, mod-24, mod-60?

بەم مۆدیولانە چەند پێویستە و چەند نەخشە بەکار نایەن: ⁦mod-12⁩، ⁦mod-24⁩، ⁦mod-60⁩؟

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

mod-12: 4 flip-flops, 4 unused. mod-24: 5 flip-flops (25=322^5 = 32), 8 unused. mod-60: 6 flip-flops (26=642^6 = 64), 4 unused.

⁦mod-12: 4⁩ ، 4 بەکارنەهاتوو. ⁦mod-24: 5⁩ (25=322^5 = 32)، 8 بەکارنەهاتوو. ⁦mod-60: 6⁩ (26=642^6 = 64)، 4 بەکارنەهاتوو.

ExerciseڕاهێنانAnalyse a circuit (1)شیکردنەوەی سووڕێک ⁦(1)⁩

Two D flip-flops share a clock, with D1=Q1⊕Q0D_1 = Q_1 \oplus Q_0 and D0=Q0‾D_0 = \overline{Q_0}. Write the state table starting from 00. What does the circuit do?

دوو D یەک بەکار دەهێنن، بە D1=Q1⊕Q0D_1 = Q_1 \oplus Q_0 و D0=Q0‾D_0 = \overline{Q_0}. لە ⁦00⁩ـەوە بنووسە. چی دەکات؟

Show answerوەڵامەکە پیشان بدە
Q₁Q₀Next state D1D0D_1D_0دۆخی داهاتوو D1D0D_1D_0
0001
0110
1011
1100

It is a 2-bit synchronous up counter (mod-4): 00 → 01 → 10 → 11 → 00. For a D flip-flop the next state is simply D.

ئەمە هاوکاتی سەرەوەی دوو ⁦(mod-4): 00⁩ ← ⁦01⁩ ← ⁦10⁩ ← ⁦11⁩ ← ⁦00⁩. بۆ D دۆخی داهاتوو تەنها Dـیە.

ExerciseڕاهێنانAnalyse a circuit (2)شیکردنەوەی سووڕێک ⁦(2)⁩

Now D1=Q0D_1 = Q_0 and D0=Q1‾D_0 = \overline{Q_1}. Write the state table from 00. Which code does this counter produce?

ئێستا D1=Q0D_1 = Q_0 و D0=Q1‾D_0 = \overline{Q_1}. لە ⁦00⁩ـەوە بنووسە. ئەم کام کۆد دروست دەکات؟

Show answerوەڵامەکە پیشان بدە
Q₁Q₀nextداهاتوو
0001
0111
1110
1000

00 → 01 → 11 → 10 → 00: only one bit changes at each step — the 2-bit Gray code. It is also a 2-bit Johnson counter.

⁦00⁩ ← ⁦01⁩ ← ⁦11⁩ ← ⁦10⁩ ← ⁦00⁩: لە هەر هەنگاوێکدا تەنها یەک دەگۆڕێت — کۆدی گرەیی دوو . هەروەها Johnsonـی دوو .

ExerciseڕاهێنانA 3-bit Johnson counterژمێرەرێکی دیجیتاڵی Johnsonـی سێ بیتی

Write the sequence of a 3-bit Johnson counter starting from 000 (Q₀Q₁Q₂, with Q2‾\overline{Q_2} fed back to D₀). What is its modulus?

زنجیرەی Johnsonـی سێ بنووسە کە لە ⁦000⁩ـەوە دەست پێ دەکات (Q₀Q₁Q₂، بە گەڕاندنەوەی Q2‾\overline{Q_2} بۆ D₀). مۆدیولەکەی چەندە؟

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

000, 100, 110, 111, 011, 001, then 000 again: 6 states, so mod-6 (2n2n with n=3n = 3).

⁦000⁩، ⁦100⁩، ⁦110⁩، ⁦111⁩، ⁦011⁩، ⁦001⁩، پاشان دیسان ⁦000: 6⁩ دۆخ، بۆیە ⁦mod-6⁩ (2n2n، کە n=3n = 3).

ExerciseڕاهێنانRemove equivalent statesلابردنی دۆخە هاوتاکان

A sequential circuit with input x and output Z has the state table below. Find the equivalent states and reduce the table. How many flip-flops does the reduced circuit need?

بە x و Z ئەم خوارەوەی هەیە. دۆخە هاوتاکان بدۆزەرەوە و خشتەکە کورت بکەرەوە. پاش کورتکردنەوە، پێویستی بە چەند هەیە؟

Present stateدۆخی ئێستاNext, x=0x = 0داهاتوو، x=0x = 0Next, x=1x = 1داهاتوو، x=1x = 1Z, x=0x = 0Z، x=0x = 0Z, x=1x = 1Z، x=1x = 1
ABC01
BDE10
CBE00
DDA10
EBC01
Hintئاماژە

Two states are equivalent when their rows are identical: same next states and same outputs for every input. After you merge one pair, look again.

دوو دۆخ هاوتان کاتێک ڕیزەکانیان وەک یەکن: بۆ هەموو هەمان دۆخی داهاتوو و هەمان . دوای یەکخستنی جووتێک، دیسان سەیر بکە.

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

Rows A and E are identical, so E is the same as A: delete row E and write A wherever E appeared. Now row B is D, A, 1, 0 — exactly row D — so B and D are equivalent too: delete D and write B for it. Three states remain:

ڕیزەکانی A و E وەک یەکن، بۆیە E هەمان Aـیە: ڕیزی E بسڕەوە و لە هەر شوێنێکدا E هەبوو A بنووسە. ئێستا ڕیزی B دەبێتە D، A، 1، 0 — ڕێک وەک ڕیزی D — بۆیە B و Dـیش هاوتان: D بسڕەوە و لە جیاتی B بنووسە. سێ دۆخ دەمێننەوە:

Present stateدۆخی ئێستاNext, x=0x = 0داهاتوو، x=0x = 0Next, x=1x = 1داهاتوو، x=1x = 1Z, x=0x = 0Z، x=0x = 0Z, x=1x = 1Z، x=1x = 1
ABC01
BBA10
CBA00

Five states needed 3 flip-flops; three states need only 2 (22=4≥32^2 = 4 \ge 3). B and C go to the same next states but give different outputs, so they stay apart. Checked by state partitioning in SP/ld/run/RLDDW2/check_seq.py.

پێنج دۆخ پێویستیان بە 3 بوو؛ سێ دۆخ تەنها 2یان پێویستە (22=4≥32^2 = 4 \ge 3). B و C دەچن بۆ هەمان دۆخی داهاتوو بەڵام جیاواز دەدەن، بۆیە جیا دەمێننەوە.

ExerciseڕاهێنانA circuit that spots 101سووڕێک کە ⁦101⁩ دەدۆزێتەوە

Two D flip-flops share a clock. The circuit has one input x and one output Z: D1=Q0D_1 = Q_0, D0=xD_0 = x and Z=x Q1 Q0‾Z = x\,Q_1\,\overline{Q_0}. (a) Write the state table with the next state and Z for x=0x = 0 and x=1x = 1. (b) Is it a Moore or a Mealy machine? (c) Starting in 00, the inputs 1, 0, 1, 0, 1 arrive one per clock. What is Z at each step?

دوو D یەک بەکار دەهێنن. یەک x و یەک Zـی هەیە: D1=Q0D_1 = Q_0، D0=xD_0 = x و Z=x Q1 Q0‾Z = x\,Q_1\,\overline{Q_0}. (أ) بنووسە بە دۆخی داهاتوو و Z بۆ x=0x = 0 و x=1x = 1. (ب) ئامێرێکی Mooreـە یان Mealy؟ (ج) بە دەستپێکردن لە ⁦00⁩، 1، 0، 1، 0، 1 لە هەر لێدانێکی یەکێک دێن. Z لە هەر هەنگاوێکدا چەندە؟

Show answerوەڵامەکە پیشان بدە
Q₁Q₀Next, x=0x = 0داهاتوو، x=0x = 0Next, x=1x = 1داهاتوو، x=1x = 1Z, x=0x = 0Z، x=0x = 0Z, x=1x = 1Z، x=1x = 1
00000100
01101100
10000101
11101100

(b) Z depends on the input x as well as on the state, so it is a Mealy machine: on its state diagram Z is written on the arrows, for example 1/1 on the arrow from 10 to 01. (c) Z=0,0,1,0,1Z = 0, 0, 1, 0, 1. The flip-flops remember the last two inputs (Q1Q_1 the older one, Q0Q_0 the newer one), and Z is 1 exactly when they were 1, 0 and the new input is 1 — the circuit detects the pattern 101, even when two patterns overlap.

(ب) Z بەندە بە x و بە دۆخ، بۆیە ئامێرێکی Mealyـیە: لەسەر Z لەسەر تیرەکان دەنووسرێت، بۆ نموونە ⁦1/1⁩ لەسەر تیری ⁦10⁩ بۆ ⁦01⁩. (ج) Z بەم شێوەیە: 0، 0، 1، 0، 1. دوو کۆتایی لەبیر دەگرن (Q1Q_1 کۆنترەکە، Q0Q_0 نوێترەکە) و Z ڕێک کاتێک 1ـە کە ئەوان 1، 0 بوون و نوێیەکە 1ـە — نەخشەی ⁦101⁩ دەدۆزێتەوە، تەنانەت کاتێک دوو نەخشە بەسەر یەکدا دەکەون.

Summaryپوختە

  • A register is n flip-flops on one clock; a LOAD input (a multiplexer per bit) decides whether the edge stores new data.
  • A shift register chains Q to D: SISO, SIPO, PISO, PIPO, bidirectional. Shifting left doubles, right halves; serial links depend on it.
  • A ripple counter (J=K=1J = K = 1, each Q clocks the next) is simple but slow and shows short wrong values.
  • A synchronous counter clocks every flip-flop together: J0=K0=1J_0 = K_0 = 1, J1=K1=Q0J_1 = K_1 = Q_0, J2=K2=Q1Q0J_2 = K_2 = Q_1Q_0, designed with the excitation table.
  • mod-n counters stop early (decade = mod-10); ring (mod-n) and Johnson (mod-2n) counters are circulating shift registers.
  • State tables and state diagrams describe sequential circuits; Moore outputs depend on the state, Mealy outputs also on the input.
  • The program counter, registers, decoders, multiplexers and the ALU together make a CPU.
  • n لەسەر یەک ؛ LOAD (بۆ هەر ) بڕیار دەدات ئایا لێوارەکە نوێ هەڵدەگرێت.
  • جووڵاندن Q بە Dـەوە زنجیر دەکات: SISO، SIPO، PISO، PIPO، دوو-ئاڕاستە. جووڵاندن بۆ چەپ دوو هێندە دەکات و بۆ ڕاست نیوە؛ پەیوەندییە زنجیرییەکان پشتی پێ دەبەستن.
  • ناهاوکات (J=K=1J = K = 1، هەر Qـێک دواتر لێدەدات) سادەیە بەڵام هێواشە و بەهای هەڵەی کورت پیشان دەدات.
  • هاوکات هەموو پێکەوە لێدەدات: J0=K0=1J_0 = K_0 = 1، J1=K1=Q0J_1 = K_1 = Q_0، J2=K2=Q1Q0J_2 = K_2 = Q_1Q_0، کە بە دیزاین دەکرێت.
  • ⁦mod-n⁩ زوو دەگەڕێنەوە (دەیی = ⁦mod-10⁩)؛ ئەڵقەیی ⁦(mod-n)⁩ و Johnson ⁦(mod-2n)⁩ جووڵاندنی خولاوەن.
  • و وەسف دەکەن؛ Moore بەندن بە دۆخ و Mealy بە .
  • ، ، ، و ALU پێکەوە پێک دەهێنن.

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

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

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

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

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