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

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

How a circuit remembers: feedback, the SR latch (NOR and NAND), the gated D latch, level and edge triggering, the edge-triggered D flip-flop (master–slave), JK and T flip-flops, characteristic tables and equations, preset and clear, and timing diagrams read edge by edge.

چۆن لەبیری دەمێنێت: ، ⁦SR (NOR⁩ و NAND)، Dـی دەرگادار، چالاکبوون بە ئاست و بە لێوار، Dـی لێوار-چالاک (سەرەکی و پاشکۆ)، JK و T، و ، preset و clear و خوێندنەوەی لێوار بە لێوار.

26 min read28 خولەک خوێندنەوە · 21 stepsهەنگاو

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

  • Explain how feedback turns gates into a one-bit memory, and trace the SR latch (NOR and NAND).
  • Tell a level-triggered latch from an edge-triggered flip-flop in a timing diagram.
  • Use the characteristic tables and equations of SR, D, JK and T flip-flops.
  • Explain preset and clear, and complete timing diagrams edge by edge.
  • ڕوون بکەیتەوە چۆن دەکات بە یەک و ⁦SR (NOR⁩ و NAND) هەنگاو بە هەنگاو بپشکنیت.
  • لە ئاست-چالاک لە لێوار-چالاک جیا بکەیتەوە.
  • و SR، D، JK و T بەکار بهێنیت.
  • preset و clear ڕوون بکەیتەوە و لێوار بە لێوار تەواو بکەیت.

Circuits that rememberسووڕەکانی خاوەن بیرگە

Every circuit in the course so far — gates, adders, multiplexers, decoders — is combinational: its output depends only on the inputs at this moment. Change the inputs back and the output forgets everything. A computer also needs circuits that remember: the number you just typed, the next instruction, a running count. Their output depends on the present inputs and on what happened before. These are sequential circuits (What comes next introduced the idea).

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

Combinational and sequential circuits و
CombinationalتێکەڵەییSequentialزنجیرەیی
Output depends on بەندە بەthe present inputs onlyتەنها ئێستاthe present inputs and the stored state ئێستا و دۆخی هەڵگیراو
Memorynoneنییەlatches and flip-flops و
Examplesنموونەadder, multiplexer, decoder، ، register, counter, the CPU، ،
Quick checkپشکنینی خێراWhich of these needs a sequential circuit?کام لەمانە پێویستی بە ؟

Circuits that rememberسووڕەکانی خاوەن بیرگە

What a one-bit memory needsبیرگەی یەک بیت پێویستی بە چییە

The lift call buttonدوگمەی بانگکردنی ئاسانسۆر

Press the call button of a lift and take your finger away: the button stays lit until the lift arrives. The light depends not on what your finger is doing now, but on something that happened earlier. A doorbell button is the opposite: it rings only while you press — a combinational circuit.

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

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

The lift button is a whole small system; inside it, a one-bit memory like the latches of this lesson keeps the light on.

دوگمەی ئاسانسۆر سیستەمێکی بچووکی تەواوە؛ لەناویدا یەک وەک ئەم وانەیە چراکە بە هەڵکراوی دەهێڵێتەوە.

A device that stores a bit needs three things: two stable states (one for 0, one for 1), a way to read the state, and a way to set it. The circuits of this lesson build all three from ordinary gates.

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

Quick checkپشکنینی خێراWhich of these is not one of the three things a one-bit memory needs?کام لەمانە یەکێک نییە لەو سێ شتەی یەک پێویستی پێیەتی؟

Circuits that rememberسووڕەکانی خاوەن بیرگە

Feedback: a loop in the circuitفیدباک: بازنەیەک لەناو سووڕدا

Definitionپێناسە

Connecting a circuit's output back to one of its own inputs. Feedback gives a circuit memory (a keeps its state) or, with an odd number of inverters in the loop, makes it oscillate.

بەستنەوەی سووڕێک بە یەکێک لە خودی خۆی. فیدباک دەدات بە سووڕەکە ( دۆخەکەی دەپارێزێت)، یان ئەگەر ژمارەیەکی تاک لە بازنەکەدا بێت، وای لێ دەکات بلەرێتەوە.

Every circuit so far sends signals one way, from inputs to outputs. To remember, a circuit needs feedback: an output wired back to an input. The simplest case is two NOT gates in a loop. If the first outputs 0, the second outputs 1, which keeps the first at 0 — the loop holds itself in that state forever. The opposite state (1 and 0) is just as stable. A circuit with two stable states is called bistable, and that is exactly one bit of memory.

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

Two panels. Left: two NOT gates in a loop; the output of the top inverter (Q-bar = 0) feeds the bottom inverter, whose output (Q = 1) is wired back to the top inverter's input. Caption: two stable states, but no way to change them. Right: an SR latch made of two NOR gates. R enters the top gate, which outputs Q; S enters the bottom gate, which outputs Q-bar. Highlighted feedback wires cross between the gates: Q goes back to an input of the bottom gate and Q-bar to an input of the top gate.دوو بەش. چەپ: دوو گەیتی NOT لە بازنەیەکدا؛ دەرخستەی گەیتەکەی NOT سەرەوە (Q̄ = 0) دەچێتە ناو گەیتەکەی NOT خوارەوە و دەرخستەی ئەو (Q = 1) دەگەڕێتەوە بۆ نێوخستەی گەیتەکەی NOT سەرەوە. ژێرنووس: دوو دۆخی جێگیر، بەڵام ڕێگایەک نییە بۆ گۆڕینیان. ڕاست: لاچێکی SR لە دوو گەیتی NOR. R دەچێتە ناو گەیتی سەرەوە کە Q دەدات؛ S دەچێتە ناو گەیتی خوارەوە کە Q̄ دەدات. وایەرە ڕەنگکراوەکانی فیدباک لە نێوان گەیتەکان یەکتر دەبڕن: Q دەگەڕێتەوە بۆ نێوخستەیەکی گەیتی خوارەوە و Q̄ بۆ نێوخستەیەکی گەیتی سەرەوە.
A loop of two inverters remembers but cannot be changed. NOR gates add the free inputs S and R.بازنەیەکی دوو لەبیری دەمێنێت بەڵام ناگۆڕدرێت. ئازادی S و R زیاد دەکەن.CêIT

Feedback can also do the opposite. Put an odd number of NOT gates in a ring — three, say — and no state is stable: each gate keeps flipping the next one, so the output oscillates. Such a ring oscillator is a simple clock source; its speed depends on the gate delays.

دەتوانێت پێچەوانەکەش بکات. ژمارەیەکی تاک — بۆ نموونە سێ — لە ئەڵقەیەکدا دابنێ و هیچ دۆخێک جێگیر نابێت: هەر بەردەوام دواترین هەڵدەگەڕێنێتەوە، بۆیە دەلەرێتەوە. ئەم لەرەرە ئەڵقەییە (ring oscillator) سەرچاوەیەکی سادەی ؛ خێراییەکەی بەندە بە دواکەوتنی .

Quick checkپشکنینی خێراThree NOT gates are connected in a ring (the output of the third feeds the first). What happens?سێ لە ئەڵقەیەکدا بەستراون ( سێیەم دەچێتە ناو یەکەم). چی ڕوو دەدات؟

The SR latch: set, reset, holdلاچی SR: دانان، سفرکردنەوە، ڕاگرتن

Definitionپێناسە

A simple memory circuit that stores one bit and keeps it until its inputs change it. A latch is built from gates connected in a loop (feedback).

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

Replace the two NOT gates of the loop by two NOR gates. Each gate keeps one input for the feedback and gets one free input: S (set) and R (reset). The outputs are Q and its complement Q‾\overline{Q}. With S=R=0S = R = 0 a NOR gate acts like a NOT gate, so the loop simply holds its state. Watch what a short 1 on S, and later on R, does:

لە جیاتی دوو بازنەکە، دوو دابنێ. هەر یەک بۆ دەهێڵێتەوە و یەک ئازاد وەردەگرێت: S (set، دانان) و R (reset، سفرکردنەوە). Q و ، Q‾\overline{Q}ـن. کاتێک S=R=0S = R = 0 بێت، وەک کار دەکات، بۆیە بازنەکە تەنها دۆخەکەی خۆی ڕادەگرێت. سەیر بکە 1ـێکی کورت لەسەر S و دواتر لەسەر R چی دەکات:

Animation in five frames of an SR latch made of two NOR gates, with the value of every wire. Frame 1: S = 0, R = 0, Q = 0 (hold). Frame 2: S = 1 forces the lower output Q-bar to 0, then Q becomes 1 (set). Frame 3: S goes back to 0 but Q stays 1 — the latch remembers. Frame 4: R = 1 forces Q to 0 and Q-bar to 1 (reset). Frame 5: R goes back to 0 and Q stays 0. A strip at the bottom collects the values of Q so far: 0, 1, 1, 0, 0.
Animation in five frames of an SR latch made of two NOR gates, with the value of every wire. Frame 1: S = 0, R = 0, Q = 0 (hold). Frame 2: S = 1 forces the lower output Q-bar to 0, then Q becomes 1 (set). Frame 3: S goes back to 0 but Q stays 1 — the latch remembers. Frame 4: R = 1 forces Q to 0 and Q-bar to 1 (reset). Frame 5: R goes back to 0 and Q stays 0. A strip at the bottom collects the values of Q so far: 0, 1, 1, 0, 0.
After S returns to 0, Q stays 1: the feedback keeps it there. That is one bit of memory.دوای ئەوەی S دەگەڕێتەوە بۆ 0، Q هەر 1 دەمێنێت: لەوێدا ڕایدەگرێت. ئەمە یەک .CêIT
The SR latch (NOR gates) SR ()
S RQ (next)Q (داهاتوو)Actionکار
0 0Qhold: keep the stored bitڕاگرتن: هەڵگیراوەکە دەپارێزێت
0 10resetسفرکردنەوە
1 01setدانان
1 1–not allowedڕێگەپێنەدراو

Why does it work? A NOR gate outputs 0 as soon as any input is 1. So S=1S = 1 forces Q‾\overline{Q} to 0; the top gate then sees R=0R = 0 and Q‾=0\overline{Q} = 0 and outputs Q=1Q = 1. When S drops back to 0, the bottom gate still sees Q=1Q = 1 on its other input, so Q‾\overline{Q} stays 0 and Q stays 1.

بۆچی کار دەکات؟ هەر کە هەر 1 بێت 0 دەدات. بۆیە S=1S = 1 Q‾\overline{Q} دەکاتە 0؛ پاشان سەرەوە R=0R = 0 و Q‾=0\overline{Q} = 0 دەبینێت و Q=1Q = 1 دەدات. کاتێک S دەگەڕێتەوە بۆ 0، خوارەوە هێشتا Q=1Q = 1 لەسەر تری دەبینێت، بۆیە Q‾\overline{Q} هەر 0 و Q هەر 1 دەمێنێت.

Quick checkپشکنینی خێراAn SR latch (NOR) holds Q=1Q = 1. Then R becomes 1 for a moment and returns to 0. What is Q now? ⁦SR (NOR)⁩ Q=1Q = 1 ڕادەگرێت. پاشان R بۆ ساتێک دەبێتە 1 و دەگەڕێتەوە بۆ 0. ئێستا Q چەندە؟

SR latchBen Eater · Englishئینگلیزی · 2.2M viewsبینین · 42K likesلایک

Builds a latch from NOR gates on a breadboard and shows how feedback lets it set, reset and remember one bit.

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

Ben Eater: the SR latch built and tested on a breadboard (9:30 the SR latch).

⁦Ben Eater⁩: SR لەسەر دروست دەکرێت و تاقی دەکرێتەوە (⁦9:30⁩ SR).

The SR latch: set, reset, holdلاچی SR: دانان، سفرکردنەوە، ڕاگرتن

S=1S = 1 and R=1R = 1: the forbidden inputS=1S = 1 و R=1R = 1: نێوخستە قەدەغەکراوەکە

What if S and R are both 1? Each NOR gate has a 1 on an input, so both outputs become 0. Now Q and Q‾\overline{Q} are equal, which breaks the rule that Q‾\overline{Q} is the complement of Q. Worse, when S and R return to 0 at the same moment, both gates try to switch to 1 together: the latch may end up in either state, or even oscillate for a while. This is a race, and nobody can say the result in advance.

ئەگەر S و R هەردووکیان 1 بن چی دەبێت؟ هەر 1ـێکی لەسەر هەیە، بۆیە هەردوو دەبنە 0. ئێستا Q و Q‾\overline{Q} یەکسانن کە ئەو یاسایە دەشکێنێت کە Q‾\overline{Q} Qـیە. خراپتر ئەوەیە کاتێک S و R لە هەمان ساتدا دەگەڕێنەوە بۆ 0، هەردوو پێکەوە هەوڵ دەدەن ببنە 1: لەوانەیە بگاتە هەر یەکێک لە دوو دۆخەکە، یان تەنانەت ماوەیەک بلەرێتەوە. ئەمە پێشبڕکێیە (race) و کەس ناتوانێت پێشوەختە ئەنجامەکە بڵێت.

So the rule for the SR latch is: never make S and R 1 together, written SR=0SR = 0. Under that rule its behaviour is described by one equation, where Q+Q^+ is the next value of Q:

بۆیە یاسای SR ئەمەیە: هەرگیز S و R پێکەوە مەکە بە 1، کە دەنووسرێت SR=0SR = 0. بەپێی ئەو یاسایە ڕەفتارەکەی بە یەک وەسف دەکرێت، کە Q+Q^+ بەهای داهاتووی Qـیە:

Q+=S+R‾ Q(SR=0)Q^+ = S + \overline{R}\,Q \qquad (SR = 0)

Read it as: the next Q is 1 if S sets it, or if it was already 1 and R does not reset it.

بیخوێنەوە: Qـی داهاتوو 1ـە ئەگەر S دایبنێت، یان ئەگەر پێشتر 1 بووبێت و R سفری نەکاتەوە.

Quick checkپشکنینی خێراIn a NOR latch, S=1S = 1 and R=1R = 1. What are Q and Q‾\overline{Q}?لە NORـدا S=1S = 1 و R=1R = 1ـە. Q و Q‾\overline{Q} چین؟

The SR latch: set, reset, holdلاچی SR: دانان، سفرکردنەوە، ڕاگرتن

The NAND latch: active-low inputsلاچی NAND: نێوخستەکانی چالاک بە LOW

The same latch can be built from two cross-coupled NAND gates. A NAND gate is forced by a 0 on an input, so here the inputs are active-low: they rest at 1, and a short 0 on S‾\overline{S} sets the latch, a short 0 on R‾\overline{R} resets it. The bars in the names remind you of this.

هەمان دەتوانرێت لە دوو بەیەکەوەبەستراو دروست بکرێت. بە 0ـێک لەسەر ناچار دەکرێت، بۆیە لێرەدا چالاکن بە LOW: لە دۆخی ئاساییدا 1ـن و 0ـێکی کورت لەسەر S‾\overline{S} دادەنێت، 0ـێکی کورت لەسەر R‾\overline{R} سفری دەکاتەوە. هێڵی سەر ناوەکان ئەمەت بیر دەخاتەوە.

The NAND latch NAND
S̄ R̄Q (next)Q (داهاتوو)Actionکار
1 1Qholdڕاگرتن
0 11setدانان
1 00resetسفرکردنەوە
0 0–not allowed (both outputs 1)ڕێگەپێنەدراو (هەردوو 1ـن)

A real use: a mechanical switch bounces — its contacts hit and spring apart several times in a few milliseconds, so a counter would see many presses. Wire a changeover switch to the S‾\overline{S} and R‾\overline{R} inputs of a NAND latch: the first touch sets or resets the latch, and the bounces cannot change it back. The 74HC279 chip holds four such latches.

بەکارهێنانێکی ڕاستەقینە: میکانیکی دەلەرێتەوە (bounce) — خاڵەکانی لە چەند میلی چرکەیەکدا چەند جار بەر یەک دەکەون و جیا دەبنەوە، بۆیە چەندین داگرتن دەبینێت. دوو-ڕێ بە S‾\overline{S} و R‾\overline{R}ـی NAND ببەستە: یەکەم بەرکەوتن دادەنێت یان سفری دەکاتەوە و لەرینەوەکان ناتوانن بیگەڕێننەوە. ⁦74HC279⁩ چوار وەهای تێدایە.

Quick checkپشکنینی خێراA NAND latch rests with S‾=1\overline{S} = 1, R‾=1\overline{R} = 1 and Q=0Q = 0. Then S‾\overline{S} goes to 0 for a moment and back to 1. What is Q now? NAND بە S‾=1\overline{S} = 1، R‾=1\overline{R} = 1 و Q=0Q = 0 وەستاوە. پاشان S‾\overline{S} بۆ ساتێک دەبێتە 0 و دەگەڕێتەوە بۆ 1. ئێستا Q چەندە؟

The gated latch and the D latchلاچی دەرگادار و لاچی D

An SR latch reacts at once to S and R. Usually we want to decide when it may change. Add two AND gates in front of S and R, both controlled by an enable input EN (also called C or G): when EN=0\mathrm{EN} = 0 both AND outputs are 0, so the latch holds; when EN=1\mathrm{EN} = 1, S and R pass through. This is a gated SR latch.

SR دەستبەجێ وەڵامی S و R دەداتەوە. زۆرجار دەمانەوێت بڕیار بدەین کەی دەتوانێت بگۆڕێت. دوو لە پێش S و R دابنێ کە هەردووکیان بە چالاککردن، EN (یان C یان G)، کۆنترۆڵ دەکرێن: کاتێک EN=0\mathrm{EN} = 0 بێت، هەردوو ANDـەکە 0ـە، بۆیە ڕادەگرێت؛ کاتێک EN=1\mathrm{EN} = 1 بێت، S و R تێدەپەڕن. ئەمە SRـی دەرگادارە.

One more step removes the forbidden input. Give the latch a single data input D, send D to S and its complement D‾\overline{D} to R. Now S and R are always opposite, so they can never both be 1. This is the D latch (D for data):

هەنگاوێکی تر قەدەغەکراوەکە لادەبات. تەنها یەک ، D، بدە بە ، D بنێرە بۆ S و ، D‾\overline{D}، بۆ R. ئێستا S و R هەمیشە پێچەوانەی یەکن، بۆیە هەرگیز ناتوانن پێکەوە 1 بن. ئەمە Dـیە (D بۆ data):

A D latch built from gates. D enters at the bottom AND gate; a branch of D goes through a NOT gate to the top AND gate as D-bar. EN enters in the middle and feeds both AND gates. The top AND output is R and goes to the top NOR gate (output Q); the bottom AND output is S and goes to the bottom NOR gate (output Q-bar); the two NOR gates are cross-coupled. On the right, the block symbol: a box with inputs D and EN and outputs Q and Q-bar. Note: EN = 1, Q follows D; EN = 0, Q keeps its value.لاچێکی D کە لە گەیتەکان دروست کراوە. D دەچێتە ناو گەیتەکەی AND خوارەوە؛ لقێکی D بە گەیتێکی NOTـدا وەک D̄ دەچێت بۆ گەیتەکەی AND سەرەوە. EN لە ناوەڕاستەوە دێت و دەچێتە ناو هەردوو گەیتەکەی AND. دەرخستەی ANDـی سەرەوە Rـە و دەچێت بۆ گەیتەکەی NOR سەرەوە (دەرخستەی Q)؛ دەرخستەی ANDـی خوارەوە Sـە و دەچێت بۆ گەیتەکەی NOR خوارەوە (دەرخستەی Q̄)؛ دوو گەیتەکەی NOR بە فیدباک بە یەکەوە بەستراون. لە لای ڕاست هێمای بلۆک: سندووقێک بە نێوخستەکانی D و EN و دەرخستەکانی Q و Q̄. تێبینی: EN = 1، Q دوای D دەکەوێت؛ EN = 0، Q بەهاکەی خۆی دەپارێزێت.
A D latch: the NOT gate makes S and R opposite, and EN decides when the latch listens. D: S و R پێچەوانەی یەک دەکات و EN بڕیار دەدات کەی گوێ دەگرێت.CêIT
Quick checkپشکنینی خێراWhy can a D latch never receive the forbidden input S=R=1S = R = 1?بۆچی D هەرگیز قەدەغەکراوەکەی S=R=1S = R = 1 وەرناگرێت؟

D latchBen Eater · Englishئینگلیزی · 816K viewsبینین · 17K likesلایک

Adds an enable input to the SR latch and turns it into a D latch that stores one bit while enabled.

چالاککردن بۆ SR زیاد دەکات و دەیکاتە D، کە لە کاتی چالاکبووندا یەک هەڵدەگرێت.

Ben Eater: 2:51 adding an enable to the SR latch, 8:08 the D latch.

⁦Ben Eater: 2:51⁩ زیادکردنی چالاککردن بۆ SR، ⁦8:08⁩ D.

The gated latch and the D latchلاچی دەرگادار و لاچی D

Transparent while enabledڕوون لە کاتی چالاکبووندا

The D latch D
ENDQ (next)Q (داهاتوو)
0XQ (hold)Q (ڕاگرتن)
100
111

While EN=1\mathrm{EN} = 1 the D latch is transparent: Q simply follows D, like looking through a window. When EN goes to 0 the window closes and Q keeps the last value D had. Chips such as the 74HC75 (4 bits) and the 74HC573 (8 bits) are rows of D latches, used to hold a value from a bus.

لە کاتی EN=1\mathrm{EN} = 1، D ڕوونە (transparent): Q تەنها دوای D دەکەوێت، وەک سەیرکردن بە پەنجەرەدا. کاتێک EN دەبێتە 0، پەنجەرەکە دادەخرێت و Q دوایین بەهای Dـی پێوە دەمێنێت. وەک ⁦74HC75 (4⁩ ) و ⁦74HC573 (8⁩ ) ڕیزێک لە Dـن کە بۆ هەڵگرتنی بەهایەک لە بەکار دێن.

Quick checkپشکنینی خێراA D latch has EN=1\mathrm{EN} = 1 and D changes from 0 to 1. Then EN goes to 0, and after that D goes back to 0. What is Q at the end? D EN=1\mathrm{EN} = 1ـی هەیە و D لە 0ـەوە دەبێتە 1. پاشان EN دەبێتە 0 و دوای ئەوە D دەگەڕێتەوە بۆ 0. لە کۆتاییدا Q چەندە؟

The clock: level or edge?سیگناڵی کاتژمێر: ئاست یان لێوار؟

Real systems use a clock: a square wave that ticks at a steady rate (pulses, period and frequency). Put the clock on EN and every latch may change only while the clock is HIGH. That is level triggering. It has a weakness: during the whole HIGH half of a period the latch is transparent, so if its output feeds back, through other gates, into its own input, a new value can race round the loop several times in one tick.

سیستەمە ڕاستەقینەکان بەکار دەهێنن: کە بە ڕێژەیەکی جێگیر لێدەدات (تڕپەکان، کاتی خولی و لەرەلەر). بدە بە EN و هەموو تەنها لە کاتی HIGH بوونی دەتوانێت بگۆڕێت. ئەمە چالاکبوون بە ئاستە (level triggering). کەموکوڕییەکی هەیە: لە هەموو نیوەی HIGHـی ڕوونە، بۆیە ئەگەر بە تردا بگەڕێتەوە بۆ خۆی، بەهایەکی نوێ دەتوانێت لە یەک لێداندا چەند جار بە بازنەکەدا بخولێتەوە.

The cure is edge triggering: the circuit samples its input only at the instant the clock changes, usually at the rising edge (0 → 1), and ignores the input the rest of the time. Such a circuit is a flip-flop. Every flip-flop in a system changes at the same instant, once per clock period — this is what keeps a whole processor in step. A timing diagram shows the difference best:

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

A timing diagram with four rows over six clock periods: CLK, D, Q of a D latch and Q of a D flip-flop. The HIGH halves of CLK are shaded blue and the six rising edges are dashed lines. D is 0, rises early in period 1, falls during the HIGH half of period 2, rises again in period 3, falls in period 4, and has a short pulse during period 5. The latch output follows D whenever CLK is HIGH, so it falls during period 2 and catches the short pulse in period 5. The flip-flop output changes only at the dashed rising edges: 1, 1, 0, 1, 0, 0.هێڵکارییەکی کاتبەندی بە چوار ڕیز بە درێژایی شەش کاتی خولیی سیگناڵی کاتژمێر: CLK، D، Qـی لاچی D و Qـی فلیپ-فلۆپی D. نیوە HIGHـەکانی CLK بە شین ڕەنگ کراون و شەش لێواری بەرزبوونەوەکە هێڵی پچڕپچڕن. D سەرەتا 0ـە، لە سەرەتای کاتی خولیی 1 بەرز دەبێتەوە، لە نیوەی HIGHـی کاتی خولیی 2 دادەبەزێت، لە کاتی خولیی 3 دیسان بەرز دەبێتەوە، لە کاتی خولیی 4 دادەبەزێت و لە کاتی خولیی 5 تڕپەیەکی کورتی هەیە. دەرخستەی لاچەکە لە هەر کاتێکدا CLK بەرز بێت دوای D دەکەوێت، بۆیە لە کاتی خولیی 2 دادەبەزێت و تڕپە کورتەکەی کاتی خولیی 5 دەگرێت. دەرخستەی فلیپ-فلۆپەکە تەنها لە لێوارەکانی بەرزبوونەوەی پچڕپچڕ دەگۆڕێت: 1، 1، 0، 1، 0، 0.
The latch is open for the whole HIGH half; the flip-flop looks only at the rising edges. بە درێژایی هەموو نیوەی HIGH کراوەیە؛ تەنها سەیری دەکات.CêIT
Quick checkپشکنینی خێراIn the timing diagram, why does the latch output catch the short pulse on D in period 5, but the flip-flop output does not?لە ، بۆچی کورتەکەی D لە 5 دەگرێت، بەڵام نایگرێت؟

The clock: level or edge?سیگناڵی کاتژمێر: ئاست یان لێوار؟

Latch or flip-flop?لاچ یان فلیپ-فلۆپ؟

Video or photoڤیدیۆ یان وێنە

A latch is like a phone camera filming while you hold the button: everything that happens in that time is recorded. A flip-flop is like taking one photo at the click: only that instant counts.

وەک کامێرای مۆبایلێکە کە تا دوگمەکە دابگریت ڤیدیۆ دەگرێت: هەموو ئەوەی لەو ماوەیەدا ڕوو دەدات تۆمار دەکرێت. وەک گرتنی یەک وێنەیە لە ساتی کلیککردندا: تەنها ئەو ساتە گرنگە.

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

A real edge is not perfectly instant: the input must be steady for a tiny time before and after it (the setup and hold times).

لێوارێکی ڕاستەقینە تەواو دەستبەجێ نییە: دەبێت بۆ کاتێکی زۆر کەم پێش و دوای ئەو جێگیر بێت (کاتەکانی setup و hold).

Quick checkپشکنینی خێراA circuit's output follows its data input for as long as its enable input is 1, and keeps the last value when the enable goes to 0. What is it? تا چالاککردنەکەی 1 بێت دوای دەکەوێت و کاتێک چالاککردنەکە دەبێتە 0 دوایین بەها دەپارێزێت. ئەمە چییە؟

The D flip-flopفلیپ-فلۆپی D

Definitionپێناسە

A one-bit memory circuit that changes only at the edge of a clock pulse. Flip-flops are the building blocks of registers and counters.

سووڕێکی بیرگەی یەک بیتییە کە تەنها لە لێواری دەگۆڕێت. فلیپ-فلۆپەکان بەردی بناغەی و .

The D flip-flop is the workhorse of digital design. At each rising edge of CLK it copies D to Q; between edges Q does not change, whatever D does. In one line: Q+=DQ^+ = D, sampled at the edge. On the symbol, the small triangle at the clock input means "edge-triggered". Follow it edge by edge:

D بەکارهاتووترین بلۆکی دیزاینی . لە هەر CLKـدا D کۆپی دەکات بۆ Q؛ لە نێوان لێوارەکاندا Q ناگۆڕێت، D هەرچی بکات. بە یەک دێڕ: Q+=DQ^+ = D، کە لە لێوارەکەدا دەخوێنرێتەوە. لەسەر ، سێگۆشە بچووکەکەی سەر واتە «لێوار-چالاک». لێوار بە لێوار بەدوایدا بڕۆ:

Animation in eight frames of a D flip-flop timing diagram with rows CLK, D and Q and six numbered rising edges. Frame 1 shows CLK and D only. In frames 2 to 7 one more edge is processed: the value of D at that edge is circled, an arrow carries it down to Q, and Q is drawn up to the next edge; the titles say "Edge 1: D is 1, so Q becomes 1", "Edge 2: D is 1, so Q stays 1", then 0, 1, 0 and 0. The last frame shows the whole Q wave (1, 1, 0, 1, 0, 0 after the six edges) and marks a short pulse on D between edges 5 and 6 as ignored.
Animation in eight frames of a D flip-flop timing diagram with rows CLK, D and Q and six numbered rising edges. Frame 1 shows CLK and D only. In frames 2 to 7 one more edge is processed: the value of D at that edge is circled, an arrow carries it down to Q, and Q is drawn up to the next edge; the titles say "Edge 1: D is 1, so Q becomes 1", "Edge 2: D is 1, so Q stays 1", then 0, 1, 0 and 0. The last frame shows the whole Q wave (1, 1, 0, 1, 0, 0 after the six edges) and marks a short pulse on D between edges 5 and 6 as ignored.
Q copies D only at the rising edges; everything D does between edges is ignored.Q تەنها لە D کۆپی دەکات؛ هەموو ئەوەی D لە نێوان لێوارەکاندا دەیکات پشتگوێ دەخرێت.CêIT

A D flip-flop is the natural way to store one bit at a chosen moment, and it is the cell of registers and shift registers in the next lesson. The 74HC74 chip has two D flip-flops, each with preset and clear inputs (see below).

D ڕێگای سروشتیی هەڵگرتنی یەک لە ساتێکی هەڵبژێردراودا و خانەی و جووڵاندنە لە وانەی داهاتوو. ⁦74HC74⁩ دوو Dـی هەیە کە هەر یەکەیان preset و clearـی هەیە (لە خوارەوە بڕوانە).

Quick checkپشکنینی خێراA rising-edge D flip-flop has Q=0Q = 0. Between two edges D goes 0 → 1 → 0. At the next edge D=0D = 0. What is Q after that edge? Dـی Q=0Q = 0ـی هەیە. لە نێوان دوو لێواردا ⁦D 0⁩ بۆ 1 بۆ 0 دەبێت. لە لێواری داهاتوودا D=0D = 0ـە. دوای ئەو لێوارە Q چەندە؟

D flip-flopBen Eater · Englishئینگلیزی · 774K viewsبینین · 15K likesلایک · Partبەشی 0:00–5:47 (ofلە 16:01)

Latch versus edge-triggered D flip-flop on a timing diagram: Q copies D only at the rising edge of the clock.

بەرامبەر Dـی لێوار-چالاک لەسەر : Q تەنها لە D کۆپی دەکات.

Plays 0:00–5:47: the timing diagram, latch versus flip-flop, and how a D flip-flop copies D only at the rising clock edge.

لە ⁦0:00⁩ تا ⁦5:47⁩ پەخش دەبێت: ، بەرامبەر و D چۆن تەنها لە D کۆپی دەکات.

The D flip-flopفلیپ-فلۆپی D

Inside an edge-triggered flip-flop: master and slaveناوەوەی فلیپ-فلۆپێکی لێوار-چالاک: سەرەکی و پاشکۆ

How can gates react to an edge? One classic way chains two D latches, the master and the slave, with opposite enables. While CLK=0\mathrm{CLK} = 0 the master is open and follows D, and the slave is closed, so Q does not move. At the rising edge the master closes and keeps the last D, and at the same moment the slave opens and passes that value to Q. While CLK=1\mathrm{CLK} = 1 the slave is open but the master is closed, so changes on D cannot get through. Q can therefore change only at the rising edge.

چۆن دەتوانن وەڵامی لێوارێک بدەنەوە؟ ڕێگایەکی کلاسیکی دوو D، سەرەکی (master) و پاشکۆ (slave)، بە چالاککردنی پێچەوانە بە زنجیر دەبەستێت. لە کاتی CLK=0\mathrm{CLK} = 0 سەرەکییەکە کراوەیە و دوای D دەکەوێت و پاشکۆکە داخراوە، بۆیە Q ناجووڵێت. لە سەرەکییەکە دادەخرێت و دوایین D ڕادەگرێت و لە هەمان ساتدا پاشکۆکە دەکرێتەوە و ئەو بەهایە دەگەیەنێتە Q. لە کاتی CLK=1\mathrm{CLK} = 1 پاشکۆکە کراوەیە بەڵام سەرەکییەکە داخراوە، بۆیە گۆڕانەکانی D ناتوانن تێپەڕن. کەواتە Q تەنها لە دەتوانێت بگۆڕێت.

Two D latch blocks in series: the master latch (inputs D and EN) and the slave latch. The master's Q feeds the slave's D, and the slave's Q is the output Q. CLK goes directly to the slave's EN and through a NOT gate to the master's EN. Labels: master open while CLK = 0, slave open while CLK = 1. Note: at the rising edge the master closes on the last D, and the slave shows it at Q.دوو بلۆکی لاچی D بە زنجیر: لاچی سەرەکی (نێوخستەکانی D و EN) و لاچی پاشکۆ. Qـی سەرەکی دەچێتە ناو Dـی پاشکۆ و Qـی پاشکۆ دەرخستەی Qـیە. CLK ڕاستەوخۆ دەچێت بۆ ENـی پاشکۆ و بە گەیتێکی NOTـدا بۆ ENـی سەرەکی. ناونیشانەکان: سەرەکی کراوەیە کاتێک CLK = 0، پاشکۆ کراوەیە کاتێک CLK = 1. تێبینی: لە لێواری بەرزبوونەوەدا سەرەکییەکە لەسەر دوایین D دادەخرێت و پاشکۆکە ئەو بەهایە لە Q پیشان دەدات.
Never both open: the pair passes D to Q only at the rising edge.هەرگیز هەردووکیان کراوە نین: جووتەکە D تەنها لە دەگەیەنێتە Q.CêIT

Real chips often use a cleverer circuit of three small latches (and old master–slave JK chips such as the 7476 change their outputs at the falling edge), but from the outside every edge-triggered flip-flop behaves the same: one sample per active edge.

ڕاستەقینەکان زۆرجار زیرەکتر لە سێ بچووک بەکار دەهێنن (و JKـی سەرەکی-پاشکۆی کۆنی وەک ⁦7476⁩ لە دەگۆڕن)، بەڵام لە دەرەوە هەموو لێوار-چالاک هەمان ڕەفتاری هەیە: بۆ هەر لێوارێکی چالاک یەک خوێندنەوە.

Quick checkپشکنینی خێراIn a master–slave D flip-flop (rising edge), which latch is open while CLK=0\mathrm{CLK} = 0?لە Dـی سەرەکی-پاشکۆدا ()، کام لە کاتی CLK=0\mathrm{CLK} = 0 کراوەیە؟

The JK flip-flop: set, reset, hold or toggleفلیپ-فلۆپی JK: دانان، سفرکردنەوە، ڕاگرتن یان هەڵگەڕانەوە

The JK flip-flop is an edge-triggered SR flip-flop that turns the forbidden input into something useful. J works like S (set) and K like R (reset); with J=K=1J = K = 1 the flip-flop toggles — Q changes to its opposite at the edge.

JK SRـی لێوار-چالاکە کە قەدەغەکراوەکە دەکات بە شتێکی بەسوود. J وەک S کار دەکات (دانان) و K وەک R (سفرکردنەوە)؛ کاتێک J=K=1J = K = 1 بێت، هەڵدەگەڕێتەوە (toggle) — Q لە لێوارەکەدا دەبێتە پێچەوانەی خۆی.

The JK flip-flop JK
J KQ⁺ (after the edge)Q⁺ (دوای لێوار)Actionکار
0 0Qholdڕاگرتن
0 10resetسفرکردنەوە
1 01setدانان
1 1Q‾\overline{Q}toggleهەڵگەڕانەوە
Q+=J Q‾+K‾ QQ^+ = J\,\overline{Q} + \overline{K}\,Q

If Q is 0, the next Q is J (only J can set it). If Q is 1, the next Q is NOT K (only K can reset it).

ئەگەر ⁦Q 0⁩ بێت، Qـی داهاتوو Jـە (تەنها J دەتوانێت دایبنێت). ئەگەر ⁦Q 1⁩ بێت، Qـی داهاتوو ⁦NOT K⁩ـە (تەنها K دەتوانێت سفری بکاتەوە).

The JK flip-flop can imitate the others: with K=J‾K = \overline{J} it is a D flip-flop, and with J and K joined it is a T flip-flop. The 7476 chip of the counter lab in the next lesson holds two JK flip-flops with preset and clear; it changes on the falling edge, which its symbol shows with a bubble before the triangle.

JK دەتوانێت لاسایی ئەوانی تر بکاتەوە: بە K=J‾K = \overline{J} دەبێتە D و بە بەستنەوەی J و K بە یەکەوە دەبێتە T. ⁦7476⁩ کە لە تاقیگەی وانەی داهاتوو بەکار دێت دوو JKـی هەیە بە preset و clear؛ لە دەگۆڕێت، کە بە بازنەیەک لە پێش سێگۆشەکە پیشانی دەدات.

Quick checkپشکنینی خێراA JK flip-flop has Q=1Q = 1. At the next edge J=1J = 1 and K=1K = 1. What is Q after the edge? JK Q=1Q = 1ـی هەیە. لە لێواری داهاتوودا J=1J = 1 و K=1K = 1ـە. دوای لێوارەکە Q چەندە؟

The T flip-flop: toggle and divide by twoفلیپ-فلۆپی T: هەڵگەڕانەوە و دابەشکردن بەسەر دوودا

The T flip-flop (T for toggle) has one input. T=0T = 0 holds, T=1T = 1 toggles at every active edge. It is a JK flip-flop with J and K tied together, or a D flip-flop with D=T⊕QD = T \oplus Q:

T (T بۆ toggle، هەڵگەڕانەوە) یەک هەیە. T=0T = 0 ڕادەگرێت، T=1T = 1 لە هەر لێوارێکی چالاکدا هەڵدەگەڕێتەوە. ئەمە JKـیە کە J و K بە یەکەوە بەستراون، یان Dـیە بە D=T⊕QD = T \oplus Q:

Q+=T⊕Q=T Q‾+T‾ QQ^+ = T \oplus Q = T\,\overline{Q} + \overline{T}\,Q

Hold T at 1 and Q changes once per clock period, so a whole period of Q takes two clock periods: the flip-flop divides the frequency by 2. A 1 kHz clock gives 500 Hz at Q. Chain three of them and you divide by 23=82^3 = 8: 8 MHz becomes 1 MHz. A quartz watch counts the 32,768 Hz of its crystal down to exactly 1 Hz with 15 such stages, because 32 768=21532\,768 = 2^{15}. Chains like this are the counters of the next lesson.

T لە 1دا ڕابگرە و Q لە هەر یەک جار دەگۆڕێت، بۆیە تەواوی Q دوو دەخایەنێت: دابەش دەکات بەسەر 2دا. ⁦1 kHz⁩ لە ⁦Q 500 Hz⁩ دەدات. سێیان بە زنجیر ببەستە و بەسەر 23=82^3 = 8دا دابەشی دەکەیت: ⁦8 MHz⁩ دەبێتە ⁦1 MHz⁩. کاتژمێرێکی کوارتز ⁦32,768 Hz⁩ـی کریستاڵەکەی بە ⁦15⁩ قۆناغی وەها دەژمێرێت تا دەگاتە ڕێک ⁦1 Hz⁩، چونکە 32 768=21532\,768 = 2^{15}. زنجیری وەها وانەی داهاتوون.

A timing diagram with two rows. CLK is a fast square wave with fourteen periods. Q, from a T flip-flop with T = 1, changes at every rising edge of CLK, so it is a square wave with half as many periods. Caption below: two clock periods make one period of Q, f(Q) = f(CLK) ÷ 2.هێڵکارییەکی کاتبەندی بە دوو ڕیز. CLK شەپۆلێکی چوارگۆشەیی خێرایە بە چواردە کاتی خولی. Q، لە فلیپ-فلۆپێکی T بە T = 1، لە هەر لێواری بەرزبوونەوەی CLKـدا دەگۆڕێت، بۆیە شەپۆلێکی چوارگۆشەییە بە نیوەی ژمارەی کاتی خولی. ژێرنووس لە خوارەوە: دوو کاتی خولیی CLK دەبنە یەک کاتی خولیی Q، f(Q) = f(CLK) ÷ 2.
T=1T = 1: Q toggles at every rising edge, so its frequency is half the clock frequency.T=1T = 1: Q لە هەر هەڵدەگەڕێتەوە، بۆیە نیوەی .CêIT
Quick checkپشکنینی خێراA 4 MHz clock drives a T flip-flop with T=1T = 1. What frequency appears at Q? ⁦4 MHz⁩ T بە T=1T = 1 دەجووڵێنێت. چ لە Q دەردەکەوێت؟

The four types side by sideچوار جۆرەکە لە تەنیشت یەک

Each flip-flop type is described by a characteristic table — the next state Q+Q^+ (after the edge) for every input and present state Q — or by the matching characteristic equation. Q is the bit stored now; Q+Q^+ is the bit stored after the next active edge.

هەر جۆرێکی بە وەسف دەکرێت — دۆخی داهاتوو Q+Q^+ (دوای لێوار) بۆ هەر و دۆخی ئێستای Q — یان بە ـی هاوتای. Q ئەو کە ئێستا هەڵگیراوە؛ Q+Q^+ ئەو کە دوای لێواری چالاکی داهاتوو هەڵدەگیرێت.

Five block symbols side by side. D latch: inputs D and EN without a triangle; Q-plus = D while EN = 1. D flip-flop: inputs D and a clock input with a triangle; Q-plus = D at each rising edge. JK flip-flop: J, clock triangle, K; Q-plus = J Q-bar + K-bar Q. T flip-flop: T and clock triangle; Q-plus = T XOR Q. The last box shows a JK flip-flop whose clock input has a bubble before the triangle: it changes on the falling edge, like the 7476. Every block has outputs Q and Q-bar.پێنج هێمای بلۆک لە تەنیشت یەک. لاچی D: نێوخستەکانی D و EN بێ سێگۆشە؛ Q⁺ = D لە کاتی EN = 1. فلیپ-فلۆپی D: نێوخستەی D و نێوخستەی سیگناڵی کاتژمێر بە سێگۆشە؛ Q⁺ = D لە هەر لێواری بەرزبوونەوەدا. فلیپ-فلۆپی JK: J، سێگۆشەی سیگناڵی کاتژمێر، K؛ Q⁺ = JQ̄ + K̄Q. فلیپ-فلۆپی T: T و سێگۆشەی سیگناڵی کاتژمێر؛ Q⁺ = T XOR Q. دوایین سندووق فلیپ-فلۆپێکی JK پیشان دەدات کە نێوخستەی سیگناڵی کاتژمێرەکەی بازنەیەکی لە پێش سێگۆشەکەدا هەیە: لە لێواری نزمبوونەوە دەگۆڕێت، وەک 7476. هەموو بلۆکێک دەرخستەکانی Q و Q̄ـی هەیە.
The triangle means edge-triggered; a bubble before it means the falling edge.سێگۆشەکە واتە لێوار-چالاک؛ بازنەیەک لە پێشیدا واتە .CêIT
Characteristic tables and equations of the four types و چوار جۆرەکە
TypeجۆرInputs → Q⁺ ← Q⁺Characteristic equation
SR00 hold, 01 → 0, 10 → 1, 11 not allowed⁦00⁩ ڕاگرتن، ⁦01⁩ ← 0، ⁦10⁩ ← 1، ⁦11⁩ ڕێگەپێنەدراوQ+=S+R‾Q, SR=0Q^+ = S + \overline{R}Q,\ SR = 0
JK00 hold, 01 → 0, 10 → 1, 11 toggle⁦00⁩ ڕاگرتن، ⁦01⁩ ← 0، ⁦10⁩ ← 1، ⁦11⁩ هەڵگەڕانەوەQ+=JQ‾+K‾QQ^+ = J\overline{Q} + \overline{K}Q
D0 → 0, 1 → 10 ← 0، 1 ← 1Q+=DQ^+ = D
T0 hold, 1 toggle0 ڕاگرتن، 1 هەڵگەڕانەوەQ+=T⊕QQ^+ = T \oplus Q

Every equation comes from an ordinary truth table with Q as one more input. For the JK flip-flop, with all eight rows:

هەموو لە ئاسایی دێت کە Q زیادەیە تێیدا. بۆ JK، بە هەر هەشت ڕیزەکەوە:

JK characteristic table with Q as an input JK کە Q تێیدا
J K QQ⁺
0 0 00
0 0 11
0 1 00
0 1 10
1 0 01
1 0 11
1 1 01
1 1 10

Q+=1Q^+ = 1 in rows 001, 100, 101 and 110. Grouping them on a Karnaugh map gives JQ‾J\overline{Q} (rows 100, 110) and K‾Q\overline{K}Q (rows 001, 101): exactly the equation above.

Q+=1Q^+ = 1 لە ڕیزەکانی ⁦001⁩، ⁦100⁩، ⁦101⁩ و ⁦110⁩دا. گرووپکردنیان لەسەر نەخشەیەکی کارنۆ JQ‾J\overline{Q} (ڕیزەکانی ⁦100⁩، ⁦110⁩) و K‾Q\overline{K}Q (ڕیزەکانی ⁦001⁩، ⁦101⁩) دەدات: ڕێک سەرەوە.

Quick checkپشکنینی خێراWhich flip-flop's next state does not depend on its present state Q?دۆخی داهاتووی کام بەند نییە بە دۆخی ئێستای Q؟

Preset and clear: acting without the clockPreset و clear: کارکردن بێ سیگناڵی کاتژمێر

When the power comes on, every flip-flop wakes up in a random state. So most flip-flop chips have two extra direct (asynchronous) inputs: preset forces Q=1Q = 1 and clear forces Q=0Q = 0, at once, without waiting for a clock edge. On chips such as the 74HC74 and the 7476 they are active-low, written PRE‾\overline{PRE} and CLR‾\overline{CLR}. A reset button that clears every flip-flop of a circuit uses them.

کاتێک کارەبا دێت، هەموو بە دۆخێکی هەڕەمەکی هەڵدەستێت. بۆیە زۆربەی دوو زیادەی ڕاستەوخۆیان (ناهاوکات) هەیە: preset Q=1Q = 1 دەسەپێنێت و clear Q=0Q = 0 دەسەپێنێت، دەستبەجێ، بێ چاوەڕوانیی لێوارێکی . لە وەک ⁦74HC74⁩ و ⁦7476⁩دا چالاکن بە LOW و بەم شێوەیە دەنووسرێن: PRE‾\overline{PRE} و CLR‾\overline{CLR}. دوگمەیەکی reset کە هەموو سفر دەکاتەوە ئەمانە بەکار دەهێنێت.

Active-low preset and clearpreset و clearـی چالاک بە LOW
PRE̅CLR̅Q
11normal: changes only at clock edgesئاسایی: تەنها لە لێوارەکانی دەگۆڕێت
011 at once1، دەستبەجێ
100 at once0، دەستبەجێ
00not allowedڕێگەپێنەدراو
Quick checkپشکنینی خێراA 74HC74 flip-flop has D=1D = 1, but CLR‾\overline{CLR} is held at 0. A rising clock edge arrives. What is Q? ⁦74HC74⁩ D=1D = 1ـی هەیە، بەڵام CLR‾\overline{CLR} لە 0دا ڕاگیراوە. دێت. Q چەندە؟

Reading timing diagrams step by stepخوێندنەوەی هێڵکارییەکانی کاتبەندی هەنگاو بە هەنگاو

Exam questions often give the clock and the inputs and ask for Q. Use the same four steps for every flip-flop:

پرسیارەکانی تاقیکردنەوە زۆرجار و دەدەن و Q دەپرسن. بۆ هەموو هەمان چوار هەنگاو بەکار بهێنە:

  1. Mark every active edge with a vertical line (rising edges, unless the symbol shows a bubble).

    هەموو لێوارێکی چالاک بە هێڵێکی ستوونی دیاری بکە (، مەگەر بازنەیەک پیشان بدات).

  2. At each edge, read the inputs just before the edge.

    لە هەر لێوارێکدا ڕێک پێش لێوارەکە بخوێنەوە.

  3. Apply the characteristic table to get Q+Q^+ from the inputs and the present Q.

    جێبەجێ بکە بۆ وەرگرتنی Q+Q^+ لە و Qـی ئێستا.

  4. Draw Q flat until the next edge — whatever the inputs do in between.

    Q ڕاست بکێشە تا لێواری داهاتوو — لە نێوانیاندا هەرچی بکەن.

Worked JK timing diagram with rows CLK, J, K and Q and six numbered rising edges. Before the edges J, K are 10, 00, 11, 11, 01, 11. Under the edges the actions are written: set, hold, toggle, toggle, reset, toggle. Q starts at 0 and after the six edges is 1, 1, 0, 1, 0, 1.هێڵکارییەکی کاتبەندی JKـی کارکراو بە ڕیزەکانی CLK، J، K و Q و شەش لێواری بەرزبوونەوەی ژمارەدار. پێش لێوارەکان J، K بەم شێوەیەن: 10، 00، 11، 11، 01، 11. لە ژێر لێوارەکاندا کارەکان نووسراون: دانان، ڕاگرتن، هەڵگەڕانەوە، هەڵگەڕانەوە، سفرکردنەوە، هەڵگەڕانەوە. Q لە 0ـەوە دەست پێ دەکات و دوای شەش لێوارەکە 1، 1، 0، 1، 0، 1ـە.
Edge by edge: set, hold, toggle, toggle, reset, toggle. Q only moves on the dashed lines.لێوار بە لێوار: دانان، ڕاگرتن، هەڵگەڕانەوە، هەڵگەڕانەوە، سفرکردنەوە، هەڵگەڕانەوە. Q تەنها لەسەر هێڵە پچڕپچڕەکان دەجووڵێت.CêIT
Quick checkپشکنینی خێراIn the worked JK example, why does Q stay 1 at edge 2?لە نموونە کارکراوەکەی JKـدا، بۆچی Q لە لێواری 2دا هەر 1 دەمێنێت؟

Where latches and flip-flops liveلاچەکان و فلیپ-فلۆپەکان لە کوێ دەژین

  • Static RAM. Each bit of SRAM — the CPU cache — is a latch: two cross-coupled inverters, plus two transistors that connect it to the data lines. That is the "six transistors per bit" that makes SRAM fast but expensive.
  • Registers. A CPU register is a row of flip-flops that share one clock (Registers and buses explains what registers do; the next lesson shows how they are built).
  • Counters and frequency dividers. Chains of T flip-flops count pulses and slow a clock down (a quartz watch).
  • Clean switches. An SR latch removes the bounce of a mechanical switch.
  • . هەر SRAM — — : دوو بەیەکەوەبەستراو، لەگەڵ دوو کە دەیبەستنەوە بە هێڵەکانی . ئەمە ئەو «شەش بۆ هەر »ـەیە کە خێرا بەڵام گران دەکات.
  • . ڕیزێک کە یەک بەکار دەهێنن (تۆمارگەکان و تێپەڕگەکان ڕوونی دەکاتەوە چی دەکەن؛ وانەی داهاتوو پیشان دەدات چۆن دروست دەکرێن).
  • و دابەشکەرەکانی . زنجیری T دەژمێرن و هێواش دەکەنەوە (کاتژمێری کوارتز).
  • پاک. SR لەرینەوەی میکانیکی لادەبات.
Quick checkپشکنینی خێراAn SRAM cell keeps its bit as long as there is power, without refreshing. Which circuit of this lesson is it built like?خانەیەکی تا کارەبا هەبێت دەپارێزێت، بێ نوێکردنەوە. لە کام ئەم وانەیە دەچێت؟

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

  • Calling every memory circuit a flip-flop. A latch is transparent while enabled; a flip-flop changes only at a clock edge. Their timing diagrams differ.
  • Reading the input at the wrong moment. For an edge-triggered flip-flop, read D (or J, K, T) just before the edge — not while the clock is HIGH, and not after the edge.
  • Using S=R=1S = R = 1. It is forbidden in the SR latch. If you need "change to the opposite", use a JK (J=K=1J = K = 1) or a T flip-flop.
  • Forgetting active-low inputs. On a NAND latch and on most preset/clear pins, the action happens on 0.
  • Drawing Q changing exactly with the clock. In real chips Q moves a few nanoseconds after the edge; on paper we draw it at the edge, but in fast circuits the delay matters.
  • Thinking T=0T = 0 resets. T=0T = 0 means hold; only T=1T = 1 changes Q.
  • ناونانی هەموو بە . لە کاتی چالاکبووندا ڕوونە؛ تەنها لە لێوارێکی دەگۆڕێت. جیاوازن.
  • خوێندنەوەی لە ساتی هەڵەدا. بۆ لێوار-چالاک، D (یان J، K، T) ڕێک پێش لێوارەکە بخوێنەوە — نەک لە کاتی HIGH بوونی و نەک دوای لێوارەکە.
  • بەکارهێنانی S=R=1S = R = 1. لە SRـدا قەدەغەیە. ئەگەر «گۆڕین بۆ پێچەوانە»ت پێویستە، JK (J=K=1J = K = 1) یان T بەکار بهێنە.
  • لەبیرکردنی چالاک بە LOW. لە NAND و زۆربەی پینەکانی ⁦preset/clear⁩، کارەکە بە 0 ڕوو دەدات.
  • کێشانی Q کە ڕێک لەگەڵ دەگۆڕێت. لە ڕاستەقینەکاندا Q چەند نانۆچرکەیەک دوای لێوارەکە دەجووڵێت؛ لەسەر کاغەز لە لێوارەکەدا دەیکێشین، بەڵام لە خێرادا دواکەوتنەکە گرنگە.
  • وابزانیت T=0T = 0 سفر دەکاتەوە. T=0T = 0 واتە ڕاگرتن؛ تەنها T=1T = 1 Q دەگۆڕێت.

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

Original exercises on latches, flip-flops and timing. Work each one on paper first.

ڕاهێنانی تازە لەسەر ، و کاتبەندی. سەرەتا هەر یەکێکیان لەسەر کاغەز بکە.

ExerciseڕاهێنانAn SR latch, step by stepلاچی SR، هەنگاو بە هەنگاو

A NOR latch starts with Q=0Q = 0. The inputs S R are applied one after another: 10, 00, 01, 00, 10, 10, 00. Write Q after each step.

NOR بە Q=0Q = 0 دەست پێ دەکات. ⁦S R⁩ یەک لە دوای یەک دەدرێن: ⁦10⁩، ⁦00⁩، ⁦01⁩، ⁦00⁩، ⁦10⁩، ⁦10⁩، ⁦00. Q⁩ دوای هەر هەنگاوێک بنووسە.

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

Q=1,1,0,0,1,1,1Q = 1, 1, 0, 0, 1, 1, 1. Set, hold, reset, hold, set, set again (no change), hold.

Q=1,1,0,0,1,1,1Q = 1, 1, 0, 0, 1, 1, 1. دانان، ڕاگرتن، سفرکردنەوە، ڕاگرتن، دانان، دیسان دانان (بێ گۆڕان)، ڕاگرتن.

ExerciseڕاهێنانThe NAND latchلاچی NAND

A NAND latch starts with Q=1Q = 1. The inputs S‾ R‾\overline{S}\,\overline{R} are: 11, 10, 11, 01, 11. Write Q after each step.

NAND بە Q=1Q = 1 دەست پێ دەکات. S‾ R‾\overline{S}\,\overline{R} بەم شێوەیەن: ⁦11⁩، ⁦10⁩، ⁦11⁩، ⁦01⁩، ⁦11. Q⁩ دوای هەر هەنگاوێک بنووسە.

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

Q=1,0,0,1,1Q = 1, 0, 0, 1, 1. 11 holds, 10 resets (R‾=0\overline{R} = 0), 01 sets (S‾=0\overline{S} = 0). The inputs are active-low.

Q=1,0,0,1,1Q = 1, 0, 0, 1, 1. ⁦11⁩ ڕادەگرێت، ⁦10⁩ سفر دەکاتەوە (R‾=0\overline{R} = 0)، ⁦01⁩ دادەنێت (S‾=0\overline{S} = 0). چالاکن بە LOW.

ExerciseڕاهێنانA JK sequenceزنجیرەیەکی JK

A rising-edge JK flip-flop starts with Q=1Q = 1. Just before the six edges, the inputs JK are 01, 10, 11, 00, 11, 01. Write Q after each edge.

JKـی بە Q=1Q = 1 دەست پێ دەکات. ڕێک پێش شەش لێوارەکە، JK بەم شێوەیەن: ⁦01⁩، ⁦10⁩، ⁦11⁩، ⁦00⁩، ⁦11⁩، ⁦01. Q⁩ دوای هەر لێوارێک بنووسە.

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

Q=0,1,0,0,1,0Q = 0, 1, 0, 0, 1, 0 (reset, set, toggle, hold, toggle, reset).

Q=0,1,0,0,1,0Q = 0, 1, 0, 0, 1, 0 (سفرکردنەوە، دانان، هەڵگەڕانەوە، ڕاگرتن، هەڵگەڕانەوە، سفرکردنەوە).

ExerciseڕاهێنانA T flip-flopفلیپ-فلۆپی T

A T flip-flop starts with Q=0Q = 0. Just before six edges, T=1,1,0,1,0,1T = 1, 1, 0, 1, 0, 1. Write Q after each edge.

T بە Q=0Q = 0 دەست پێ دەکات. ڕێک پێش شەش لێوار، T=1,1,0,1,0,1T = 1, 1, 0, 1, 0, 1. Q دوای هەر لێوارێک بنووسە.

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

Q=1,0,0,1,1,0Q = 1, 0, 0, 1, 1, 0: it toggles when T=1T = 1 and holds when T=0T = 0.

Q=1,0,0,1,1,0Q = 1, 0, 0, 1, 1, 0: کاتێک T=1T = 1 بێت هەڵدەگەڕێتەوە و کاتێک T=0T = 0 بێت ڕادەگرێت.

ExerciseڕاهێنانDividing a clockدابەشکردنی سیگناڵی کاتژمێر

(a) An 8 MHz clock passes through three T flip-flops in a chain, each with T=1T = 1. What frequency comes out of the last one? (b) How many such stages turn 32,768 Hz into 1 Hz?

(أ) ⁦8 MHz⁩ بە سێ Tـدا تێدەپەڕێت کە بە زنجیر بەستراون و هەر یەکەیان T=1T = 1ـە. چ لە دواینیانەوە دەردەچێت؟ (ب) چەند قۆناغی وەها ⁦32,768 Hz⁩ دەکەن بە ⁦1 Hz⁩؟

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

(a) Each stage halves the frequency: 8 → 4 → 2 → 1 MHz. (b) 15 stages, because 215=32 7682^{15} = 32\,768.

(أ) هەر قۆناغێک دەکاتە نیوە: 8 ← 4 ← 2 ← ⁦1 MHz⁩. (ب) ⁦15⁩ قۆناغ، چونکە 215=32 7682^{15} = 32\,768.

ExerciseڕاهێنانOne flip-flop imitates anotherفلیپ-فلۆپێک لاسایی یەکێکی تر دەکاتەوە

(a) How do you wire a JK flip-flop so that it behaves like a D flip-flop? (b) How do you make a T flip-flop from a D flip-flop and one gate? Check both with the characteristic equations.

(أ) چۆن JK دەبەستیتەوە تاکو وەک D ڕەفتار بکات؟ (ب) چۆن T لە D و یەک دروست دەکەیت؟ هەردووکیان بە بپشکنە.

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

(a) J=DJ = D and K=D‾K = \overline{D} (one NOT gate): Q+=DQ‾+DQ=DQ^+ = D\overline{Q} + DQ = D. (b) Feed D=T⊕QD = T \oplus Q with an XOR gate: then Q+=D=T⊕QQ^+ = D = T \oplus Q, the T equation.

(أ) J=DJ = D و K=D‾K = \overline{D} (یەک ): Q+=DQ‾+DQ=DQ^+ = D\overline{Q} + DQ = D. (ب) بە D=T⊕QD = T \oplus Q بدە: ئەو کاتە Q+=D=T⊕QQ^+ = D = T \oplus Q، کە Tـیە.

ExerciseڕاهێنانProve the JK equationسەلماندنی هاوکێشەی JK

Check that Q+=JQ‾+K‾QQ^+ = J\overline{Q} + \overline{K}Q gives the JK table for all eight combinations of J, K and Q.

بپشکنە کە Q+=JQ‾+K‾QQ^+ = J\overline{Q} + \overline{K}Q خشتەی JK بۆ هەر هەشت تێکەڵەی J، K و Q دەدات.

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

Q=0Q = 0: Q+=JQ^+ = J, so 00 → 0 (hold), 01 → 0, 10 → 1, 11 → 1 (toggle from 0). Q=1Q = 1: Q+=K‾Q^+ = \overline{K}, so 00 → 1 (hold), 01 → 0, 10 → 1, 11 → 0 (toggle from 1). All eight rows match the table in "The four types side by side".

Q=0Q = 0: Q+=JQ^+ = J، بۆیە ⁦00⁩ ← 0 (ڕاگرتن)، ⁦01⁩ ← 0، ⁦10⁩ ← 1، ⁦11⁩ ← 1 (هەڵگەڕانەوە لە 0ـەوە). Q=1Q = 1: Q+=K‾Q^+ = \overline{K}، بۆیە ⁦00⁩ ← 1 (ڕاگرتن)، ⁦01⁩ ← 0، ⁦10⁩ ← 1، ⁦11⁩ ← 0 (هەڵگەڕانەوە لە 1ـەوە). هەر هەشت ڕیزەکە لەگەڵ خشتەکەی «چوار جۆرەکە لە تەنیشت یەک» یەکدەگرنەوە.

Summaryپوختە

  • A sequential circuit's output depends on its inputs and on a stored state; feedback creates the memory.
  • The SR latch (two NOR gates) sets, resets and holds; S=R=1S = R = 1 is forbidden (Q+=S+R‾QQ^+ = S + \overline{R}Q, SR=0SR = 0). The NAND latch has active-low inputs.
  • A D latch has no forbidden input and is transparent while EN=1\mathrm{EN} = 1.
  • A flip-flop changes only at a clock edge (triangle on the symbol); master–slave latches are one way to build it.
  • D: Q+=DQ^+ = D. JK: Q+=JQ‾+K‾QQ^+ = J\overline{Q} + \overline{K}Q (11 toggles). T: Q+=T⊕QQ^+ = T \oplus Q (T=1T = 1 halves the frequency).
  • Preset and clear act at once, without the clock. Read timing diagrams edge by edge.
  • Latches are SRAM cells; flip-flops make registers and counters.
  • بەندە بە و بە دۆخێکی هەڵگیراو؛ دروست دەکات.
  • SR (دوو ) دادەنێت، سفر دەکاتەوە و ڕادەگرێت؛ S=R=1S = R = 1 قەدەغەیە (Q+=S+R‾QQ^+ = S + \overline{R}Q، SR=0SR = 0). NAND چالاک بە LOWـی هەیە.
  • D هیچ قەدەغەکراوی نییە و لە کاتی EN=1\mathrm{EN} = 1 ڕوونە.
  • تەنها لە لێوارێکی دەگۆڕێت (سێگۆشە لەسەر )؛ سەرەکی و پاشکۆ ڕێگایەکن بۆ دروستکردنی.
  • D: Q+=DQ^+ = D. JK: Q+=JQ‾+K‾QQ^+ = J\overline{Q} + \overline{K}Q (⁦11⁩ هەڵدەگەڕێنێتەوە). T: Q+=T⊕QQ^+ = T \oplus Q (T=1T = 1 دەکاتە نیوە).
  • Preset و clear دەستبەجێ کار دەکەن، بێ . لێوار بە لێوار بخوێنەوە.
  • خانەکانی ؛ و دروست دەکەن.

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

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

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

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

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

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

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